A class that manages a service that is running locally in Kanzi Connect Server. More...
#include <service_host.hpp>
Public Member Functions | |
LocalServiceHost (const persistence::SettingFactory *settingFactory, VirtualFileClient *fileClient, const string &type, AbstractServiceSharedPtr service, ServiceRuntimeDataRegistrySharedPtr registry=ServiceRuntimeDataRegistrySharedPtr()) | |
Constructor. | |
virtual | ~LocalServiceHost () override |
Destructor. | |
virtual string | getIdentifier () const override |
Retrieve interface identifier. | |
virtual void | changeType (const string &type) override |
Changes the interface name at runtime. | |
virtual void | initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) override |
Initialize the service. | |
virtual void | uninitialize () override |
cleanup the service. | |
virtual AbstractSessionSharedPtr | acquireSession (ConnectedClientSharedPtr client, int sessionId) override |
Creates a session to this service. | |
virtual void | releaseSession (int clientId, int sessionId) override |
Releases a session. | |
virtual void | work (ConnectWorkItemSharedPtr workItem) override |
Routine that get(s) called periodically or especially when object itself has requested it to be called using the work queue. | |
virtual void | receiveMessage (ConnectedClientSharedPtr client, const MessagePackage &message) override |
Invoked for each message this service should handle. | |
virtual void | notifyClientDisconnected (int clientId) override |
Invoked to inform that specific client has disconnected. | |
virtual const AbstractService::ServiceDescription & | getDescription () override |
Retrieve the service description from service host. | |
virtual const AbstractService::ServiceState & | getState () override |
Retrieve the service state information. | |
virtual bool | local () const override |
Is this service local or not. | |
virtual int | clientID () const override |
Returns the client identifier. | |
virtual void | setState (const AbstractService::ServiceState &state) override |
Sets the service state. | |
virtual shared_ptr< ServiceServiceConcept::Session > | getServiceSession () const override |
Returns a session to remote service. | |
virtual AbstractServiceSharedPtr | getService () const override |
Returns a service instance. | |
virtual int | countSessions () const override |
Returns amount of sessions towards this service. | |
virtual ClientDescriptorSharedPtr | getClientDescriptor () override |
Return the client descriptor. | |
virtual RuntimeDataObjectSharedPtr | getConfigurationProperties () override |
Retrieve service configuration properties. | |
virtual string | getServiceRoutingInformationDescription (int serverclientid) override |
Must be overridden by the corresponding implementation. | |
virtual void | notifyAll (const MessagePackage &event) override |
Internal API for across service scripting, not for public use. | |
virtual RuntimeDataObject * | getRuntimeData () override |
Internal API for across service scripting, not for public use. | |
![]() | |
virtual void | ensureDomain (ConnectDomainSharedPtr domain) |
Ensure that service instance (if local) has domain set. | |
virtual const string | getHash () |
virtual const string | getServiceDescriptionSchema (bool details=false) |
Retrieve service description schema. | |
virtual bool | registerServiceRuntimeData (const string schema="") |
Invoked to register service runtime data. | |
virtual bool | registerServiceRuntimeDataSchemaChange (const string &xml) |
Invoked to change runtime data schema at runtime. | |
virtual bool | reportServiceRuntimeData (const string &path, const string &stream) |
Can be called, mainly for remote services, to inform about new service information that was received. | |
ServiceHost (ServiceRuntimeDataRegistrySharedPtr registry=ServiceRuntimeDataRegistrySharedPtr()) | |
C++ constructor. | |
virtual void | setConfigurationProperties (RuntimeDataObjectSharedPtr properties) |
Stores service configuration properties. | |
virtual void | setConfigurationPropertyChangedCallback (ConfigurationPropertyChangedCallback callback) |
Install a callback to be invoked when configuration property changes. | |
virtual void | setHash (const string hash) |
bool | subscribeForRuntimeDataSchemaChanges (GenericSyncObserver<> &observer) |
Start getting notifications of runtime data schema changes. | |
bool | unsubscribeForRuntimeDataSchemaChanges (GenericSyncObserver<> &observer) |
Stop receiving notifications of runtime data schema changes. | |
virtual | ~ServiceHost () |
Destructor. | |
Protected Member Functions | |
virtual void | getServiceDescriptionSchemaImpl (string &output) override |
Additional Inherited Members | |
![]() | |
typedef function< void(ServiceHost *, RuntimeDataObjectSharedPtr) | ConfigurationPropertyChangedCallback) |
Callback prototype to invoke when service configuration properties change. | |
![]() | |
ConfigurationPropertyChangedCallback | m_configurationPropertyChangedCallback |
unique_ptr< RuntimeDataChildChangeMonitor > | m_configurationPropertyChangeMonitor |
ServiceRuntimeDataRegistry::ContentRegistrationToken | m_runtimeDataRegistrationToken |
ServiceRuntimeDataRegistrySharedPtr | m_runtimeDataRegistry |
Runtime data registry for convenient access. | |
GenericSyncPublisher | m_runtimeDataSchemaChangePublisher |
Publisher to use when runtime data schema changes within the ServiceHost. | |
AbstractService::RuntimeDataSchemaChangeSubscriptionToken | m_runtimeDataSchemaChangeSubscriptionToken |
A class that manages a service that is running locally in Kanzi Connect Server.
kanzi::connect::LocalServiceHost::LocalServiceHost | ( | const persistence::SettingFactory * | settingFactory, |
VirtualFileClient * | fileClient, | ||
const string & | type, | ||
AbstractServiceSharedPtr | service, | ||
ServiceRuntimeDataRegistrySharedPtr | registry = ServiceRuntimeDataRegistrySharedPtr() ) |
Constructor.
|
overridevirtual |
Destructor.
|
overridevirtual |
Creates a session to this service.
client | identifies the client. |
sessionId | identifies the session. |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Changes the interface name at runtime.
type | new type for the interface. |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Returns the client identifier.
Relevant only for remote clients. Will return -1 for local clients.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Returns amount of sessions towards this service.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Return the client descriptor.
Relevant only for remote services.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Retrieve service configuration properties.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Retrieve the service description from service host.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Retrieve interface identifier.
Implements kanzi::connect::ServiceHost.
|
inlineoverridevirtual |
Internal API for across service scripting, not for public use.
Request a pointer to service host runtime data. Returned data (if any) may be a mirror to a service registry so modifying values here may not be visible for the hosted service itself.
Reimplemented from kanzi::connect::ServiceHost.
|
overridevirtual |
Returns a service instance.
Relevant only for local services.
Implements kanzi::connect::ServiceHost.
|
overrideprotectedvirtual |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Must be overridden by the corresponding implementation.
Implements kanzi::connect::ServiceHost.
|
inlineoverridevirtual |
Returns a session to remote service.
Relevant only for remote services.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Retrieve the service state information.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
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.
|
overridevirtual |
Is this service local or not.
Implements kanzi::connect::ServiceHost.
|
inlineoverridevirtual |
Internal API for across service scripting, not for public use.
Notify all client sessions with message.
Reimplemented from kanzi::connect::ServiceHost.
|
overridevirtual |
Invoked to inform that specific client has disconnected.
clientId | Identifies the client. |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Invoked for each message this service should handle.
client | identifies the message sender |
message | the message to process. |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Releases a session.
clientId | identifies the client |
sessionId | identifies the session |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
Sets the service state.
Relevant only for remote clients.
state | new state for remote clients. |
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
cleanup the service.
Implements kanzi::connect::ServiceHost.
|
overridevirtual |
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.