A class that manages a service that is running remotely over the network. More...
#include <service_host.hpp>
Public Member Functions | |
| void | initializeFlowControl (int credits, int creditreturninterval) |
| Initialize flow control object. More... | |
| bool | registerRoutingInformationSchema (const string &schema) |
| Register routing information schema. More... | |
| bool | registerServiceDescriptionSchema (const string &schema) |
| Invoked to register service description xml. More... | |
| RemoteServiceHost (const string &type, shared_ptr< ServiceServiceConcept::Session > serviceSession, ServiceRuntimeDataRegistrySharedPtr registry=ServiceRuntimeDataRegistrySharedPtr()) | |
| Constructor. More... | |
| void | setClientDescriptor (ClientDescriptorSharedPtr clientDescription) |
| Sets a client descriptor. More... | |
| void | setDescription (const AbstractService::ServiceDescription &description) |
| Set service description for a remote service. More... | |
| virtual | ~RemoteServiceHost () KZ_OVERRIDE |
| Destructor. More... | |
| virtual string | getIdentifier () const KZ_OVERRIDE |
| Retrieve interface identifier. More... | |
| virtual void | changeType (const string &type) KZ_OVERRIDE |
| Changes the interface name at runtime. More... | |
| virtual void | initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) KZ_OVERRIDE |
| Initialize the service. More... | |
| virtual void | uninitialize () KZ_OVERRIDE |
| cleanup the service. More... | |
| virtual AbstractSessionSharedPtr | acquireSession (ConnectedClientSharedPtr client, int sessionId) KZ_OVERRIDE |
| Creates a session to this service. More... | |
| virtual void | releaseSession (int clientId, int sessionId) KZ_OVERRIDE |
| Releases a session. More... | |
| virtual void | work (ConnectWorkItemSharedPtr workItem) KZ_OVERRIDE |
| Routine that get(s) called periodically or especially when object itself has requested it to be called using the work queue. More... | |
| virtual void | receiveMessage (ConnectedClientSharedPtr client, const MessagePackage &message) KZ_OVERRIDE |
| Invoked for each message this service should handle. More... | |
| virtual void | notifyClientDisconnected (int clientId) KZ_OVERRIDE |
| Invoked to inform that specific client has disconnected. More... | |
| virtual const AbstractService::ServiceDescription & | getDescription () KZ_OVERRIDE |
| Retrieve the service description from service host. More... | |
| virtual const AbstractService::ServiceState & | getState () KZ_OVERRIDE |
| Retrieve the service state information. More... | |
| virtual bool | local () const KZ_OVERRIDE |
| Is this service local or not. More... | |
| virtual shared_ptr< ServiceServiceConcept::Session > | getServiceSession () const KZ_OVERRIDE |
| Returns a session to remote service. More... | |
| virtual int | clientID () const KZ_OVERRIDE |
| Returns the client identifier. More... | |
| virtual AbstractServiceSharedPtr | getService () const KZ_OVERRIDE |
| Returns a service instance. More... | |
| virtual int | countSessions () const KZ_OVERRIDE |
| Returns amount of sessions towards this service. More... | |
| virtual ClientDescriptorSharedPtr | getClientDescriptor () KZ_OVERRIDE |
| Return the client descriptor. More... | |
| virtual void | setConfigurationProperties (RuntimeDataObjectSharedPtr properties) KZ_OVERRIDE |
| Stores service configuration properties. More... | |
| virtual RuntimeDataObjectSharedPtr | getConfigurationProperties () KZ_OVERRIDE |
| Retrieve service configuration properties. More... | |
| virtual void | setState (const AbstractService::ServiceState &state) KZ_OVERRIDE |
| Sets the service state. More... | |
| virtual string | getServiceRoutingInformationDescription (int serverclientid) KZ_OVERRIDE |
| Must be overridden by the corresponding implementation. More... | |
| virtual bool | reportServiceRuntimeData (const string &, const string &) KZ_OVERRIDE |
| Can be called, mainly for remote services, to inform about new service information that was received. More... | |
| virtual void | notifyAll (const MessagePackage &event) KZ_OVERRIDE |
| Internal API for scripting utilities makes assumptions on implementation details. More... | |
| virtual RuntimeDataObject * | getRuntimeData () KZ_OVERRIDE |
| Internal API for scripting utilities makes assumptions on implementation details. More... | |
Public Member Functions inherited from kanzi::connect::ServiceHost | |
| virtual void | ensureDomain (ConnectDomain *domain) |
| Ensure that service instance (if local) has domain set. More... | |
| virtual const string | getServiceDescriptionSchema (bool details=false) |
| Retrieve service description schema. More... | |
| virtual bool | registerServiceRuntimeData (const string schema="") |
| Invoked to register service runtime data. More... | |
| virtual bool | registerServiceRuntimeDataSchemaChange (const string &xml) |
| Invoked to change runtime data schema at runtime. More... | |
| ServiceHost (ServiceRuntimeDataRegistrySharedPtr registry=ServiceRuntimeDataRegistrySharedPtr()) | |
| C++ constructor. More... | |
| virtual void | setConfigurationPropertyChangedCallback (ConfigurationPropertyChangedCallback callback) |
| Install a callback to be invoked when configuration property changes. More... | |
| bool | subscribeForRuntimeDataSchemaChanges (GenericSyncObserver<> &observer) |
| Start getting notifications of runtime data schema changes. More... | |
| bool | unsubscribeForRuntimeDataSchemaChanges (GenericSyncObserver<> &observer) |
| Stop receiving notifications of runtime data schema changes. More... | |
| virtual | ~ServiceHost () |
| Destructor. More... | |
Protected Member Functions | |
| virtual void | getServiceDescriptionSchemaImpl (string &output) KZ_OVERRIDE |
| AbstractSessionSharedPtr | getSession (int clientId, int sessionId) |
Additional Inherited Members | |
Public Types inherited from kanzi::connect::ServiceHost | |
| typedef function< void(ServiceHost *, RuntimeDataObjectSharedPtr)> | ConfigurationPropertyChangedCallback |
| Callback prototype to invoke when service configuration properties change. More... | |
Protected Attributes inherited from kanzi::connect::ServiceHost | |
| ConfigurationPropertyChangedCallback | m_configurationPropertyChangedCallback |
| unique_ptr< RuntimeDataChildChangeMonitor > | m_configurationPropertyChangeMonitor |
| ServiceRuntimeDataRegistry::ContentRegistrationToken | m_runtimeDataRegistrationToken |
| ServiceRuntimeDataRegistrySharedPtr | m_runtimeDataRegistry |
| Runtime data registry for convenient access. More... | |
| GenericSyncPublisher | m_runtimeDataSchemaChangePublisher |
| Publisher to use when runtime data schema changes within the ServiceHost. More... | |
| AbstractService::RuntimeDataSchemaChangeSubscriptionToken | m_runtimeDataSchemaChangeSubscriptionToken |
A class that manages a service that is running remotely over the network.
| kanzi::connect::RemoteServiceHost::RemoteServiceHost | ( | const string & | type, |
| shared_ptr< ServiceServiceConcept::Session > | serviceSession, | ||
| ServiceRuntimeDataRegistrySharedPtr | registry = ServiceRuntimeDataRegistrySharedPtr() |
||
| ) |
Constructor.
| type | the service interface identifier |
| serviceSession | pointer to session. Ownership does not transfer. |
|
virtual |
Destructor.
|
virtual |
Creates a session to this service.
| client | identifies the client. |
| sessionId | identifies the session. |
Implements kanzi::connect::ServiceHost.
|
virtual |
Changes the interface name at runtime.
| type | new type for the interface. |
Implements kanzi::connect::ServiceHost.
|
virtual |
Returns the client identifier.
Relevant only for remote clients. Will return -1 for local clients.
Implements kanzi::connect::ServiceHost.
|
virtual |
Returns amount of sessions towards this service.
Implements kanzi::connect::ServiceHost.
|
virtual |
Return the client descriptor.
Relevant only for remote services.
Implements kanzi::connect::ServiceHost.
|
virtual |
Retrieve service configuration properties.
Implements kanzi::connect::ServiceHost.
|
virtual |
Retrieve the service description from service host.
Implements kanzi::connect::ServiceHost.
|
virtual |
Retrieve interface identifier.
Implements kanzi::connect::ServiceHost.
|
inlinevirtual |
Internal API for scripting utilities makes assumptions on implementation details.
Do not use.
Reimplemented from kanzi::connect::ServiceHost.
|
inlinevirtual |
Returns a service instance.
Relevant only for local services.
Implements kanzi::connect::ServiceHost.
|
protectedvirtual |
Implements kanzi::connect::ServiceHost.
|
virtual |
Must be overridden by the corresponding implementation.
Implements kanzi::connect::ServiceHost.
|
virtual |
Returns a session to remote service.
Relevant only for remote services.
Implements kanzi::connect::ServiceHost.
|
protected |
|
virtual |
Retrieve the service state information.
Implements kanzi::connect::ServiceHost.
|
virtual |
Initialize the service.
| domain | environment where the service is run in. |
| contentClient | access to content system |
| workQueue | interface to work queue used to dispatch work service is ready will eventually cause the services work() method to be invoked. |
Implements kanzi::connect::ServiceHost.
| void kanzi::connect::RemoteServiceHost::initializeFlowControl | ( | int | credits, |
| int | creditreturninterval | ||
| ) |
Initialize flow control object.
| credits | amount of credits initially |
| creditreturninterval | how often return credits to service. |
|
virtual |
Is this service local or not.
Implements kanzi::connect::ServiceHost.
|
inlinevirtual |
Internal API for scripting utilities makes assumptions on implementation details.
Do not use.
Reimplemented from kanzi::connect::ServiceHost.
|
virtual |
Invoked to inform that specific client has disconnected.
| clientId | Identifies the client. |
Implements kanzi::connect::ServiceHost.
|
virtual |
Invoked for each message this service should handle.
| client | identifies the message sender |
| message | the message to process. |
Implements kanzi::connect::ServiceHost.
| bool kanzi::connect::RemoteServiceHost::registerRoutingInformationSchema | ( | const string & | schema | ) |
Register routing information schema.
| routing | information schema to register. |
| bool kanzi::connect::RemoteServiceHost::registerServiceDescriptionSchema | ( | const string & | schema | ) |
Invoked to register service description xml.
| schema | the schema (xml) |
|
virtual |
Releases a session.
| clientId | identifies the client |
| sessionId | identifies the session |
Implements kanzi::connect::ServiceHost.
|
virtual |
Can be called, mainly for remote services, to inform about new service information that was received.
Reimplemented from kanzi::connect::ServiceHost.
| void kanzi::connect::RemoteServiceHost::setClientDescriptor | ( | ClientDescriptorSharedPtr | clientDescription | ) |
Sets a client descriptor.
| clientDescription | The information to set. |
|
virtual |
Stores service configuration properties.
Default implementation is empty, should be overridden by the remote service host implementation
| properties | data object describing the properties. |
Reimplemented from kanzi::connect::ServiceHost.
| void kanzi::connect::RemoteServiceHost::setDescription | ( | const AbstractService::ServiceDescription & | description | ) |
Set service description for a remote service.
| description | the description to set |
|
virtual |
Sets the service state.
Relevant only for remote clients.
| state | new state for remote clients. |
Implements kanzi::connect::ServiceHost.
|
virtual |
cleanup the service.
Implements kanzi::connect::ServiceHost.
|
virtual |
Routine that get(s) called periodically or especially when object itself has requested it to be called using the work queue.
| workItem | Item to be processed. |
Implements kanzi::connect::ServiceHost.