
Build a distributed application with the Java adapter 237
View the assembler class
The contact destination uses the Java adapter. This is one of several types of Data
Management Service adapters that Flex Data Services provides. As previously noted, the
contact destination specifies an assembler class, which is a custom Java class that gets data
from a data resource and handles the synchronization of data among clients and the data
resource.
An assembler must have a zero-argument constructor. The assembler for this application is
instantiated in the application scope, which means that the entire web application has only
one instance of the class. The
scope element in the properties section of the destination
specifies that the assembler in the application scope.
The destination specifies the methods of the assembler class that are invoked to get data and
synchronize multiple versions of data. In addition to those methods, the assembler class also
implements methods for getting individual data items, and creating, updating, and deleting
data items; these methods are implementations of methods in the flex.data.ChangeObject
interface.
The following example shows the source code of the contact application’s assembler class. This
class delegates the actual calls to a SQL database, to a data access object (DAO) called
ContactDAO. The source code for the ContactAssembler class and the ContatcDAO class are
in the WEB_INF/src/samples/contact directory. The compiled classes are in the WEB_INF/
classes/samples/contact directory.
Commentaires sur ces manuels