LibreOffice Module framework (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
framework::ServiceHandler Class Referencefinal

protocol handler for "service:*" URLs @descr It's a special dispatch/provider object which is registered for such URL pattern and will be automatically used by the framework dispatch mechanism if such URL occurred. More...

#include <servicehandler.hxx>

Inheritance diagram for framework::ServiceHandler:
[legend]
Collaboration diagram for framework::ServiceHandler:
[legend]

Public Member Functions

 ServiceHandler (css::uno::Reference< css::uno::XComponentContext >)
 standard ctor @descr This initializes a new instance of this class with needed information for work. More...
 
virtual ~ServiceHandler () override
 standard dtor More...
 
virtual OUString SAL_CALL getImplementationName () override
 
virtual sal_Bool SAL_CALL supportsService (const OUString &sServiceName) override
 
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override
 
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch (const css::util::URL &aURL, const OUString &sTarget, sal_Int32 nFlags) override
 decide if this dispatch implementation can be used for requested URL or not @descr A protocol handler is registered for a URL pattern inside configuration and will be asked by the generic dispatch mechanism inside framework, if he can handle this special URL which match his registration. More...
 
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches (const css::uno::Sequence< css::frame::DispatchDescriptor > &lDescriptor) override
 do the same like dispatch() but for multiple requests at the same time More...
 
virtual void SAL_CALL dispatchWithNotification (const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Reference< css::frame::XDispatchResultListener > &xListener) override
 dispatch with guaranteed notifications about success @descr We use threadsafe internal method to do so. More...
 
virtual void SAL_CALL dispatch (const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments) override
 dispatch URL with arguments @descr We use threadsafe internal method to do so. More...
 
virtual void SAL_CALL addStatusListener (const css::uno::Reference< css::frame::XStatusListener > &xListener, const css::util::URL &aURL) override
 add/remove listener for state events @descr We use an internal container to hold such registered listener. More...
 
virtual void SAL_CALL removeStatusListener (const css::uno::Reference< css::frame::XStatusListener > &xListener, const css::util::URL &aURL) override
 

Private Member Functions

css::uno::Reference< css::uno::XInterface > implts_dispatch (const css::util::URL &aURL)
 threadsafe helper for dispatch calls @descr We support two interfaces for the same process - dispatch URLs. More...
 

Private Attributes

css::uno::Reference< css::uno::XComponentContext > m_xContext
 reference to global uno service manager which had created us More...
 

Detailed Description

protocol handler for "service:*" URLs @descr It's a special dispatch/provider object which is registered for such URL pattern and will be automatically used by the framework dispatch mechanism if such URL occurred.

His job is to create any registered uno components which must be coded inside dispatched URL (may with some optional given parameters). After that such created service must be hold his self alive. Such mechanism can be useful for UI components (e.g. Dialogs, Wizards) only.

@base OWeakObject provides XWeak and ref count mechanism

@devstatus ready to use

Definition at line 49 of file servicehandler.hxx.

Constructor & Destructor Documentation

◆ ServiceHandler()

framework::ServiceHandler::ServiceHandler ( css::uno::Reference< css::uno::XComponentContext >  xContext)

standard ctor @descr This initializes a new instance of this class with needed information for work.

Parameters
xFactoryreference to uno servicemanager for creation of new services

Definition at line 60 of file servicehandler.cxx.

◆ ~ServiceHandler()

framework::ServiceHandler::~ServiceHandler ( )
overridevirtual

standard dtor

Definition at line 68 of file servicehandler.cxx.

Member Function Documentation

◆ addStatusListener()

void SAL_CALL framework::ServiceHandler::addStatusListener ( const css::uno::Reference< css::frame::XStatusListener > &  xListener,
const css::util::URL &  aURL 
)
overridevirtual

add/remove listener for state events @descr We use an internal container to hold such registered listener.

This container lives if we live. And if call pass registration as non breakable transaction - we can accept the request without any explicit lock. Because we share our mutex with this container.

Parameters
xListenerreference to a valid listener for state events
aURLURL about listener will be informed, if something occurred

Definition at line 238 of file servicehandler.cxx.

◆ dispatch()

void SAL_CALL framework::ServiceHandler::dispatch ( const css::util::URL &  aURL,
const css::uno::Sequence< css::beans::PropertyValue > &  lArguments 
)
overridevirtual

dispatch URL with arguments @descr We use threadsafe internal method to do so.

It returns a state value - but we ignore it. Because we don't support status listener notifications here.

Parameters
aURLuno URL which should be executed
lArgumentslist of optional arguments for this request

Definition at line 119 of file servicehandler.cxx.

References aURL, and implts_dispatch().

◆ dispatchWithNotification()

void SAL_CALL framework::ServiceHandler::dispatchWithNotification ( const css::util::URL &  aURL,
const css::uno::Sequence< css::beans::PropertyValue > &  lArguments,
const css::uno::Reference< css::frame::XDispatchResultListener > &  xListener 
)
overridevirtual

dispatch with guaranteed notifications about success @descr We use threadsafe internal method to do so.

Return state of this function will be used for notification if an optional listener is given.

Parameters
aURLuno URL which should be executed
lArgumentslist of optional arguments for this request
xListeneroptional listener for state events

Definition at line 141 of file servicehandler.cxx.

References aEvent, aURL, and implts_dispatch().

◆ getImplementationName()

OUString SAL_CALL framework::ServiceHandler::getImplementationName ( )
overridevirtual

Definition at line 37 of file servicehandler.cxx.

◆ getSupportedServiceNames()

css::uno::Sequence< OUString > SAL_CALL framework::ServiceHandler::getSupportedServiceNames ( )
overridevirtual

Definition at line 47 of file servicehandler.cxx.

References framework::SERVICENAME_PROTOCOLHANDLER.

◆ implts_dispatch()

css::uno::Reference< css::uno::XInterface > framework::ServiceHandler::implts_dispatch ( const css::util::URL &  aURL)
private

threadsafe helper for dispatch calls @descr We support two interfaces for the same process - dispatch URLs.

Exceptions
css::uno::RuntimeException

That the reason for this internal function. It implements the real dispatch operation and returns a state value which inform caller about success. He can notify listener then by using this return value.

Parameters
aURLuno URL which should be executed
Returns
<NULL> if requested service couldn't be created successfully; a valid reference otherwise. This return value can be used to indicate, if dispatch was successful.

Definition at line 178 of file servicehandler.cxx.

References aURL, m_xContext, framework::PROTOCOL_VALUE, sServiceName, and TOOLS_WARN_EXCEPTION.

Referenced by dispatch(), and dispatchWithNotification().

◆ queryDispatch()

css::uno::Reference< css::frame::XDispatch > SAL_CALL framework::ServiceHandler::queryDispatch ( const css::util::URL &  aURL,
const OUString &  sTarget,
sal_Int32  nFlags 
)
overridevirtual

decide if this dispatch implementation can be used for requested URL or not @descr A protocol handler is registered for a URL pattern inside configuration and will be asked by the generic dispatch mechanism inside framework, if he can handle this special URL which match his registration.

He can agree by returning of a valid dispatch instance or disagree by returning <NULL>. We don't create new dispatch instances here really - we return THIS as result to handle it at the same implementation.

Definition at line 81 of file servicehandler.cxx.

References aURL, and framework::PROTOCOL_VALUE.

Referenced by queryDispatches().

◆ queryDispatches()

css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL framework::ServiceHandler::queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor > &  lDescriptor)
overridevirtual

do the same like dispatch() but for multiple requests at the same time

Definition at line 94 of file servicehandler.cxx.

References i, nCount, and queryDispatch().

◆ removeStatusListener()

void SAL_CALL framework::ServiceHandler::removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener > &  xListener,
const css::util::URL &  aURL 
)
overridevirtual

Definition at line 244 of file servicehandler.cxx.

◆ supportsService()

sal_Bool SAL_CALL framework::ServiceHandler::supportsService ( const OUString &  sServiceName)
overridevirtual

Definition at line 42 of file servicehandler.cxx.

References sServiceName, and cppu::supportsService().

Member Data Documentation

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > framework::ServiceHandler::m_xContext
private

reference to global uno service manager which had created us

Definition at line 58 of file servicehandler.hxx.

Referenced by implts_dispatch().


The documentation for this class was generated from the following files: