Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes how The following sections describe how to use Developer Studio to create artifacts for Data Services Server. For more information on the Data Services Server. It contains the following sections:details of configuring data service artifacts, including namespaces, service groups, and data source types, see the Data Service Server documentation. For information on deploying the artifacts, see Packaging Artifacts Into Deployable Archives.

Table of Contents

Creating a

...

  1. New Data Service
  2. Import Data Service

...

If you select New Data Service option, and click Next, wizard page will ask you general information like Project Name, Data Service Name etc. Give necessary information and click Next.

...

In the next page, you need to specify information regarding the Data Source that you are going to use in your data service.

...

There are several defined data sources. Information below will be filled according to the Database Engine you have selected. Suppose I select MySQL as my Database Engine. As you can see, Driver Class and the format of JDBC URL will be filled for you. You have to specify User Name field and Password field.

...

data service

A data service provides a Web service interface to data that is stored in relational databases, CSV files, Microsoft Excel sheets, Google spreadsheets, and more. You can create a new data service or import an existing data service from a data service descriptor (DBS) file.  

Anchor
createds
createds

Creating a new data service

Follow these steps to create a new data service. Alternatively, you can import an existing data service.

  1. Open the Developer Studio Dashboard (choose Developer Studio -> Open Dashboard) and click Data Service Project in the Data Services Server category.
  2. Select Create New Data Service and click Next.
  3. Type unique names for the project and data service.
  4. Optionally, specify the service group, namespace, description, location, and working set for this data service.
  5. Click Next and specify a unique ID for the data source.
  6. Specify the type of data source you are creating, and then configure the properties that appear for that type.
    For details on configuring various data source types, see Create Data Services Using Various Data Sources in the Data Services Server documentation.
  7. A Maven POM file will be generated automatically for this project. If you want to

...

  1. customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next

...

  1. and specify the options.
  2. Click Finish.

...

  1. The

...

With this Graphical Editor, you can add different Data Sources, Queries, Operations etc in a very convenient manner.

...

If you are quite familiar with Data Services Descriptor language, you can navigate to source view and add components. Source view is fully functioned with content assist capability which will ease the pain of editing to great level.

With the Import Data Service option, you can browse for data service descriptor (dbs) file in your file system.

...

Now you will see a new Data Service Project has been created in the workspace and the data service descriptor (dbs) file open with graphical editor.

...

As you did for all the other projects, you can export the created Data Service Project in to a deployable artifact by right click on the project and select Export Project as Deployable Archive. With this it will create you a dbs file, which you can deploy in to any WSO2 Data Services Server. At the same time, you can group it with a Carbon Application Project and create the Carbon Application Archive [CAR] and deploy in to the Carbon Server.

Creating a Data Services Validator Project

To create a Data Services Validator Project, open WSO2 Developer Studio Dashboard and click Data Services Validator Project from the Data Services category.

There are two ways to create an Data Services Validator Project.

  1. Create New Data Service Validator Project
  2. Import Project From Workspace

...

Once you click Finish, you will see a new project has been created in the workspace and it has a data services class which is implementing org.wso2.carbon.dataservices.core.validation.Validator class.

...

In that class, you can implement your data services validator logic according to your requirement.

If you select Import Project From Workspace option, it will list all the projects which include source files that are being implemented by org.wso2.carbon.dataservices.core.validation.Validator.

...

  1. data service is created, and the data service is open in the editor. You can now right-click the data service in the outline and add queries, operations, additional data sources, and so on, or click the Source view to add components using XML.  
    Anchor
    importds
    importds

Importing a data service

Follow these steps to import an existing data service from a data service descriptor (DBS) file. Alternatively, you can create a new data service.

  1. Open the Developer Studio Dashboard (choose Developer Studio -> Open Dashboard) and click Data Service Project in the Data Services Server category.
  2. Select Import Data Service and click Next.
  3. Specify the data service descriptor (DBS) file by typing its full pathname or clicking Browse and navigating to the file.
  4. Optionally specify the location and working sets for this project. 
  5. A Maven POM file will be generated automatically for this project. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  6. Click Finish. The data service is created, and the data service is open in the editor. You can now right-click the data service in the outline and add queries, operations, additional data sources, and so on, or click the Source view to add components using XML.

Creating a custom validator

An input validator allows a data service to validate the input parameters in a request and stop the execution of the request if the input doesn’t meet the required criteria. In addition to the default validators provided by Data Service Server, you can create your own custom validators by creating a Java class that implements the org.wso2.carbon.dataservices.core.validation.Validator interface. You can create a new custom validator or import an existing validator project.  

Anchor
createval
createval

Creating a new custom validator

 

Follow these steps to create a new custom validator. Alternatively, you can import an existing validator project.

 

  1. Open the Developer Studio Dashboard (choose Developer Studio -> Open Dashboard) and click Data Services Validator Project in the Data Services Server category.
  2. Select Create New Data Services Validator Project and click Next.
  3. Type a unique name for the project and specify the package and class name for this validator.
  4. Optionally, specify the location and working set for this project.
  5. A Maven POM file will be generated automatically for this project. If you want to

...

  1. customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next

...

  1. and specify the options.
  2. Click Finish. The project

...

  1. is created, and the new validator class is open in the editor, where you can add your validation logic.  
    Anchor
    importval
    importval

 

Importing a validator project

 

Follow these steps to import an existing custom validator project. Alternatively, you can create a new custom validator.

 

  1. Open the Developer Studio Dashboard (choose Developer Studio -> Open Dashboard) and click Data Services Validator Project in the Data Services Server category.
  2. Select Import Project From Workspace and click Next.
  3. Select the existing validator project, and optionally specify the location and working sets for the new project. 
  4. A Maven POM file will be generated automatically for this project. If you want to customize the Maven options (such as including parent POM information in the file from another project in this workspace), click Next and specify the options.
  5. Click Finish. The project is imported, and the validator class is open in the editor, where you can modify the validation logic as needed.