6.4.3 Defining a Java Object Data Source
To define an object data source, first place all necessary files into a single directory (e.g., a directory named 'object'). The list of necessary files includes the following:
• Data Loader class
• Data Helper class, if any
• BeanInfo class, if any
• All the object classes
The parent directory of this 'object' directory must be included in the classpath.
The example below creates an object data source using a Data Helper and a Data Loader based on introspection. The required files can be found under the examples/docExamples/datasource/object directory.
1. Click the 'New' button in the Style Studio toolbar. This opens the 'New Asset' dialog box.
2. In the left panel, select 'Data Source'. In the right 'Types' panel, select 'Object', and click 'OK'. This opens the 'Object Data Source Wizard' dialog box.
3. Select the General tab. In the 'Name' field, enter a name for the data source name, for example: “JavaObject”.

4. Select the Data Helper tab. In the 'Data Helper Class' field, type in 'object.DataHelper'.

5. Select the Data Loader tab. In the 'Object Loader Class' field, type in 'object.Loader'.

6. Click 'Finish' to create the data source.
7. In the 'Data Source' panel, select the 'getEmployee' request. Select parameter0, and enter “John” in the 'Value' field. Click 'Apply'.

8. Select parameter1, and enter “5000” in the 'Value' field. Click 'Apply'.
9. Select parameter2. In the 'Value' field, pick any date and time. Click 'Apply'.
10. Select the Output tab. Type 'object.Employee' in the right-side text field and click 'Import'.

11. In the 'Data Source' panel, select the 'getEmployeeStruct' request.
12. Select the Output tab, enter 'object.Employee' in the right-side text field, and click 'Import Object Class'.
13. In the 'Data Source' panel, select the 'getEmployeeMillion' request.
14. Select the Output tab, enter 'object.Employee' in the right-side text field, and click 'Import'.
15. In the 'Data Source' panel, select the 'getCustomEmployee' request.
16. Select the Output tab, enter 'object.CustomEmployee' in the right-side text field, and click 'Import'.


17. Click the 'Save' button in the Style Studio toolbar to save the data source settings.
The next example creates an object data source using a custom data loader which implements the DataLoader interface. The required files can be found under the examples/docExamples/datasource/object directory.
1. Click the 'New' button in the Style Studio toolbar. This opens the 'New Asset' dialog box.
2. In the left panel, select 'Data Source'. In the right 'Types' panel, select 'Object', and click 'OK'. This opens the 'Object Data Source Wizard' dialog box.
3. Select the General tab. In the 'Name' field, enter the name for the data source name: “custom”.
If you have declared a class using the standard Java loader mechanism, you can select the class name from the 'Data Helper Class' and 'Object Loader Class' menus.
4. Select the Data Loader tab. In the 'Object Loader Class' field, type in (or select) 'object.CustomLoader',
5. (Optional) If the custom data loader defines JavaBean properties, press the 'Properties' button next to the 'Object Loader Class' field, and enter values for these properties.
6. Click 'Finish'.
7. In the 'Data Source' panel, select the 'employees' request. Click the Output tab.

Note that the output object classes are automatically imported for both of the requests.

8. Click the 'Save' button in the Style Studio toolbar to save the data source settings.
See Also
Querying a Java Object Data Source, for information on constructing a query.
| << 6.4.2 Leveraging JavaBean Properties | © 1996-2013 InetSoft Technology Corporation (v11.5) | 6.5 SAP Data Source >> |