Kanzi Connect  1.1.10
Kanzi Connect C++ API
kanzi::connect::ServiceRuntimeDataRegistry Class Reference

Encapsulates service runtime data. More...

#include <serviceruntimedataregisterer.hpp>

Inheritance diagram for kanzi::connect::ServiceRuntimeDataRegistry:
kanzi::connect::VirtualFileProvider

Public Types

typedef shared_ptr< void > ContentRegistrationToken
 
typedef shared_ptr< void > ContentSubscriptionToken
 
typedef function< void(const string &, const string &)> RuntimeContentUpdateCallback
 

Public Member Functions

RuntimeDataObjectSharedPtr getRootObjectForRegistration (ContentRegistrationToken token)
 Retrieves the root object associated with the specific content registration token. More...
 
RuntimeDataObjectSharedPtr getRootObjectForSubscription (ContentSubscriptionToken token)
 Retrieves the root object associated with the specific content listener token. More...
 
const string getSchemaForSubscription (ContentSubscriptionToken token)
 Retrieve XML format schema for content subscription. More...
 
void initializeHTTP ()
 Initializes HTTP Functionality. More...
 
ContentSubscriptionToken registerContentListener (const string &path, RuntimeContentUpdateCallback callback)
 Registers runtime content listener to a specific path. More...
 
ContentRegistrationToken registerContentProducer (const string &servicename, RuntimeDataObjectSharedPtr dataRoot, const string &schema)
 Registers a content producer, aka a service. More...
 
ContentRegistrationToken registerContentProducer (const string &servicename, const string &xml)
 Registers a content producer from XML schema definition. More...
 
bool renameContentProducer (const string &oldname, const string &newname)
 Renames a content producer. More...
 
 ServiceRuntimeDataRegistry (ConnectDomain *domain=nullptr, DiagnosticsManagerSharedPtr diagnostics=DiagnosticsManagerSharedPtr())
 C++ constructor. More...
 
void uninitializeHTTP ()
 Uninitialize HTTP Functionality. More...
 
void unregisterContentListener (ContentSubscriptionToken token)
 Unregisters content listener. More...
 
void unregisterContentProducer (ContentRegistrationToken handle)
 Unregister content producer. More...
 
bool updateData (ContentRegistrationToken handle, const string &stream, const string &path)
 Updates the data of a specific registration. More...
 
bool updateDataForPath (ContentRegistrationToken handle, const string &path)
 Updates the data of specific registration and especially a specified path within it. More...
 
ContentRegistrationToken updateSchema (ContentRegistrationToken token, RuntimeDataObjectSharedPtr dataRoot, const string &schema)
 Changes the runtime data schema. More...
 
ServiceRuntimeDataRegistry::ContentRegistrationToken updateSchema (ContentRegistrationToken token, const string &schema)
 Updates the schema at runtime. More...
 
- Public Member Functions inherited from kanzi::connect::VirtualFileProvider
virtual void cancelAllPendingRequests ()
 
virtual ~VirtualFileProvider ()
 Virtual destructor for cleanup. More...
 

Public Attributes

bool m_active
 True if data should be distributed. More...
 
DiagnosticsManagerSharedPtr m_diagnostics
 Diagnostics manager. More...
 
ConnectDomainm_domain
 The domain. More...
 
VirtualFileLocalClientSharedPtr m_HTTPClient
 HTTP Client for HTTP Communications. More...
 
VirtualFileClient::RegistrationToken m_HTTPSchemaToken
 HTTP Schema token. More...
 
VirtualFileClient::RegistrationToken m_HTTPToken
 HTTP registration token. More...
 

Protected Member Functions

virtual void provideFile (const string &path, VirtualFileResponseSharedPtr response) KZ_OVERRIDE
 Invoked when there is a requirement to provide a file. More...
 

Detailed Description

Encapsulates service runtime data.

Member Typedef Documentation

◆ ContentRegistrationToken

◆ ContentSubscriptionToken

◆ RuntimeContentUpdateCallback

typedef function<void(const string&, const string&)> kanzi::connect::ServiceRuntimeDataRegistry::RuntimeContentUpdateCallback

Constructor & Destructor Documentation

◆ ServiceRuntimeDataRegistry()

kanzi::connect::ServiceRuntimeDataRegistry::ServiceRuntimeDataRegistry ( ConnectDomain domain = nullptr,
DiagnosticsManagerSharedPtr  diagnostics = DiagnosticsManagerSharedPtr() 
)

C++ constructor.

Parameters
domainthe connect domain (optional)
diagnosticsdiagnostics functionality for traffic logging etc.

Member Function Documentation

◆ getRootObjectForRegistration()

RuntimeDataObjectSharedPtr kanzi::connect::ServiceRuntimeDataRegistry::getRootObjectForRegistration ( ContentRegistrationToken  token)

Retrieves the root object associated with the specific content registration token.

Parameters
tokenthe content registration token
Returns
shared pointer to root node. Should not ever be empty pointer.

◆ getRootObjectForSubscription()

RuntimeDataObjectSharedPtr kanzi::connect::ServiceRuntimeDataRegistry::getRootObjectForSubscription ( ContentSubscriptionToken  token)

Retrieves the root object associated with the specific content listener token.

Parameters
tokenthe token to query
Returns
shared pointer to root node. Can be empty pointer.

◆ getSchemaForSubscription()

const string kanzi::connect::ServiceRuntimeDataRegistry::getSchemaForSubscription ( ContentSubscriptionToken  token)

Retrieve XML format schema for content subscription.

Parameters
tokenidentifies the subscription
Returns
XML format schema. Or empty string if unable to retrieve.

◆ initializeHTTP()

void kanzi::connect::ServiceRuntimeDataRegistry::initializeHTTP ( )

Initializes HTTP Functionality.

Must be called after HTTP Functionality itself has been initialized.

◆ provideFile()

virtual void kanzi::connect::ServiceRuntimeDataRegistry::provideFile ( const string &  path,
VirtualFileResponseSharedPtr  response 
)
protectedvirtual

Invoked when there is a requirement to provide a file.

Parameters
pathrequested path.
responsethe response object that is to be completed within the callback. Object must not be stored by called entity.

Implements kanzi::connect::VirtualFileProvider.

◆ registerContentListener()

ContentSubscriptionToken kanzi::connect::ServiceRuntimeDataRegistry::registerContentListener ( const string &  path,
RuntimeContentUpdateCallback  callback 
)

Registers runtime content listener to a specific path.

Parameters
pathwhere to register.
Returns
handle that can later on be used to unregister content listener.

◆ registerContentProducer() [1/2]

ContentRegistrationToken kanzi::connect::ServiceRuntimeDataRegistry::registerContentProducer ( const string &  servicename,
RuntimeDataObjectSharedPtr  dataRoot,
const string &  schema 
)

Registers a content producer, aka a service.

Parameters
servicenameThe name of the service.
dataRootThe root object.
Returns
handle to object that can later on be used to.

◆ registerContentProducer() [2/2]

ContentRegistrationToken kanzi::connect::ServiceRuntimeDataRegistry::registerContentProducer ( const string &  servicename,
const string &  xml 
)

Registers a content producer from XML schema definition.

This is used with remote services.

Parameters
servicenamename of the service
xmlxml contents
Returns
handle to object that can later on be used to.

◆ renameContentProducer()

bool kanzi::connect::ServiceRuntimeDataRegistry::renameContentProducer ( const string &  oldname,
const string &  newname 
)

Renames a content producer.

Required for example by simulator when service models name is changed

Parameters
oldnamethe old name.
newnamethe new name.
Returns
true if succeeded, false otherwise.

◆ uninitializeHTTP()

void kanzi::connect::ServiceRuntimeDataRegistry::uninitializeHTTP ( )

Uninitialize HTTP Functionality.

◆ unregisterContentListener()

void kanzi::connect::ServiceRuntimeDataRegistry::unregisterContentListener ( ContentSubscriptionToken  token)

Unregisters content listener.

Parameters
tokenwhat to unregister.

◆ unregisterContentProducer()

void kanzi::connect::ServiceRuntimeDataRegistry::unregisterContentProducer ( ContentRegistrationToken  handle)

Unregister content producer.

Parameters
handlethe handle of operation

◆ updateData()

bool kanzi::connect::ServiceRuntimeDataRegistry::updateData ( ContentRegistrationToken  handle,
const string &  stream,
const string &  path 
)

Updates the data of a specific registration.

Parameters
handleidentifies the updated, earlier returned by registerContentProducer
streamthe serialized update content.
paththe path that was reported to be changed.
Returns
true if update took place.

◆ updateDataForPath()

bool kanzi::connect::ServiceRuntimeDataRegistry::updateDataForPath ( ContentRegistrationToken  handle,
const string &  path 
)

Updates the data of specific registration and especially a specified path within it.

Parameters
handleidentifies the updated, earlier returned by registerContentProducer
paththe path that changed.
Returns
true if update took place.

◆ updateSchema() [1/2]

ContentRegistrationToken kanzi::connect::ServiceRuntimeDataRegistry::updateSchema ( ContentRegistrationToken  token,
RuntimeDataObjectSharedPtr  dataRoot,
const string &  schema 
)

Changes the runtime data schema.

Parameters
tokenthe token that identifies the previously registered content producer
dataRootthe root object.
schemathe xml schema that defines the new structure.

◆ updateSchema() [2/2]

ServiceRuntimeDataRegistry::ContentRegistrationToken kanzi::connect::ServiceRuntimeDataRegistry::updateSchema ( ContentRegistrationToken  token,
const string &  schema 
)

Updates the schema at runtime.

Parameters
tokenidentifies the content registration
schemanew xml definition of the data
Returns
handle to new registration.

Member Data Documentation

◆ m_active

bool kanzi::connect::ServiceRuntimeDataRegistry::m_active

True if data should be distributed.

◆ m_diagnostics

DiagnosticsManagerSharedPtr kanzi::connect::ServiceRuntimeDataRegistry::m_diagnostics

Diagnostics manager.

◆ m_domain

ConnectDomain* kanzi::connect::ServiceRuntimeDataRegistry::m_domain

The domain.

◆ m_HTTPClient

VirtualFileLocalClientSharedPtr kanzi::connect::ServiceRuntimeDataRegistry::m_HTTPClient

HTTP Client for HTTP Communications.

◆ m_HTTPSchemaToken

VirtualFileClient::RegistrationToken kanzi::connect::ServiceRuntimeDataRegistry::m_HTTPSchemaToken

HTTP Schema token.

◆ m_HTTPToken

VirtualFileClient::RegistrationToken kanzi::connect::ServiceRuntimeDataRegistry::m_HTTPToken

HTTP registration token.


The documentation for this class was generated from the following file: