A class that acts as a content service that is an interface for all database content on server. More...
#include <content_manager.hpp>
Public Types | |
typedef function< void(const string &uri, int reason, int startRow, int endRow) | ContentInvalidationCallback) |
typedef function< void(const string &uri, ContentDataSharedPtr data) | ContentResultCallback) |
Callback function for content result. | |
typedef function< ContentProvider *(WorkQueueInterface *workQueue) | CreationFunction) |
Creator function type for content providers. | |
typedef map< string, shared_ptr< ContentProvider > > | ProviderContainer |
typedef ProviderContainer::iterator | ProviderContainerIterator |
typedef function< void(const string &uri, RuntimeDataObjectSharedPtr data) | RuntimeDataContentResultCallback) |
Public Member Functions | |
void | addContentProvider (const string &uri, ContentProviderSharedPtr contentProvider) |
Adds existing content provider to system. | |
void | addPendingQuery (unsigned int queryId, shared_ptr< RemoteQuery > query) |
Registers remote query to the system. | |
ContentManager (ConnectDomainSharedPtr domain) | |
Constructor. | |
vector< ContentProviderSharedPtr > | getAllKnownContentProviders () |
Retrieves all known content providers. | |
virtual ContentProviderCollectionSharedPtr | getContentProvider () override |
Returns the content provider collection that contains all registered content on server. | |
shared_ptr< RemoteQuery > | getPendingQuery (unsigned int queryId) const |
Retrieves pending remote query by it's unique id. | |
WorkQueueInterface * | getProxyWorkQueue () |
Returns a proxied work queue instance that can be used by composited classes to to assign work to this service. | |
WorkQueueInterface * | getWorkQueue () const |
Access to signal that allows to invoke work(). | |
virtual void | initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) override |
See AbstractService::initialize. | |
void | instantiateRegisteredContentProviders () |
Instantiates all registered content providers that has not yet been created. | |
virtual void | invalidateContent (const string &uri, const ContentInvalidationInfo &data) override |
See ContentInterface::invalidateContent. | |
virtual void | notifyChanged (const string &uri) override |
See ContentInterface::notifyChanged. | |
template<class _T > | |
shared_ptr< _T > | registerAndCreateContentProvider (const string &domain, shared_ptr< ContentProviderCreator > creator) |
Same as registerContentProvider but also creates the provider immediately. | |
virtual void | registerContent (const string &uri, const string &schema) override |
See ContentInterface::registerContent. | |
void | registerContentProvider (const string &domain, shared_ptr< ContentProviderCreator > creator) |
Registers content provider to system. | |
void | removeContentProvider (ContentProviderSharedPtr contentProvider) |
Removes existing content provider from system. | |
void | removePendingQuery (unsigned int queryId) |
Unregisters remote query from the system. | |
virtual void | respond (const int &uid, const QueryResponseData &arg) override |
See ContentInterface::respond. | |
virtual void | returnCredits (const string &uri, const int &credits) override |
See ContentInterface::returnCredits. | |
virtual void | subscribe (const QueryArgumentData &arg) override |
See ContentInterface::subscribe. | |
virtual bool | subscribe (const QueryArgumentData &arg, ContentResultCallback callback, ContentInvalidationCallback invalidationCallback) |
Subscribe to content, allows to receive a callback when content subscription is updated. | |
virtual bool | subscribe (shared_ptr< ContentServiceConcept::Session > session, const QueryArgumentData &arg, ContentResultCallback callback, ContentInvalidationCallback invalidationCallback) |
virtual string | subscribeRuntimeData (const string &uri) override |
No description given. | |
virtual string | subscribeRuntimeData (const string &uri, RuntimeDataContentResultCallback callback) |
Subscribes to runtime data. | |
virtual string | subscribeRuntimeData (shared_ptr< ContentServiceConcept::Session > session, const string &uri, RuntimeDataContentResultCallback callback) |
Subscribes to runtime data. | |
virtual void | uninitialize () override |
See AbstractService::uninitialize. | |
virtual void | unregisterContent (const string &uri) override |
See ContentInterface::unregisterContent. | |
virtual void | unsubscribe (const string &uri) override |
See ContentInterface::unsubscribe. | |
virtual void | unsubscribe (shared_ptr< ContentServiceConcept::Session > session, const string &uri) |
void | useDiagnosticsManager (DiagnosticsManagerSharedPtr diagnostics) |
Give a diagnostics manager functionality for content manager to use. | |
virtual void | work (ConnectWorkItemSharedPtr work) override |
See AbstractService::work. | |
~ContentManager () | |
Destructor. | |
![]() | |
virtual | ~VirtualFileProvider () |
Virtual destructor for cleanup. | |
Protected Member Functions | |
shared_ptr< ContentProvider > | createContentProvider (const string &uri) |
Instantiates and initializes new content provider for given uri. | |
HTTPContentRequestSharedPtr | createContentRequest (const string &id) |
Creates a content request originating from HTTP. | |
void | destroyContentProvider (ContentProvider *provider) |
Uninitializes and destroys an existing content provider. | |
string | handleContentSchemaRequest (const string &id) |
Handles a content provider specific schema request. | |
void | initializeFilePathRegistrations () |
Initialize file provider functionality. | |
virtual void | onReleaseSession (AbstractSessionSharedPtr session) override |
See AbstractService::onReleaseSession. | |
void | uninitializeFilePathRegistrations () |
Uninitialize file provider functionality. | |
void | unregisterRemoteContents () |
Cleans up remote content providers away from the system when session is terminated for a client. | |
void | unregisterRemoteContents (shared_ptr< ContentServiceConcept::Session > session) |
A class that acts as a content service that is an interface for all database content on server.
Implements ContentInterface, which allows to subscribe / unsubscribe to content.
typedef function<void(const string& uri, int reason, int startRow, int endRow) kanzi::connect::ContentManager::ContentInvalidationCallback) |
typedef function<void(const string& uri, ContentDataSharedPtr data) kanzi::connect::ContentManager::ContentResultCallback) |
Callback function for content result.
typedef function<ContentProvider*(WorkQueueInterface* workQueue) kanzi::connect::ContentManager::CreationFunction) |
Creator function type for content providers.
typedef map<string, shared_ptr<ContentProvider> > kanzi::connect::ContentManager::ProviderContainer |
typedef ProviderContainer::iterator kanzi::connect::ContentManager::ProviderContainerIterator |
typedef function<void(const string& uri, RuntimeDataObjectSharedPtr data) kanzi::connect::ContentManager::RuntimeDataContentResultCallback) |
kanzi::connect::ContentManager::ContentManager | ( | ConnectDomainSharedPtr | domain | ) |
Constructor.
kanzi::connect::ContentManager::~ContentManager | ( | ) |
Destructor.
void kanzi::connect::ContentManager::addContentProvider | ( | const string & | uri, |
ContentProviderSharedPtr | contentProvider ) |
Adds existing content provider to system.
uri | URI that is covered by this content provider. |
contentProvider | Content provider instance to add to system. |
void kanzi::connect::ContentManager::addPendingQuery | ( | unsigned int | queryId, |
shared_ptr< RemoteQuery > | query ) |
Registers remote query to the system.
Allows to wait for remote content provider to respond.
queryId | Unique identifier for the query. |
query | Query to register. |
|
protected |
Instantiates and initializes new content provider for given uri.
uri | Domain uri of the content provider. |
|
protected |
Creates a content request originating from HTTP.
id | the uri containing first the service identifier, then possible table information and finally possible arguments for the query. Example com.rightware.content/songs?columns=id,name&limit=10 |
|
protected |
Uninitializes and destroys an existing content provider.
provider | Content provider to destroy. |
vector< ContentProviderSharedPtr > kanzi::connect::ContentManager::getAllKnownContentProviders | ( | ) |
Retrieves all known content providers.
|
overridevirtual |
Returns the content provider collection that contains all registered content on server.
shared_ptr< RemoteQuery > kanzi::connect::ContentManager::getPendingQuery | ( | unsigned int | queryId | ) | const |
Retrieves pending remote query by it's unique id.
queryId | Id of the query to retrieve. |
WorkQueueInterface * kanzi::connect::ContentManager::getProxyWorkQueue | ( | ) |
Returns a proxied work queue instance that can be used by composited classes to to assign work to this service.
WorkQueueInterface * kanzi::connect::ContentManager::getWorkQueue | ( | ) | const |
Access to signal that allows to invoke work().
|
protected |
Handles a content provider specific schema request.
id | the content provider identifier as uri. Example com.rightware.content/songs |
|
overridevirtual |
|
protected |
Initialize file provider functionality.
void kanzi::connect::ContentManager::instantiateRegisteredContentProviders | ( | ) |
Instantiates all registered content providers that has not yet been created.
|
overridevirtual |
See ContentInterface::invalidateContent.
|
overridevirtual |
See ContentInterface::notifyChanged.
|
overrideprotectedvirtual |
|
inline |
Same as registerContentProvider but also creates the provider immediately.
domain | Domain URI that is covered by this content provider. |
creator | Factory creator function that instantiates such content provider type. |
|
overridevirtual |
See ContentInterface::registerContent.
void kanzi::connect::ContentManager::registerContentProvider | ( | const string & | domain, |
shared_ptr< ContentProviderCreator > | creator ) |
Registers content provider to system.
domain | Domain URI that is covered by this content provider. |
creator | Factory creator function that instantiates such content provider type. |
void kanzi::connect::ContentManager::removeContentProvider | ( | ContentProviderSharedPtr | contentProvider | ) |
Removes existing content provider from system.
contentProvider | Content provider instance to remove. |
void kanzi::connect::ContentManager::removePendingQuery | ( | unsigned int | queryId | ) |
Unregisters remote query from the system.
Should be called when query is finished.
queryId | Unique identifier for the query. |
|
overridevirtual |
See ContentInterface::respond.
|
overridevirtual |
See ContentInterface::returnCredits.
|
overridevirtual |
See ContentInterface::subscribe.
|
virtual |
Subscribe to content, allows to receive a callback when content subscription is updated.
|
virtual |
|
overridevirtual |
No description given.
|
virtual |
Subscribes to runtime data.
uri | The URI at which to subscribe. |
callback | The callback to invoke on subscription. |
|
virtual |
Subscribes to runtime data.
session | session for runtime data |
uri | The URI at which to subscribe. |
callback | The callback to invoke on subscription. |
|
overridevirtual |
|
protected |
Uninitialize file provider functionality.
|
overridevirtual |
See ContentInterface::unregisterContent.
|
protected |
Cleans up remote content providers away from the system when session is terminated for a client.
session | Session that was terminated. |
|
protected |
|
overridevirtual |
See ContentInterface::unsubscribe.
|
virtual |
void kanzi::connect::ContentManager::useDiagnosticsManager | ( | DiagnosticsManagerSharedPtr | diagnostics | ) |
Give a diagnostics manager functionality for content manager to use.
|
overridevirtual |