RemoteServiceHost¶
-
class
kanzi::connect
::
RemoteServiceHost
: public ServiceHost¶ A class that manages a service that is running remotely over the network.
Unnamed Group
-
virtual string getIdentifier () const KZ_OVERRIDE
Retrieve interface identifier.
- Returns
interface ID this service handles.
-
virtual void changeType (const string &type) KZ_OVERRIDE
Changes the interface name at runtime.
- Parameters
type – new type for the interface.
-
virtual 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.
-
virtual void uninitialize () KZ_OVERRIDE
cleanup the service.
-
virtual AbstractSessionSharedPtr acquireSession (ConnectedClientSharedPtr client, int sessionId) KZ_OVERRIDE
Creates a session to this service.
- Parameters
client – identifies the client.
sessionId – identifies the session.
- Returns
session instance. ownership not transfered.
-
virtual void releaseSession (int clientId, int sessionId) KZ_OVERRIDE
Releases a session.
- Parameters
clientId – identifies the client
sessionId – identifies the session
-
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.
- Parameters
workItem – Item to be processed.
-
virtual 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.
-
virtual void notifyClientDisconnected (int clientId) KZ_OVERRIDE
Invoked to inform that specific client has disconnected.
- Parameters
clientId – Identifies the client.
-
virtual const AbstractService::ServiceDescription & getDescription () KZ_OVERRIDE
Retrieve the service description from service host.
- Returns
const reference to service description
-
virtual const AbstractService::ServiceState & getState () KZ_OVERRIDE
Retrieve the service state information.
- Returns
const reference to service state information.
-
virtual bool local () const KZ_OVERRIDE
Is this service local or not.
- Returns
true if service is local
-
virtual shared_ptr< ServiceServiceConcept::Session > getServiceSession () const KZ_OVERRIDE
Returns a session to remote service.
Relevant only for remote services.
- Returns
session
-
virtual int clientID () const KZ_OVERRIDE
Returns the client identifier.
Relevant only for remote clients. Will return -1 for local clients.
- Returns
client identifier.
-
inline virtual AbstractServiceSharedPtr getService () const KZ_OVERRIDE
Returns a service instance.
Relevant only for local services.
- Returns
service
-
virtual int countSessions () const KZ_OVERRIDE
Returns amount of sessions towards this service.
- Returns
amount of sessions
-
virtual ClientDescriptorSharedPtr getClientDescriptor () KZ_OVERRIDE
Return the client descriptor.
Relevant only for remote services.
- Returns
client descriptor
-
virtual void setConfigurationProperties (RuntimeDataObjectSharedPtr properties) KZ_OVERRIDE
Stores service configuration properties.
Default implementation is empty, should be overridden by the remote service host implementation
- Parameters
properties – data object describing the properties.
-
virtual RuntimeDataObjectSharedPtr getConfigurationProperties () KZ_OVERRIDE
Retrieve service configuration properties.
- Returns
properties as shared object.
-
virtual void setState (const AbstractService::ServiceState &state) KZ_OVERRIDE
Sets the service state.
Relevant only for remote clients.
- Parameters
state – new state for remote clients.
-
virtual string getServiceRoutingInformationDescription (int serverclientid) KZ_OVERRIDE
Must be overridden by the corresponding implementation.
- Returns
xml format routing information for the service.
-
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.
-
inline virtual void notifyAll (const MessagePackage &event) KZ_OVERRIDE
Internal API for scripting utilities makes assumptions on implementation details.
Do not use.
-
inline virtual RuntimeDataObject * getRuntimeData () KZ_OVERRIDE
Internal API for scripting utilities makes assumptions on implementation details.
Do not use.
Public Functions
Constructor.
- Parameters
type – the service interface identifier
serviceSession – pointer to session. Ownership does not transfer.
-
virtual ~RemoteServiceHost () KZ_OVERRIDE
Destructor.
-
void
initializeFlowControl
(int credits, int creditreturninterval)¶ Initialize flow control object.
- Parameters
credits – amount of credits initially
creditreturninterval – how often return credits to service.
-
bool
registerRoutingInformationSchema
(const string &schema)¶ Register routing information schema.
- Parameters
routing – information schema to register.
- Returns
true if registration succeeds.
-
bool
registerServiceDescriptionSchema
(const string &schema)¶ Invoked to register service description xml.
- Parameters
schema – the schema (xml)
- Returns
true if registration succeeded.
Sets a client descriptor.
- Parameters
clientDescription – The information to set.
-
void
setDescription
(const AbstractService::ServiceDescription &description)¶ Set service description for a remote service.
- Parameters
description – the description to set
-