There are several ways to deploy a data service as follows:
- Upload a Data Service Using a Configuration File
- Generate Data Services Using a Carbon Data Source
- Create Data Services Using Various Data Sources
Upload a Data Service Using a Configuration File
If a user has manually created a sample data service file, it can be deployed to a running Carbon instance through the product's management console. It is also possible to deploy the data service by simply copying the .dbs file to location <PRODUCT_HOME>/repository/deployment/server/dataservices. Hot deployment is enabled by default.
For instructions on the structure and key elements of a sample data service file (.dbs), refer to section "Data Services and Resources."
Follow the instructions below to generate data services by deploying a sample .dbs file through the management console.
1. Log on to the product's management console and select "Data Services -> Upload" under the "Main" menu.
2. The "Upload Data Service" page appears. Select the database backup (.dbs) file and click "Upload."
3. If the file is uploaded successfully, a message appears.
4. You will be navigated to the "Deployed services" page. You should be able to see the data service under deployed services.
From here, you can . For instructions, refer to section "Service Management."
Generate Data Services Using a Carbon Data Source
The data services feature provides the "Generate" functionality in a product's management console in order to create data services automatically using a given database structure. When generating the service, its table structure is taken according to table structure specified in the data source. "SELECT", "INSERT", "UPDATE", and "DELETE" operations get automatically created.
First, you need to add a data source. For information on adding a data source, refer to section "Data Source Management." Once the Carbon data source is created, follow the instructions below to generate a data service using it.
1. Log on to the product's management console and select "Data Services -> Generate" under the "Main" menu.
2. The "Select Data Source" page appears. Select the Data Source created earlier and provide the database name.
3. Once the database is selected, the table structure will be displayed according to the given database. Select the preferred tables for the data service generation in the "Customize Service Generation" page and click "Next." For example,
4. Once tables are selected, a service generation mode needs to be specified. There are two options to generate the data service.
- As a single service where all operations for each table are given in a single data service.
- Multiple services for each table where, for a given table, only operations related to that table will be specified.
In the following example, we create a single service for all tables.
5. Once the service generation mode is selected, the data services will get deployed. View the deployed services and click finish.
Create Data Services Using Various Data Sources
A range of data sources can be service-enabled as follows: