Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Custom datasources allows you to interface data services with any datasource type. You can create a custom data source as you create your data service: Follow the steps from 1 to 3 in creating a data service using various data sources. When you get to the Add New Data Source screen, select Custom Data Source as the data source type. The custom datasource specific options will appear as shown below. 


Custom tabular datasources

Used to represent data in tables, where a set of named tables contains data rows that can be queried later.

You can use the interface org.wso2.carbon.dataservices.core.custom.datasource.TabularDataBasedDS to implement tabular datasources. For a sample implementation of a tabular custom datasource, see InMemoryDataSource.

A tabular datasource is typically associated with an SQL data services query. This is done by internally using our own SQL parser to execute SQL against the custom datasource. For a sample data service descriptor on how this is done, see InMemoryDSSample. Also, this is supported in Carbon datasources with the datasource reader implementation org.wso2.carbon.dataservices.core.custom.datasource.CustomTabularDataSourceReader. Find a sample Carbon datasource configuration file at <PRODUCT_HOME>/repository/conf/datasources/custom-datasources.xml.

Custom query datasources

Used when the datasource has some form of a query expression support.

Custom query datasources are implemented using the interface org.wso2.carbon.dataservices.core.custom.datasource.CustomQueryBasedDS. You can create any non-tabular datasource using the query-based approach. Even if the target datasource does not have a query expression format, you can create your own. For example, you can support any NoSQL type datasource this way.

For a sample implementation of a query-based custom datasource, see EchoDataSource. For a sample data service descriptor with custom query datasources, see InMemoryDSSample. This is supported in Carbon datasources, with the datasource reader implementation org.wso2.carbon.dataservices.core.custom.datasource.CustomQueryDataSourceReader. You can find a sample of a Carbon datasource configuration in <PRODUCT_HOME>\repository\conf\datasources\custom-datasources.xml.

In the init methods of all custom datasources, user-supplied properties are parsed to initialize the datasource accordingly. Also, a property named __DATASOURCE_ID__, which contains a UUID to uniquely identify the current datasource, is passed. Custom datasource authors use this to identify the datasources accordingly. For example, scenarios like datasource instances communicating within a server cluster for data synchronization.

Find the custom connectors used in WSO2 DSS from the github project located at https://github.com/wso2/wso2-dss-connectors.

To write a query to this datasource, see Writing Data Service Queries.

  • No labels