Content Service

The Content Service acts as an abstract content database (for music, photos, contacts, and so on) in the Kanzi Connect network. It is a distributed content database system that makes it possible to expose both local (in server) and remote (in client) content to any Kanzi Connect network client. The Content Service allows all the connected clients to see all registered content as one, allowing them to be unaware of the origin and location of the underlying files or databases.

Content Manager

Content Manager implements the Content Interface and acts as a gateway to all content in the system. It allows clients to subscribe to content using a URI (content://domain/table) through a database-like interface. Once there is a subscription to a certain content URI, the subscriber keeps getting notifications about the changes in the database and always receives up-to-date data according to the subscription. Once the subscription is terminated, the Content Manager stops sending the updates to the subscriber. This behavior is available through the Content Loader class for any connected client.

Content providers

Content Manager utilizes content providers internally to retrieve the data according to the database query. The content providers are used to abstract both the origin and the storage of the content. Usually, the content and the content database is stored locally in the server, but it is also possible to register remote content providers to the system. Remote content providers can be used for example to share content (such as music or images in a phone) from a connected client in a transparent way.

../_images/content_service_overview.png

Content query

When subscribing to content, the subscriber performs a content query to Content Service. To filter and sort the results of content queries you can use options similar to those in SQL queries.

The Content Loader is usually used to perform the content subscription and it simplifies the communication with the Content Manager. The Content Loader automatically subscribes to content URI with the given projection, performs the initial query and provides the content result as a callback. Whenever there are changes in the server-side database, it automatically provides a new content result that reflects the new state of the content in the scope of the projection.

The content result of the content query consists of primitive data only, such as strings, integers and floating point values. The file-based binary content is referenced using the content URI and retrieved through HTTP. Therefore the Content Manager also hosts an HTTP file server, which you can use to share greater amounts of data, such as music and images. The clients can directly connect to the file server and access files stored on the server, for example to stream music or download images.

These are the steps of a content query:

  1. Subscriber performs content query to the Content Service.

    ../_images/content_query.png
  2. The Content Service retrieves data from content providers and combines a content result, which it sends back to the Subscriber.

    ../_images/content_result.png
  3. The Subscriber processes the content result and retrieves file-based content from the HTTP server.

    ../_images/file_based_content.png

Interface definition

The interface definition XML file for the Content Service is stored in the .. code-block:

<KanziConnectInstallation>/SDK/sources/connect/core_services/content_service/interface/content_interface.xml

Fully qualified name for the Content Service is Connect.CoreService.Content.

Supported platforms

This service is supported on all platforms that Kanzi Connect supports.