Abstract base class for Kanzi Connect services. More...
#include <abstract_service.hpp>
Classes | |
class | ServiceDescription |
class | ServiceState |
Public Types | |
typedef map< string, EnumValues > | EnumMap |
typedef map< string, int > | EnumValues |
enum | InvokableOperationResult { Success = 0 , AlreadyExists = -1 , ValidationFailed = -2 , NotFound = -3 , NotReady = -4 } |
typedef function< void(AbstractService *) | RuntimeDataSchemaChangeCallback) |
Callback prototype to be invoked when runtime data schema changes. | |
typedef shared_ptr< void > | RuntimeDataSchemaChangeSubscriptionToken |
Handle given as return value to runtime data schema change callback registration. | |
enum | ServiceControlResult { ServiceControlSuccess , ServiceControlFailed , ServiceControlNotSupported } |
typedef enum kanzi::connect::AbstractService::ServiceControlResult | ServiceControlResult |
enum | ServiceControlSource { ServiceControlSourceManual , ServiceControlSourceLogic } |
typedef enum kanzi::connect::AbstractService::ServiceControlSource | ServiceControlSource |
typedef vector< AbstractSessionSharedPtr > | SessionContainer |
Container type for all connected sessions. | |
typedef function< void(AbstractService *) | StateCallbackFunction) |
Function prototype to be invoked when state changes. | |
typedef shared_ptr< void > | StateChangedSubscriptionToken |
Handle given as return value to state callback registration. | |
Public Member Functions | |
AbstractService () | |
Constructor. | |
AbstractSessionSharedPtr | acquireSession (int clientId, int sessionId, MessageDispatcher *dispatcher, const string &instanceName) |
Session factorization method. | |
virtual InvokableOperationResult | addCustomType (const string &xml) |
Add a custom type to the service. | |
virtual InvokableOperationResult | addCustomTypeDecoded (const string &decodedXml) |
Add a custom type to the service. | |
virtual int | addEvent (const string &identifier, const string &description) |
virtual int | addMethod (const string &identifier, const string &description) |
virtual int | addProperty (const string &identifier, const string &description) |
virtual InvokableOperationResult | addRoute (const string &xml) |
Add new P2P route(s) for the service. | |
virtual InvokableOperationResult | addRouteDecoded (const string &decodedXml) |
Add new P2P route(s) for the service. | |
RuntimeDataSchemaChangeSubscriptionToken | addRuntimeDataSchemaChangeSubscription (RuntimeDataSchemaChangeCallback function) |
Adds a callback to invoke when runtime data schema changes. | |
StateChangedSubscriptionToken | addStateChangeSubscription (StateCallbackFunction function) |
Adds a state change callback subscription. | |
bool | addSubscription (const string &identifier, AbstractSessionSharedPtr session) |
Add subscription to the given session for this service. | |
virtual void | cancelTimer (int64_t timerId) |
Cancels ongoing timer. | |
size_t | countSessions () |
Return the amount of sessions towards this service amount of sessions. | |
int | countSessions () const |
Amount of allocated sessions. | |
virtual InvokableOperationResult | createRuntimedata (const string &parentIdentifier, const string &xml) |
Create a new runtime data element for the service runtime data. | |
EnumMap::const_iterator | enumerationValuesBegin () |
EnumMap::const_iterator | enumerationValuesEnd () |
vector< AbstractSessionSharedPtr > | findSubscribers (const string &identifier) |
Find all subscribers for the given identifier. | |
const SessionContainer & | getAllSessions () const |
Returns all currently active sessions. | |
SessionContainer | getAllSessionsOfClient (int clientId) |
Returns all sessions for a given client. | |
string | getAttribute (const string &key) |
Gets value of a service attribute. | |
KanziStringVectorSharedPtr | getAttributes () |
Lists all service attributes. | |
RuntimeDataObjectSharedPtr | getConfigurationProperties () |
Retrieves configuration properties as a runtime data object to allow more convenient access to data. | |
ContentClientSharedPtr | getContentClient () const |
Access to content system. | |
virtual ContentProviderCollectionSharedPtr | getContentProvider () |
Returns content provider for this service. | |
const vector< unique_ptr< CustomType > > & | getCustomTypes () const |
Get the custom types defined for this service. | |
KanziStringVectorSharedPtr | getDisabledInvokables () |
ConnectDomainSharedPtr | getDomain () const |
Retrieves the connect domain. | |
optional< int > | getEnumValue (const string &name, const string &enumerator) |
Find out value for enumeration string. | |
ServiceExtensionContainer * | getExtensions () |
string | getExtensionsSchemas () |
string | getFullyQualifiedConfigurationPropertyName (const string &name) |
Constructs a fully qualified configuration property name, usually the fully qualified name is something like "Connect.Service.MyService.ConfigurationProperties.MyPropertyName". | |
virtual GenericInvoker * | getGenericInvoker () |
Retrieve a generic invoker bound to this service. | |
virtual string | getIdentifier () const =0 |
InterfaceDomainBase * | getInterfaceDomain () const |
Access to interface domain. | |
virtual RuntimeDataObjectSharedPtr | getModifiedConfigurationProperties () |
Retrieves modified configuration properties as runtime data object. | |
virtual string | getName () |
Returns the override name. | |
WorkQueueInterface * | getProxyWorkQueue () |
Returns a proxied work queue instance that can be used by composited classes to to assign work to this service. | |
AbstractSessionSharedPtr | getRunningSession () |
virtual string | getSchema () |
Returns service schema in XML format. | |
virtual const ServiceDescription & | getServiceDescription () const |
Access the static service description info. | |
virtual p2p::RoutingRulesSharedPtr | getServiceRoutingInformation () |
Return service routing information. | |
virtual const ServiceState & | getServiceState () const |
Gets service state information. | |
AbstractSessionSharedPtr | getSession (int clientId, int sessionId) |
Returns session by client & session id. | |
int | getStopInterval () const |
Retrieve service stop interval. | |
WorkQueueInterface * | getWorkQueue () const |
Access to signal that allows to invoke work(). | |
bool | hasEnumValues (const string &name) |
Checks if enum has been defined on this service. | |
bool | hasSubscriptions (const string &identifier) |
Check if the given identifier has any subscriptions. | |
virtual void | initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) |
Initialize this service. | |
bool | manualPersistenceOverride () const |
Defines whether manual persistence override is active, i.e. | |
virtual AbstractSessionSharedPtr | onAcquireSession (int clientId, int sessionId, MessageDispatcher *dispatcher, const string &instanceName)=0 |
Session factorization method interface. | |
virtual void | onReleaseSession (AbstractSessionSharedPtr session) |
Virtual method that inheriting classes can implement. | |
bool | processMessage (const MessagePackage &message, AbstractSessionSharedPtr session, shared_ptr< GenericRPCReplyMessage > &ret) |
Offer received message directly to service to implement a short path for scripts and built-in methods. Intended for internal use. | |
void | releaseAllSessions () |
Unconditionally releases all sessions. use carefully. | |
void | releaseSession (AbstractSessionSharedPtr session) |
Releases previously allocated session. | |
virtual InvokableOperationResult | removeCustomType (const string &typeName) |
Remove a custom type from a service. | |
virtual int | removeEvent (const string &identifier) |
virtual int | removeMethod (const string &identifier) |
virtual int | removeProperty (const string &identifier) |
virtual InvokableOperationResult | removeRoute (const string &subjectName) |
Remove a route from a service. | |
virtual InvokableOperationResult | removeRuntimedataElement (const string &elementIdentifier) |
Remove runtime data element from the service runtime data. | |
void | removeRuntimeDataSchemaChangeSubscription (RuntimeDataSchemaChangeSubscriptionToken token) |
Remove schema change subscription. | |
void | removeStateChangeSubscription (StateChangedSubscriptionToken token) |
Remove state change subscription. | |
vector< string > | removeSubscriptions (AbstractSessionSharedPtr session, const string &identifier="") |
Remove subscription to the given session for this service. | |
AbstractService::ServiceControlResult | resetService (ServiceArgumentsSharedPtr arguments) |
Tries to reset service. | |
ServiceRuntimeData & | runtimeData () |
Retrieve service runtime data. | |
void | setAttribute (const string &key, const string &value) |
Add service attributes as key value pairs. | |
void | setDomain (ConnectDomainSharedPtr domain) |
Set the connect domain. | |
void | setFileClient (VirtualFileClient *client) |
Set the client instance to access VirtualFileService. | |
virtual void | setName (const string &name) |
Defines a override name used to identify the service. | |
void | setPersistence (AbstractService::ServiceDescription::Persistence persistence) |
Sets the service persistence. | |
virtual void | setRunningSession (AbstractSessionSharedPtr session) |
Stores the currently running session. | |
virtual InvokableOperationResult | setRuntimedataValue (const string &elementIdentifier, const string &value) |
Set runtime data value for the given element in the service runtime data. | |
bool | setServiceRuntimeDataSchema (const string &xml) |
Set service runtime data schema. | |
void | setServiceState (AbstractService::ServiceState state) |
sets service state information. | |
void | setServiceVersion (AbstractService::ServiceDescription::Version version, AbstractService::ServiceDescription::Version minCompatibleVersion=AbstractService::ServiceDescription::Version()) |
Configures the service version information. | |
void | setSettingFactory (const persistence::SettingFactory *factory) |
Set the setting factory instance to allow using persistence service. | |
void | setStopInterval (int seconds) |
Configures the stop interval. | |
virtual int64_t | setTimer (int64_t milliseconds, ConnectWorkItem::Executor callback) |
Installs a timer to be called after a specified timeout in milliseconds. | |
virtual int64_t | setTimer (int64_t milliseconds, ConnectWorkItem::Executor callback, ConnectWorkItem::ExecutionContext executionContext) |
Installs a timer to be called after a specified timeout in milliseconds. | |
bool | simulateEvent (const string &messageName, const MessagePackage &message) |
Post a message to all running sessions as event. Intended for internal use. | |
AbstractService::ServiceControlResult | startService (ServiceControlSource serviceControlSource, ServiceArgumentsSharedPtr arguments) |
Tries to start the service. | |
AbstractService::ServiceControlResult | stopService (ServiceControlSource serviceControlSource) |
Tries to stop the service. | |
virtual void | uninitialize () |
Uninitialize this service. | |
virtual void | work (ConnectWorkItemSharedPtr workItem) |
Asks service to perform work. | |
virtual | ~AbstractService () |
Destructor. | |
Protected Member Functions | |
void | addEnumValue (const string &name, const string &enumerator, int value) |
Store value for enumeration string. | |
VirtualFileClient * | getFileClient () const |
Get instance to access the VirtualFileService. | |
ScriptContextSharedPtr | getScriptContext () |
Get shared script context. | |
const persistence::SettingFactory * | getSettingFactory () const |
Get the setting factory instance. | |
void | notifyRuntimeSchemaChange () |
Notify all observers that service schema has changed. | |
virtual void | notifyWork () |
Allows the derived class to invoke work(). | |
virtual void | notifyWork (ConnectWorkItemSharedPtr workItem) |
Called notify that this service would have a work item to be processed later on. | |
virtual void | notifyWork (ConnectWorkItemSharedPtr workItem, const ConnectWorkItem::Executor executor) |
Called to notify this service has work to do and for that work use the attached executor. | |
void | notifyWork (const ConnectWorkItem::Executor executor) |
Call to notify that provided executor should be run the kanzi connect main thread context. | |
virtual AbstractService::ServiceControlResult | onResetServiceRequest (ServiceArgumentsSharedPtr arguments) |
Inherited classes should implements this method that is invoked when service is requested to reset itself. | |
virtual AbstractService::ServiceControlResult | onStartServiceRequest (ServiceArgumentsSharedPtr arguments) |
Inherited classes should implement this method that is invoked when service is to be started. | |
virtual AbstractService::ServiceControlResult | onStopServiceRequest () |
Inherited classes should implement this method that is invoked when service is to be stopped. | |
bool | prepareScriptContext () |
Prepare script plugin for use. | |
virtual string | provideServiceRoutingInformationOverride () |
Service should override this in order to provide a custom routing information structure. | |
virtual string | provideServiceRuntimeDataOverride () |
Service should override this in order to provide a runtime data structure. | |
void | registerEnumValue (AbstractServiceSharedPtr service, const string &name, const string &enumerator, int value) |
Store value for enumeration string for a service. | |
void | setConfigurationPropertyPrefix (const string &prefix) |
Configures the configuration property name prefix used to build fully qualified configuration property names. | |
bool | writeConfigurationPropertyInternal (const string &stream) |
Writes a configuration property value. | |
Abstract base class for Kanzi Connect services.
typedef map<string, EnumValues> kanzi::connect::AbstractService::EnumMap |
typedef map<string, int> kanzi::connect::AbstractService::EnumValues |
typedef function<void(AbstractService*) kanzi::connect::AbstractService::RuntimeDataSchemaChangeCallback) |
Callback prototype to be invoked when runtime data schema changes.
typedef shared_ptr<void> kanzi::connect::AbstractService::RuntimeDataSchemaChangeSubscriptionToken |
Handle given as return value to runtime data schema change callback registration.
typedef enum kanzi::connect::AbstractService::ServiceControlResult kanzi::connect::AbstractService::ServiceControlResult |
typedef enum kanzi::connect::AbstractService::ServiceControlSource kanzi::connect::AbstractService::ServiceControlSource |
Container type for all connected sessions.
typedef function<void(AbstractService*) kanzi::connect::AbstractService::StateCallbackFunction) |
Function prototype to be invoked when state changes.
typedef shared_ptr<void> kanzi::connect::AbstractService::StateChangedSubscriptionToken |
Handle given as return value to state callback registration.
kanzi::connect::AbstractService::AbstractService | ( | ) |
Constructor.
|
virtual |
Destructor.
AbstractSessionSharedPtr kanzi::connect::AbstractService::acquireSession | ( | int | clientId, |
int | sessionId, | ||
MessageDispatcher * | dispatcher, | ||
const string & | instanceName ) |
Session factorization method.
clientId | client identifier number |
sessionId | session identifier number |
dispatcher | message dispatching functionality for the session. |
instanceName | name for the service/session instance |
|
virtual |
Add a custom type to the service.
xml | Contains the xml definition for the custom type |
|
virtual |
Add a custom type to the service.
decodedXml | Contains the xml definition for the custom type in clear xml without base64 encoding |
|
protected |
Store value for enumeration string.
Overwrites existing value if one exists.
name | Name of the enum definition. |
enumerator | Enumerator string, identifies the value |
value | Value to be stored. |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Add new P2P route(s) for the service.
xml | Contains the xml definition for the route |
|
virtual |
Add new P2P route(s) for the service.
decodedXml | Contains the xml definition for the route |
RuntimeDataSchemaChangeSubscriptionToken kanzi::connect::AbstractService::addRuntimeDataSchemaChangeSubscription | ( | RuntimeDataSchemaChangeCallback | function | ) |
Adds a callback to invoke when runtime data schema changes.
function | function to be called on schema change. |
StateChangedSubscriptionToken kanzi::connect::AbstractService::addStateChangeSubscription | ( | StateCallbackFunction | function | ) |
Adds a state change callback subscription.
function | function to be called on state change |
bool kanzi::connect::AbstractService::addSubscription | ( | const string & | identifier, |
AbstractSessionSharedPtr | session ) |
Add subscription to the given session for this service.
identifier | Identifies the subscription, what this means is implementation specific |
session | The session to subscribe |
|
virtual |
Cancels ongoing timer.
timerId | identifier returned by the setTimer function. |
size_t kanzi::connect::AbstractService::countSessions | ( | ) |
Return the amount of sessions towards this service amount of sessions.
int kanzi::connect::AbstractService::countSessions | ( | ) | const |
Amount of allocated sessions.
|
virtual |
Create a new runtime data element for the service runtime data.
parentIdentifier | Specifies the parent under which create the element in the hierarchy |
xml | Contains the xml defining the element contents |
EnumMap::const_iterator kanzi::connect::AbstractService::enumerationValuesBegin | ( | ) |
EnumMap::const_iterator kanzi::connect::AbstractService::enumerationValuesEnd | ( | ) |
vector< AbstractSessionSharedPtr > kanzi::connect::AbstractService::findSubscribers | ( | const string & | identifier | ) |
Find all subscribers for the given identifier.
identifier | Identifies the subscriptions, what this means is implementation specific |
const SessionContainer & kanzi::connect::AbstractService::getAllSessions | ( | ) | const |
Returns all currently active sessions.
SessionContainer kanzi::connect::AbstractService::getAllSessionsOfClient | ( | int | clientId | ) |
Returns all sessions for a given client.
clientId | Id of the client. |
string kanzi::connect::AbstractService::getAttribute | ( | const string & | key | ) |
Gets value of a service attribute.
key | Name of the attribute |
KanziStringVectorSharedPtr kanzi::connect::AbstractService::getAttributes | ( | ) |
Lists all service attributes.
RuntimeDataObjectSharedPtr kanzi::connect::AbstractService::getConfigurationProperties | ( | ) |
Retrieves configuration properties as a runtime data object to allow more convenient access to data.
ContentClientSharedPtr kanzi::connect::AbstractService::getContentClient | ( | ) | const |
Access to content system.
|
virtual |
Returns content provider for this service.
Reimplemented in kanzi::connect::ExternalServiceAdapter.
const vector< unique_ptr< CustomType > > & kanzi::connect::AbstractService::getCustomTypes | ( | ) | const |
Get the custom types defined for this service.
KanziStringVectorSharedPtr kanzi::connect::AbstractService::getDisabledInvokables | ( | ) |
ConnectDomainSharedPtr kanzi::connect::AbstractService::getDomain | ( | ) | const |
Retrieves the connect domain.
optional< int > kanzi::connect::AbstractService::getEnumValue | ( | const string & | name, |
const string & | enumerator ) |
Find out value for enumeration string.
name | Name of the enum definition. Can be empty, first matching enumerator value is returned from all enums |
enumerator | Enumerator string, identifies the value |
ServiceExtensionContainer * kanzi::connect::AbstractService::getExtensions | ( | ) |
string kanzi::connect::AbstractService::getExtensionsSchemas | ( | ) |
|
protected |
Get instance to access the VirtualFileService.
string kanzi::connect::AbstractService::getFullyQualifiedConfigurationPropertyName | ( | const string & | name | ) |
Constructs a fully qualified configuration property name, usually the fully qualified name is something like "Connect.Service.MyService.ConfigurationProperties.MyPropertyName".
name | the name where the fully qualified name is to be composed |
|
virtual |
Retrieve a generic invoker bound to this service.
Lifetime of the object is the same as the service lifetime. Can be overridden by a class to rewrite functionality.
Reimplemented in kanzi::connect::ExternalServiceAdapter.
|
pure virtual |
Implemented in kanzi::connect::ExternalServiceAdapter.
InterfaceDomainBase * kanzi::connect::AbstractService::getInterfaceDomain | ( | ) | const |
Access to interface domain.
|
inlinevirtual |
Retrieves modified configuration properties as runtime data object.
Overriden by corresponding Concept class.
|
virtual |
Returns the override name.
WorkQueueInterface * kanzi::connect::AbstractService::getProxyWorkQueue | ( | ) |
Returns a proxied work queue instance that can be used by composited classes to to assign work to this service.
|
inline |
|
virtual |
Returns service schema in XML format.
|
protected |
Get shared script context.
|
virtual |
Access the static service description info.
|
inlinevirtual |
Return service routing information.
|
virtual |
Gets service state information.
AbstractSessionSharedPtr kanzi::connect::AbstractService::getSession | ( | int | clientId, |
int | sessionId ) |
Returns session by client & session id.
clientId | Id of the client. |
sessionId | Id of the session. |
|
protected |
Get the setting factory instance.
int kanzi::connect::AbstractService::getStopInterval | ( | ) | const |
Retrieve service stop interval.
WorkQueueInterface * kanzi::connect::AbstractService::getWorkQueue | ( | ) | const |
Access to signal that allows to invoke work().
bool kanzi::connect::AbstractService::hasEnumValues | ( | const string & | name | ) |
Checks if enum has been defined on this service.
name | Name of the enum definition. |
bool kanzi::connect::AbstractService::hasSubscriptions | ( | const string & | identifier | ) |
Check if the given identifier has any subscriptions.
identifier | The identifier to check, what this means is implementation specific |
|
virtual |
Initialize this service.
domain | Interface domain. |
contentClient | Content Client that can be used to expose runtime state of this service to clients. |
workQueue | Interface to system work queue used to dispatch work to services. |
bool kanzi::connect::AbstractService::manualPersistenceOverride | ( | ) | const |
Defines whether manual persistence override is active, i.e.
user has manually configured service to a state and thus automatic shutdown is not active.
|
protected |
Notify all observers that service schema has changed.
|
protectedvirtual |
Allows the derived class to invoke work().
|
protectedvirtual |
Called notify that this service would have a work item to be processed later on.
|
protectedvirtual |
Called to notify this service has work to do and for that work use the attached executor.
workItem | describes the work to be done |
executor | the executor for work item. |
|
protected |
Call to notify that provided executor should be run the kanzi connect main thread context.
executor | the executor to be executed in main thread context. |
|
pure virtual |
Session factorization method interface.
To be overrided by concrete services
clientId | client identifier number |
sessionId | session identifier number |
dispatcher | message dispatching functionality for the session. |
instanceName | name for the service/session instance |
Implemented in kanzi::connect::ExternalServiceAdapter.
|
virtual |
Virtual method that inheriting classes can implement.
Can be used to receive notifications when sessions are destroyed.
session | identifies the session to be released. ownership not transfered. |
Reimplemented in kanzi::connect::ExternalServiceAdapter.
|
protectedvirtual |
Inherited classes should implements this method that is invoked when service is requested to reset itself.
return status indicating whether reset was succeeded or not.
|
protectedvirtual |
Inherited classes should implement this method that is invoked when service is to be started.
arguments | possible arguments for the service. |
|
protectedvirtual |
Inherited classes should implement this method that is invoked when service is to be stopped.
|
protected |
Prepare script plugin for use.
bool kanzi::connect::AbstractService::processMessage | ( | const MessagePackage & | message, |
AbstractSessionSharedPtr | session, | ||
shared_ptr< GenericRPCReplyMessage > & | ret ) |
Offer received message directly to service to implement a short path for scripts and built-in methods. Intended for internal use.
|
protectedvirtual |
Service should override this in order to provide a custom routing information structure.
|
protectedvirtual |
Service should override this in order to provide a runtime data structure.
|
protected |
Store value for enumeration string for a service.
Overwrites existing value if one exists.
service | The service that the enum is stored |
name | Name of the enum definition. |
enumerator | Enumerator string, identifies the value |
value | Value to be stored. |
void kanzi::connect::AbstractService::releaseAllSessions | ( | ) |
Unconditionally releases all sessions. use carefully.
void kanzi::connect::AbstractService::releaseSession | ( | AbstractSessionSharedPtr | session | ) |
Releases previously allocated session.
session | the session to release. ownership not transfered. |
|
virtual |
Remove a custom type from a service.
typeName | The name of the type |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Remove a route from a service.
subjectName | The subject of the route (can be method name, event name or "runtimedata") |
|
virtual |
Remove runtime data element from the service runtime data.
elementIdentifier | Specifies which element to remove |
void kanzi::connect::AbstractService::removeRuntimeDataSchemaChangeSubscription | ( | RuntimeDataSchemaChangeSubscriptionToken | token | ) |
Remove schema change subscription.
token | to remove. |
void kanzi::connect::AbstractService::removeStateChangeSubscription | ( | StateChangedSubscriptionToken | token | ) |
Remove state change subscription.
token | to remove. |
vector< string > kanzi::connect::AbstractService::removeSubscriptions | ( | AbstractSessionSharedPtr | session, |
const string & | identifier = "" ) |
Remove subscription to the given session for this service.
session | The session whose subscriptions are to be removed |
identifier | The subscriptions to remove, if empty all subscriptions for the session are removed |
AbstractService::ServiceControlResult kanzi::connect::AbstractService::resetService | ( | ServiceArgumentsSharedPtr | arguments | ) |
Tries to reset service.
Return value indicates the status of execution.
arguments | optional arguments passed along with the control request. |
ServiceRuntimeData & kanzi::connect::AbstractService::runtimeData | ( | ) |
Retrieve service runtime data.
void kanzi::connect::AbstractService::setAttribute | ( | const string & | key, |
const string & | value ) |
Add service attributes as key value pairs.
These will be visible on service description, but don't affect runtime state
|
protected |
Configures the configuration property name prefix used to build fully qualified configuration property names.
prefix | the prefix to be stored. |
void kanzi::connect::AbstractService::setDomain | ( | ConnectDomainSharedPtr | domain | ) |
Set the connect domain.
domain | the domain |
void kanzi::connect::AbstractService::setFileClient | ( | VirtualFileClient * | client | ) |
Set the client instance to access VirtualFileService.
client | Pointer to the instance which is used to access the service |
|
virtual |
Defines a override name used to identify the service.
name | the name |
void kanzi::connect::AbstractService::setPersistence | ( | AbstractService::ServiceDescription::Persistence | persistence | ) |
Sets the service persistence.
persistence | the persistence type for the service. |
|
inlinevirtual |
Stores the currently running session.
Should not be called from 3rd party code - used only internally by the infrastructure.
|
virtual |
Set runtime data value for the given element in the service runtime data.
elementIdentifier | Identifies the element in the service runtime data |
value | The value to set in serialized format |
bool kanzi::connect::AbstractService::setServiceRuntimeDataSchema | ( | const string & | xml | ) |
Set service runtime data schema.
All previously configured runtime data specific settings are discarded. New schema is also delivered to client(s).
xml | XML format schema |
void kanzi::connect::AbstractService::setServiceState | ( | AbstractService::ServiceState | state | ) |
sets service state information.
state | the state |
void kanzi::connect::AbstractService::setServiceVersion | ( | AbstractService::ServiceDescription::Version | version, |
AbstractService::ServiceDescription::Version | minCompatibleVersion = AbstractService::ServiceDescription::Version() ) |
Configures the service version information.
This should be called in constructor.
version | the main version of the service |
minCompatibleVersion | minimum compatible version. |
void kanzi::connect::AbstractService::setSettingFactory | ( | const persistence::SettingFactory * | factory | ) |
Set the setting factory instance to allow using persistence service.
factory | Pointer to the instance which is used to instantiate setting objects |
void kanzi::connect::AbstractService::setStopInterval | ( | int | seconds | ) |
Configures the stop interval.
seconds | the value to set. Negative values are rounded to 0. |
|
virtual |
Installs a timer to be called after a specified timeout in milliseconds.
milliseconds | timeout in milliseconds |
callback | function to be called when timer expires. |
|
virtual |
Installs a timer to be called after a specified timeout in milliseconds.
milliseconds | timeout in milliseconds |
callback | function to be called when timer expires. |
executionContext | Defines in which thread the callback should be executed. |
bool kanzi::connect::AbstractService::simulateEvent | ( | const string & | messageName, |
const MessagePackage & | message ) |
Post a message to all running sessions as event. Intended for internal use.
AbstractService::ServiceControlResult kanzi::connect::AbstractService::startService | ( | ServiceControlSource | serviceControlSource, |
ServiceArgumentsSharedPtr | arguments ) |
Tries to start the service.
Return value indicates if operation fails
serviceControlSource | what caused the service control to be accomplished. |
arguments | the arguments to use when starting the service. Similar to command line arguments on shell - effectively a list of strings. |
AbstractService::ServiceControlResult kanzi::connect::AbstractService::stopService | ( | ServiceControlSource | serviceControlSource | ) |
Tries to stop the service.
Shall the stop fail or otherwise not supported then scenario must be indicated with return value
serviceControlSource | what caused the service control to be accomplished. |
|
virtual |
Uninitialize this service.
|
virtual |
Asks service to perform work.
|
protected |
Writes a configuration property value.
stream | serialized objects where-from to read the value |