Content Providers provide a mechanism to query, filter and monitor changes in their encapsulated set of data. More...
#include <content_provider.hpp>
Classes | |
| class | Observer |
| Allows to monitor changes in Content Provider. More... | |
Public Member Functions | |
| void | addObserver (Observer *observer) |
| Adds new observer for this instance. More... | |
| void | addSubscription (ContentSubscriptionSharedPtr subscription) |
| Adds new subscription to this instance. More... | |
| ContentProvider (WorkQueueInterface *workQueue, AbstractServiceSharedPtr owningService) | |
| Constructor. More... | |
| ContentProvider (WorkQueueInterface *workQueue) | |
| Constructor. More... | |
| vector< ContentSubscriptionSharedPtr > | getAllSubscriptions () const |
| Retrieves all subscriptions for this provider. More... | |
| AbstractServiceSharedPtr | getOwningService () |
| Retrieves the service this content provider is bound to. More... | |
| AbstractSessionSharedPtr | getOwningSession () const |
| Retrieve the session that owns this content provider. More... | |
| const string & | getSchema () const |
| Retrieve the Schema. More... | |
| virtual size_t | getSubProviderCount ()=0 |
| Returns the amount of URI's held by the content provider. More... | |
| virtual ContentProviderDescriptionSharedPtr | getSubProviderDescription (size_t index)=0 |
| Retrieves the description of specific sub content provider. More... | |
| ContentSubscriptionSharedPtr | getSubscription (shared_ptr< ContentServiceConcept::Session > session) const |
| Retrieves content subscription for given session. More... | |
| const string & | getUri () const |
| Retrieve the URI. More... | |
| bool | hasSchema () const |
| Determines whether this particular content provider has schema defined. More... | |
| virtual void | initialize () |
| Called by the Content Service. Initializes this instance. More... | |
| void | invalidate (const string &uri, int reason, int beginRow=0, int endRow=-1) |
| Invalidates the content and causes subscribed clients to refresh their data completely. More... | |
| void | invalidateEx (const string &uri, int reason, int beginRow=0, int endRow=-1) |
| Invalidates the content and causes subscribed clients to refresh their data completely. More... | |
| void | notifyChangedEx (const string &uri=string()) |
| Informs that specific URI is changed. More... | |
| virtual void | query (ContentQueryArgumentsSharedPtr arguments, ContentQuerySharedPtr contentQuery)=0 |
| Performs asynchronous query to data, hosted by this instance. More... | |
| void | releaseAllSubscriptions () |
| Releases all subscriptions from this instance. More... | |
| void | removeObserver (Observer *observer) |
| Removes observer from this instance. More... | |
| void | removeSubscription (const ContentSubscription &subscription) |
| Removes subscription from this instance. More... | |
| void | setOwningService (AbstractServiceSharedPtr service) |
| Sets the owning service. More... | |
| void | setOwningSession (AbstractSessionSharedPtr session) |
| Store the owning session. More... | |
| void | setSchema (const string &schema) |
| Save the Schema (xml). More... | |
| void | setUri (const string &uri) |
| Save the URI. More... | |
| virtual void | uninitialize () |
| Called by the Content Service. Un-initializes this instance. More... | |
| virtual void | work () |
| Called by the Content Service. Allows this instance to perform work such as push data from external threads to content system or procedurally generate data. More... | |
| virtual | ~ContentProvider () |
| Destructor. More... | |
Protected Member Functions | |
| void | notifyChanged (const string &uri=string(), bool processAsync=false) |
| Allows derived classes to notify that there are changes in content. More... | |
| void | notifyWork () |
| Allows derived classes to notify that there is work to be done. More... | |
Content Providers provide a mechanism to query, filter and monitor changes in their encapsulated set of data.
| kanzi::connect::ContentProvider::ContentProvider | ( | WorkQueueInterface * | workQueue, |
| AbstractServiceSharedPtr | owningService | ||
| ) |
Constructor.
| workQueue | interface to system work queue. Allows the content provider to dispatch work items to event loop. |
| owningService | the owners service. pass AbstractServiceSharedPtr() in case this content provider is not directly bound to any specific service. |
| kanzi::connect::ContentProvider::ContentProvider | ( | WorkQueueInterface * | workQueue | ) |
Constructor.
| workQueue | interface to system work queue. Allows the content provider to dispatch work items to event loop. is not directly bound to any specific service. |
|
virtual |
Destructor.
| void kanzi::connect::ContentProvider::addObserver | ( | Observer * | observer | ) |
Adds new observer for this instance.
| observer | Observer to add. |
| void kanzi::connect::ContentProvider::addSubscription | ( | ContentSubscriptionSharedPtr | subscription | ) |
Adds new subscription to this instance.
| subscription | Subscription to add. |
| vector<ContentSubscriptionSharedPtr> kanzi::connect::ContentProvider::getAllSubscriptions | ( | ) | const |
Retrieves all subscriptions for this provider.
| AbstractServiceSharedPtr kanzi::connect::ContentProvider::getOwningService | ( | ) |
Retrieves the service this content provider is bound to.
| AbstractSessionSharedPtr kanzi::connect::ContentProvider::getOwningSession | ( | ) | const |
Retrieve the session that owns this content provider.
will return nullptr for server-local content providers.
| const string& kanzi::connect::ContentProvider::getSchema | ( | ) | const |
Retrieve the Schema.
Present only for remote services.
|
pure virtual |
Returns the amount of URI's held by the content provider.
Implemented in kanzi::connect::ContentProviderCollection.
|
pure virtual |
Retrieves the description of specific sub content provider.
| index | the position where from to retrieve. |
Implemented in kanzi::connect::ContentProviderCollection.
| ContentSubscriptionSharedPtr kanzi::connect::ContentProvider::getSubscription | ( | shared_ptr< ContentServiceConcept::Session > | session | ) | const |
Retrieves content subscription for given session.
| session | Session instance. |
| const string& kanzi::connect::ContentProvider::getUri | ( | ) | const |
Retrieve the URI.
|
inline |
Determines whether this particular content provider has schema defined.
|
inlinevirtual |
Called by the Content Service. Initializes this instance.
| void kanzi::connect::ContentProvider::invalidate | ( | const string & | uri, |
| int | reason, | ||
| int | beginRow = 0, |
||
| int | endRow = -1 |
||
| ) |
Invalidates the content and causes subscribed clients to refresh their data completely.
| uri | the uri that got invalidated. |
| reason | the reason code for change. Currently not used. |
| beginRow | inclusive start row. Currently not used. |
| endRow | inclusive end row. Currently not used. |
| void kanzi::connect::ContentProvider::invalidateEx | ( | const string & | uri, |
| int | reason, | ||
| int | beginRow = 0, |
||
| int | endRow = -1 |
||
| ) |
Invalidates the content and causes subscribed clients to refresh their data completely.
Used from external language bindings and is thread safe call.
| uri | the uri that got invalidated. |
| reason | the reason code for change. Currently not used. |
| beginRow | inclusive start row. Currently not used. |
| endRow | inclusive end row. Currently not used. |
|
protected |
Allows derived classes to notify that there are changes in content.
NOTE: Using this notification will not work if elements are removed from the provider. For removal scenario the invalidate(...) must be called instead.
| uri | Content uri that was changed. |
| processAsync | Boolean that tells whether changes can be propagated asynchronously saving potentially time on complex and chained providers. |
| void kanzi::connect::ContentProvider::notifyChangedEx | ( | const string & | uri = string() | ) |
Informs that specific URI is changed.
Used from external language bindings and is thread safe call. NOTE: Using this notification will not work if elements are removed from the provider. For removal scenario the invalidateEx(...) must be called instead.
| uri | defines the uri. optional. |
|
protected |
Allows derived classes to notify that there is work to be done.
|
pure virtual |
Performs asynchronous query to data, hosted by this instance.
Needs to be implemented by the derived class.
| arguments | the arguments used to query |
| contentQuery | Content query that will be notified when the data has been retrieved. |
Implemented in kanzi::connect::ContentProviderCollection.
| void kanzi::connect::ContentProvider::releaseAllSubscriptions | ( | ) |
Releases all subscriptions from this instance.
| void kanzi::connect::ContentProvider::removeObserver | ( | Observer * | observer | ) |
Removes observer from this instance.
| observer | Observer to remove. |
| void kanzi::connect::ContentProvider::removeSubscription | ( | const ContentSubscription & | subscription | ) |
Removes subscription from this instance.
| subscription | Content subscription to remove. |
| void kanzi::connect::ContentProvider::setOwningService | ( | AbstractServiceSharedPtr | service | ) |
Sets the owning service.
Only weak pointer to service is stored thus content provider does not affect on the owning service lifeline.
| service | the service to set. |
| void kanzi::connect::ContentProvider::setOwningSession | ( | AbstractSessionSharedPtr | session | ) |
Store the owning session.
| session | the session. ownership not transfered. |
| void kanzi::connect::ContentProvider::setSchema | ( | const string & | schema | ) |
Save the Schema (xml).
| schema |
| void kanzi::connect::ContentProvider::setUri | ( | const string & | uri | ) |
Save the URI.
| uri | the uri |
|
inlinevirtual |
Called by the Content Service. Un-initializes this instance.
|
virtual |
Called by the Content Service. Allows this instance to perform work such as push data from external threads to content system or procedurally generate data.