Kanzi Connect  3.9.9
Kanzi Connect C++ API
kanzi::connect::ContentClient Class Referenceabstract

A class that abstracts server-side & client-side access to content manager. More...

#include <content_client.hpp>

Inheritance diagram for kanzi::connect::ContentClient:
kanzi::connect::AbstractServiceClient kanzi::connect::LocalContentClient kanzi::connect::RemoteContentClient

Classes

class  ContentClientObserver
 Polymorphic C++ observer interface for table based content subscriptions. More...
 
class  ContentClientRuntimeDataObserver
 Polymorphic C++ observer interface for runtime data subscriptions. More...
 

Public Types

typedef function< void(const string &uri, int reason, int startRow, int endRow)> ContentInvalidationFunction
 Callback function for content invalidation. More...
 
typedef shared_ptr< void > ContentToken
 A token that identifies the content session / consumer. More...
 
typedef function< void(const string &uri, ContentDataSharedPtr data)> ResultCallbackFunction
 Callback function for content result. More...
 
typedef function< void(const string &uri, RuntimeDataObjectSharedPtr data)> RuntimeDataResultCallbackFunction
 callback function for runtimedata content result. More...
 
- Public Types inherited from kanzi::connect::AbstractServiceClient
typedef function< void(void)> SessionRunningFunction
 
typedef shared_ptr< void > SessionRunningSubscriptionToken
 
typedef function< void(void)> SessionStoppedFunction
 

Public Member Functions

virtual ContentToken acquireContentToken ()=0
 Acquire content token and register as user of content service. More...
 
virtual bool addContentProvider (ContentToken token, const string &uri, ContentProviderSharedPtr contentProvider)=0
 Adds content provider to content system. More...
 
virtual string getIdentifier () const
 Returns the type of the service. More...
 
virtual bool getVerboseLog () const =0
 Return the current state of log verbosity. More...
 
virtual bool hasSession (ContentToken token)=0
 Determine whether specific content token has session currently available. More...
 
virtual void releaseContentToken (ContentToken token)=0
 Release content token and unregister from content service. More...
 
virtual void removeContentProvider (ContentToken token, ContentProviderSharedPtr contentProvider)=0
 Removes content provider from content system. More...
 
virtual void setVerboseLog (bool verbose)=0
 Configures verbose logging for the content client. More...
 
virtual bool subscribe (ContentToken token, ContentQueryArgumentsSharedPtr args, ResultCallbackFunction callback, ContentInvalidationFunction invalidationCallback)=0
 Subscribe to a table based content. More...
 
virtual bool subscribeEx (ContentToken token, ContentQueryArgumentsSharedPtr args, ContentClientObserver *observer)=0
 Subscribe to content. More...
 
virtual bool subscribeRuntimeData (ContentToken token, const string uri, RuntimeDataResultCallbackFunction callback, int credits, int creditreturninterval)=0
 Subscribes to a service runtime data. More...
 
virtual bool subscribeRuntimeDataEx (ContentToken token, const string uri, ContentClientRuntimeDataObserver *observer, int credits, int creditreturninterval)=0
 Subscribe to service runtime data. More...
 
virtual void unsubscribe (ContentToken token, const string &uri)=0
 Unsubscribe from content URI. More...
 
virtual void unsubscribeRuntimeData (ContentToken token, const string &URI)=0
 Unsubscribe from runtime data. More...
 
virtual void work ()
 See AbstractServiceClient::work() More...
 
virtual ~ContentClient ()
 Destructor. More...
 
- Public Member Functions inherited from kanzi::connect::AbstractServiceClient
 AbstractServiceClient ()
 Constructor. More...
 
AbstractSession::MessageSubscriptionToken addMessageSubscription (const string &messageType, AbstractSession::MessageReceivedFunction function)
 
SessionRunningSubscriptionToken addSessionRunningSubscription (SessionRunningFunction function)
 
SessionRunningSubscriptionToken addSessionStoppedSubscription (SessionStoppedFunction function)
 
optional< int > getActiveSessionIdentifier ()
 
optional< const AbstractSession::ServiceAttributesgetServiceAttributes ()
 
virtual void onSessionRunning ()
 
virtual void onSessionStopped ()
 
void removeMessageSubscription (const string &messageType, AbstractSession::MessageSubscriptionToken token)
 
void removeSessionRunningSubscription (SessionRunningSubscriptionToken token)
 
void removeSessionStoppedSubscription (SessionRunningSubscriptionToken token)
 
void setEnabledState (bool newEnabledState)
 Enable/disable the service by allowing or blocking traffic between client and server. More...
 
bool transmit (const MessagePackage &message)
 
virtual ~AbstractServiceClient ()
 Destructor. More...
 

Static Public Member Functions

static string Type ()
 Type accessors. More...
 

Protected Member Functions

 ContentClient ()
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::connect::AbstractServiceClient
virtual AbstractSessionSharedPtr getSession ()
 

Additional Inherited Members

- Protected Types inherited from kanzi::connect::AbstractServiceClient
enum  SessionState { INITIALIZED = 0, RUNNING = 1, STOPPED = 2 }
 
- Protected Attributes inherited from kanzi::connect::AbstractServiceClient
SessionState m_sessionState
 

Detailed Description

A class that abstracts server-side & client-side access to content manager.

This class makes it possible to acquire or release a token that can be used to subscribe to content in the content database. The content token can also be used to register content to the server-side content database. This abstraction makes it possible to write content providers and consumers that can operate both locally (server-side) and remotely (client-side).

See also
LocalContentClient and RemoteContentClient for server-side and client-side variants.

Member Typedef Documentation

◆ ContentInvalidationFunction

typedef function<void(const string& uri, int reason, int startRow, int endRow)> kanzi::connect::ContentClient::ContentInvalidationFunction

Callback function for content invalidation.

◆ ContentToken

A token that identifies the content session / consumer.

◆ ResultCallbackFunction

typedef function<void(const string& uri, ContentDataSharedPtr data)> kanzi::connect::ContentClient::ResultCallbackFunction

Callback function for content result.

◆ RuntimeDataResultCallbackFunction

callback function for runtimedata content result.

Constructor & Destructor Documentation

◆ ~ContentClient()

virtual kanzi::connect::ContentClient::~ContentClient ( )
virtual

Destructor.

◆ ContentClient()

kanzi::connect::ContentClient::ContentClient ( )
protected

Constructor.

Member Function Documentation

◆ acquireContentToken()

virtual ContentToken kanzi::connect::ContentClient::acquireContentToken ( )
pure virtual

Acquire content token and register as user of content service.

Returns
Content token that is used to identify the content session.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ addContentProvider()

virtual bool kanzi::connect::ContentClient::addContentProvider ( ContentToken  token,
const string &  uri,
ContentProviderSharedPtr  contentProvider 
)
pure virtual

Adds content provider to content system.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first.
uriContent URI that is handled by the content provider.
contentProviderContent provider to add.
Returns
true if succeeded, false on error.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ getIdentifier()

virtual string kanzi::connect::ContentClient::getIdentifier ( ) const
inlinevirtual

Returns the type of the service.

Returns
Identifier of the service, as a string.

Implements kanzi::connect::AbstractServiceClient.

◆ getVerboseLog()

virtual bool kanzi::connect::ContentClient::getVerboseLog ( ) const
pure virtual

Return the current state of log verbosity.

Returns
log verbosity.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ hasSession()

virtual bool kanzi::connect::ContentClient::hasSession ( ContentToken  token)
pure virtual

Determine whether specific content token has session currently available.

Parameters
tokencontent token
Returns
true if session exists

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ releaseContentToken()

virtual void kanzi::connect::ContentClient::releaseContentToken ( ContentToken  token)
pure virtual

Release content token and unregister from content service.

Parameters
tokenthe content token to release.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ removeContentProvider()

virtual void kanzi::connect::ContentClient::removeContentProvider ( ContentToken  token,
ContentProviderSharedPtr  contentProvider 
)
pure virtual

Removes content provider from content system.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first.
contentProviderContent provider to remove.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ setVerboseLog()

virtual void kanzi::connect::ContentClient::setVerboseLog ( bool  verbose)
pure virtual

Configures verbose logging for the content client.

Parameters
verbosewhether to be verbose or not.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ subscribe()

virtual bool kanzi::connect::ContentClient::subscribe ( ContentToken  token,
ContentQueryArgumentsSharedPtr  args,
ResultCallbackFunction  callback,
ContentInvalidationFunction  invalidationCallback 
)
pure virtual

Subscribe to a table based content.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first. When subscribing to table based content (content:// or service://) new token must be allocated for each content domain (E.g. com.rightware.content).
argsQuery Arguments.
callbackFunction callback for results.
invalidationCallbackfunction to invoke when content provider informs that certain part of the content has been invalidated.
Returns
true if subscription started, false if problems were met. Possible reasons for failure include for example trying to subscribe to same domain twice using same content token.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ subscribeEx()

virtual bool kanzi::connect::ContentClient::subscribeEx ( ContentToken  token,
ContentQueryArgumentsSharedPtr  args,
ContentClientObserver observer 
)
pure virtual

Subscribe to content.

Parameters
tokencontent content, identifies the user of content API.
argsQuery Arguments.
Returns
true if subscription started, false if there were no session available.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ subscribeRuntimeData()

virtual bool kanzi::connect::ContentClient::subscribeRuntimeData ( ContentToken  token,
const string  uri,
RuntimeDataResultCallbackFunction  callback,
int  credits,
int  creditreturninterval 
)
pure virtual

Subscribes to a service runtime data.

Parameters
tokenContent token, identifies the user of content API.
uriThe content URI where to subscribe. Usually something like service://cluster.
callbackFunction callback for results.
creditsamount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.
creditreturnintervalhow often functionality will return transfer credits to the content producer. Smaller the value more housekeeping traffic is produced.
Returns
true if subscription started, false if there were no session available.

Implemented in kanzi::connect::LocalContentClient, and kanzi::connect::RemoteContentClient.

◆ subscribeRuntimeDataEx()

virtual bool kanzi::connect::ContentClient::subscribeRuntimeDataEx ( ContentToken  token,
const string  uri,
ContentClientRuntimeDataObserver observer,
int  credits,
int  creditreturninterval 
)
pure virtual

Subscribe to service runtime data.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first.
observerObserver interface to be invoked when subscribed runtime data changes.
creditsamount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.
creditreturnintervalhow often functionality will return transfer credits to the content producer. Smaller the value more housekeeping traffic is produced.
Returns
true if subscription started, false if there were no session available or subscription for the specific uri is already available.

Implemented in kanzi::connect::LocalContentClient, and kanzi::connect::RemoteContentClient.

◆ Type()

static string kanzi::connect::ContentClient::Type ( )
inlinestatic

Type accessors.

◆ unsubscribe()

virtual void kanzi::connect::ContentClient::unsubscribe ( ContentToken  token,
const string &  uri 
)
pure virtual

Unsubscribe from content URI.

Parameters
tokenContent token.
uriContent URI to unsubscribe. Must be previously subscribed.

Implemented in kanzi::connect::RemoteContentClient, and kanzi::connect::LocalContentClient.

◆ unsubscribeRuntimeData()

virtual void kanzi::connect::ContentClient::unsubscribeRuntimeData ( ContentToken  token,
const string &  URI 
)
pure virtual

Unsubscribe from runtime data.

Parameters
tokenContent token to unsubscribe.
uriService URI where to unsubscribe from.

Implemented in kanzi::connect::LocalContentClient, and kanzi::connect::RemoteContentClient.

◆ work()

virtual void kanzi::connect::ContentClient::work ( )
inlinevirtual

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