LocalServiceHost

class kanzi::connect::LocalServiceHost : public ServiceHost

A class that manages a service that is running locally in Kanzi Connect Server.

Unnamed Group

string getIdentifier () const KZ_OVERRIDE

Retrieve interface identifier.

Return

interface ID this service handles.

void changeType (const string &type) KZ_OVERRIDE

Changes the interface name at runtime.

Parameters
  • type: new type for the interface.

void initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) KZ_OVERRIDE

Initialize the service.

Parameters
  • 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.

void uninitialize () KZ_OVERRIDE

cleanup the service.

AbstractSessionSharedPtr acquireSession (ConnectedClientSharedPtr client, int sessionId) KZ_OVERRIDE

Creates a session to this service.

Return

session instance. ownership not transfered.

Parameters
  • client: identifies the client.

  • sessionId: identifies the session.

void releaseSession (int clientId, int sessionId) KZ_OVERRIDE

Releases a session.

Parameters
  • clientId: identifies the client

  • sessionId: identifies the session

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.

Parameters
  • workItem: Item to be processed.

void receiveMessage (ConnectedClientSharedPtr client, const MessagePackage &message) KZ_OVERRIDE

Invoked for each message this service should handle.

Parameters
  • client: identifies the message sender

  • message: the message to process.

void notifyClientDisconnected (int clientId) KZ_OVERRIDE

Invoked to inform that specific client has disconnected.

Parameters
  • clientId: Identifies the client.

const AbstractService::ServiceDescription & getDescription () KZ_OVERRIDE

Retrieve the service description from service host.

Return

const reference to service description

const AbstractService::ServiceState & getState () KZ_OVERRIDE

Retrieve the service state information.

Return

const reference to service state information.

bool local () const KZ_OVERRIDE

Is this service local or not.

Return

true if service is local

int clientID () const KZ_OVERRIDE

Returns the client identifier.

Relevant only for remote clients. Will return -1 for local clients.

Return

client identifier.

void setState (const AbstractService::ServiceState &state) KZ_OVERRIDE

Sets the service state.

Relevant only for remote clients.

Parameters
  • state: new state for remote clients.

shared_ptr< ServiceServiceConcept::Session > getServiceSession () const KZ_OVERRIDE

Returns a session to remote service.

Relevant only for remote services.

Return

session

AbstractServiceSharedPtr getService () const KZ_OVERRIDE

Returns a service instance.

Relevant only for local services.

Return

service

int countSessions () const KZ_OVERRIDE

Returns amount of sessions towards this service.

Return

amount of sessions

ClientDescriptorSharedPtr getClientDescriptor () KZ_OVERRIDE

Return the client descriptor.

Relevant only for remote services.

Return

client descriptor

RuntimeDataObjectSharedPtr getConfigurationProperties () KZ_OVERRIDE

Retrieve service configuration properties.

Return

properties as shared object.

string getServiceRoutingInformationDescription (int serverclientid) KZ_OVERRIDE

Must be overridden by the corresponding implementation.

Return

xml format routing information for the service.

void notifyAll (const MessagePackage &event) KZ_OVERRIDE

Internal API for across service scripting, not for public use.

Notify all client sessions with message.

RuntimeDataObject * getRuntimeData () KZ_OVERRIDE

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.

Public Functions

LocalServiceHost(const persistence::SettingFactory *settingFactory, VirtualFileClient *fileClient, const string &type, AbstractServiceSharedPtr service, ServiceRuntimeDataRegistrySharedPtr registry = ServiceRuntimeDataRegistrySharedPtr())

Constructor.

~LocalServiceHost () KZ_OVERRIDE

Destructor.