Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::KanziConnectDataSource Class Reference

A class that implements data source that is able to load content from Kanzi Connect server. More...

#include <kanzi_connect_datasource.hpp>

Inheritance diagram for kanzi::connect::KanziConnectDataSource:
kanzi::connect::AbstractConnectDataSource kanzi::connect::ContentAdapterManager

Public Member Functions

 KZ_METACLASS_END ()
 
virtual ~KanziConnectDataSource () override
 
- Public Member Functions inherited from kanzi::connect::AbstractConnectDataSource
 KZ_METACLASS_END ()
 
void onDataObjectChanged (RuntimeDataObjectWeakPtr runtimeObject, const DataObjectSharedPtr dataObject)
 Handler for changes coming from the DataObjects under the data source data tree. More...
 
virtual void onPropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason) override
 
void start ()
 Starts operation. More...
 
void stop ()
 Stops operation. More...
 
virtual ~AbstractConnectDataSource () override
 Destructor. More...
 
virtual DataObjectSharedPtr getData () override
 
virtual void loadFromKZB (Domain *domain, KzbFile &kzbFile, ReadOnlyMemoryFile &file, KzbMemoryParser &parser) override
 
virtual void unloadOverride ()
 
- Public Member Functions inherited from kanzi::connect::ContentAdapterManager
void addAdapter (ContentAdapterSharedPtr adapter)
 Adds new adapter to list of adapters, but does not set up or start it. More...
 
 ContentAdapterManager (ContextSharedPtr context, DataSource *dataSource)
 Constructor. More...
 
 ContentAdapterManager (DataSource *dataSource)
 Constructor. More...
 
virtual ContentAdapterSharedPtr createAdapter (const string &serverName, const ContentAdapterConfigurationSharedPtr config, Domain *domain)
 Creates a standard adapter. More...
 
void destroyAllAdapters ()
 Stops and cleans up all adapters. More...
 
ContentAdapterSharedPtr findDynamicSource (const string &name)
 Locates a dynamic source with given name. More...
 
ContentAdapterSharedPtr findSource (const string &name)
 Locates a source with given name. More...
 
ContentAdapterManager::AdapterContainer getAdapters ()
 Retrieves all currently known adapters. More...
 
ContextSharedPtr getContext () const
 Returns gateway to Kanzi Connect server. More...
 
void initializeAllAdapters (DataObjectSharedPtr root)
 Initializes all adapters. More...
 
void removeAdapter (ContentAdapterSharedPtr adapter)
 Removes adapter from list of adapters. More...
 
void setContext (ContextSharedPtr context)
 Set gateway to Kanzi Connect server. More...
 
virtual ContentAdapterSharedPtr startAdapter (const string &serverName, DataObjectSharedPtr root, const ContentAdapterConfigurationSharedPtr config)
 Instantiates and starts new adapter according to given parameters. More...
 
void startAllAdapters ()
 Starts all adapters. More...
 
virtual void stopAdapter (ContentAdapterSharedPtr adapter)
 Stops an existing adapter. More...
 
void stopAllAdapters ()
 Stops all existing adapters. More...
 
virtual ~ContentAdapterManager ()=default
 dtor More...
 

Static Public Member Functions

static KanziConnectDataSourceSharedPtr create (Domain *domain, string_view name)
 Creates new instance of Kanzi Connect DataSource. More...
 
static void takeDataSnapshot (Domain *domain, const string &uri, string &schema, string &data)
 Takes data snapshot as XML document. More...
 

Static Public Attributes

static PropertyType< string > XmlDeclarationProperty
 
static PropertyType< string > XmlFilenameProperty
 Property that defines the file path for the configuration file. More...
 
- Static Public Attributes inherited from kanzi::connect::AbstractConnectDataSource
static PropertyType< string > ServerNameProperty
 
static PropertyType< bool > ServiceEnabledProperty
 
static PropertyType< string > ServiceIdentifierProperty
 

Protected Member Functions

 KanziConnectDataSource (Domain *domain, string_view name)
 
virtual void onCreateAdapters () override
 See AbstractConnectDataSource::onCreateAdapters. More...
 
void onFileModified (string_view filename)
 Callback for change in configuration file. More...
 
virtual void onReleaseAdapters () override
 See AbstractConnectDataSource::onReleaseAdapters. More...
 
- Protected Member Functions inherited from kanzi::connect::AbstractConnectDataSource
 AbstractConnectDataSource (kanzi::Domain *domain, kanzi::string_view name)
 
void onConnectionStateChanged (Connection::State state)
 Callback for connection state changes. More...
 
bool isConnected () const
 Check if this data source is connected to server. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::ContentAdapterManager
typedef vector< ContentAdapterSharedPtrAdapterContainer
 
- Protected Attributes inherited from kanzi::connect::ContentAdapterManager
DataSource * m_dataSource
 The instance which owns the data objects managed by content adapters. More...
 

Detailed Description

A class that implements data source that is able to load content from Kanzi Connect server.

The class can be configured with XML file, that describes the data tree and source tables and columns in the database.

See example of data.xml file below.

<root>
<source uri="service://com.rightware.service_name/content_path" name="data_object_name">
<field column="column_name" type="int" name="data_object_name"/>
</source>
<source uri="service://com.rightware.service_name" name="data_object_name">
<field column="column_name" type="int" name="data_object_name"/>
</source>
<source uri="content://com.rightware.content/contacts" name="contacts">
<field column="contact_id" type="int" name="id"/>
<field column="contact_firstname" type="string" name="firstname"/>
<field column="contact_lastname" type="string" name="lastname"/>
<field column="contact_phone" type="string" name="phone"/>
</source>
<source uri="service://com.rightware.media" name="media_state">
<field column="current_track_id" type="int" name="current_track"/>
</source>
</root>

Constructor & Destructor Documentation

◆ ~KanziConnectDataSource()

virtual kanzi::connect::KanziConnectDataSource::~KanziConnectDataSource ( )
overridevirtual

◆ KanziConnectDataSource()

kanzi::connect::KanziConnectDataSource::KanziConnectDataSource ( Domain *  domain,
string_view  name 
)
explicitprotected
Parameters
domainUI domain.
nameName of the new data source.

Member Function Documentation

◆ create()

static KanziConnectDataSourceSharedPtr kanzi::connect::KanziConnectDataSource::create ( Domain *  domain,
string_view  name 
)
static

Creates new instance of Kanzi Connect DataSource.

Parameters
domainUI domain.
nameName of the new data source.
Returns
New data source instance.

◆ KZ_METACLASS_END()

kanzi::connect::KanziConnectDataSource::KZ_METACLASS_END ( )

◆ onCreateAdapters()

virtual void kanzi::connect::KanziConnectDataSource::onCreateAdapters ( )
overrideprotectedvirtual

◆ onFileModified()

void kanzi::connect::KanziConnectDataSource::onFileModified ( string_view  filename)
protected

Callback for change in configuration file.

Parameters
filenameFile name of the configuration file.

◆ onReleaseAdapters()

virtual void kanzi::connect::KanziConnectDataSource::onReleaseAdapters ( )
overrideprotectedvirtual

◆ takeDataSnapshot()

static void kanzi::connect::KanziConnectDataSource::takeDataSnapshot ( Domain *  domain,
const string &  uri,
string &  schema,
string &  data 
)
static

Takes data snapshot as XML document.

Parameters
domainUI domain where to operate
urithe URI for the datasource object to snapshot. E.g. kzb://ivi/Data Sources/ConnectServices
schemaon return holds the data configuration file
dataon return holds a snapshot of current data.

Member Data Documentation

◆ XmlDeclarationProperty

PropertyType<string> kanzi::connect::KanziConnectDataSource::XmlDeclarationProperty
static

◆ XmlFilenameProperty

PropertyType<string> kanzi::connect::KanziConnectDataSource::XmlFilenameProperty
static

Property that defines the file path for the configuration file.


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