Project Notes


Project: DataExpress: StreamableDataSets example
Author: JBuilder Team
Company: borland.com

Description: Example of a distributed DataExpress application using RMI and DataSetData

This example demonstrates the use of the DataExpress DataSetData class to build a distributed database application.
In addition to using DataSetData objects to pass database data between an RMI server and client, this sample also illustrates the use of a custom DataSet Provider and Resolver.

How to run this sample

What is going on

DataServerApp registers itself as an RMI server. It responds to two RMI client requests: provideEmployeeData() and resolveEmployeeChanges() defined in the RMI remote interface EmployeeApi.java.

ClientApp is simply a frame with a dbSwing JdbTable and JdbNavToolBar for displaying database data in a DataExpress TableDataSet. The DataSet uses a DataExpress "custom Provider", ClientProvider.java, to fill its table data by invoking DataServerApp's provideEmployeeData() remote method via RMI. DataServerApp subsequently queries data from a table on a JDBC database server into a QueryDataSet. It then extracts the data from the DataSet into a DataSetData object and sends it back to ClientProvider via RMI. ClientProvider then loads the data in the DataSetData object into ClientApp's DataSet, and the data appears in the table.

When it is time to resolve changes made in the table back to the database, the ClientApp DataSet's "custom Resolver", ClientResolver.java, extracts (only) the changes that need to be sent to the database server into a DataSetData object. ClientResolver then invokes DataServerApp's resolveEmployeeChanges() remote method via RMI, passing it the DataSetData object containing the necessary updates as the parameter.

DataServerApp then uses DataExpress to resolves the changes back to the database server. If an error occurs (due to a business rule or data constraint violation, for example) DataServerApp packages rows which could not be saved back to the database into a DataSetData object and returns it back to ClientResolver. ClientResolver then extracts the unresolvable rows in the DataSetData object into the ClientApp's table, allowing the problematic rows to be corrected and resolved back to the server again.

Note that DataServerApp is the "middle-tier" of the application. It can enforce its own business rules and constraints between the database server and the client. And of course, it could provide any number of additional remotely accessible methods for implementing business logic or application-specific tasks.

Metadata passed by DataSetData

The metadata passed in a DataSetData object is very limited.
Only the following Column properties are passed:

If there are other column properties, that a server should pass to client application, the server could pass an array of Column's via RMI. The Column object itself is serializable. A client application could be designed to get these column properties before it needed the data. The columns should be added as persistent columns before the DataSetData is loaded.

Deploying the application on 3-tiers

For more information