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 override

Retrieve interface identifier.

Return

interface ID this service handles.

void changeType(const string &type) override

Changes the interface name at runtime.

Parameters
  • type: new type for the interface.

void initialize(InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) 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() override

cleanup the service.

AbstractSessionSharedPtr acquireSession(ConnectedClientSharedPtr client, int sessionId) 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) override

Releases a session.

Parameters
  • clientId: identifies the client

  • sessionId: identifies the session

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.

Parameters
  • workItem: Item to be processed.

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

Invoked for each message this service should handle.

Parameters
  • client: identifies the message sender

  • message: the message to process.

void notifyClientDisconnected(int clientId) override

Invoked to inform that specific client has disconnected.

Parameters
  • clientId: Identifies the client.

const AbstractService::ServiceDescription &getDescription() override

Retrieve the service description from service host.

Return

const reference to service description

const AbstractService::ServiceState &getState() override

Retrieve the service state information.

Return

const reference to service state information.

bool local() const override

Is this service local or not.

Return

true if service is local

int clientID() const 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) override

Sets the service state.

Relevant only for remote clients.

Parameters
  • state: new state for remote clients.

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

Returns a session to remote service.

Relevant only for remote services.

Return

session

AbstractServiceSharedPtr getService() const override

Returns a service instance.

Relevant only for local services.

Return

service

int countSessions() const override

Returns amount of sessions towards this service.

Return

amount of sessions

ClientDescriptorSharedPtr getClientDescriptor() override

Return the client descriptor.

Relevant only for remote services.

Return

client descriptor

RuntimeDataObjectSharedPtr getConfigurationProperties() override

Retrieve service configuration properties.

Return

properties as shared object.

string getServiceRoutingInformationDescription(int serverclientid) override

Must be overridden by the corresponding implementation.

Return

xml format routing information for the service.

void notifyAll(const MessagePackage &event) override

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

Notify all client sessions with message.

RuntimeDataObject *getRuntimeData() 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() override

Destructor.