User Guide
42 Using the Flex Data Service Assembler
The sample services-config.xml file is located in the C:\fds2\resources\config folder, and
the web application flex-messaging-service.xml file is located in the
C:\fds2\jrun4\servers\default\samples\WEB-INF\flex folder when you install Flex in the
default location.
2. (Optional) Turn on the ColdFusion-specific debugging output in the Flex console by
adding the following <pattern> tag in the <filters> tag in the <logging> section of the web
application services-config.xml file:
<pattern>DataService.coldfusion</pattern>
3.
Add the coldfusion-dao adapter to the web application data-management-config.xml (in
the C:\fds2\jrun4\servers\default\samples\WEB-INF\flex folder when you install Flex in
the default location) by adding the following in the <adapters> section:
<adapter-definition id="coldfusion-dao"
class="coldfusion.flex.CFDataServicesAdapter"/>
For more information, see “Configuring the Data Service” in Developing Flex Applications,
which is included in the Flex documentation.
Writing the ColdFusion CFCs
The Flex Data Management Service recognizes the methods: fill, get, sync, and count.
The
fill method retrieves records from a database and populates an array with the records.
The
get method retrieves a specific record. The sync method lets you keep track of
synchronization conflicts by accepting a change list, which is an array of change objects. The
count method returns a number that indicates how many records are in a result set. To
perform any of these database tasks, the Flex application calls the appropriate
fill, get,
sync, or count method in the assembler CFC. You can also use a fillContains method,
which checks whether to update the results of a fill. For more information, see “Managing
fills” on page 43.
When you create the ColdFusion CFC, you include the database manipulation in the
methods in the assembler CFC or use the Bean/DAO methodology. For more information,
see “Selecting a methodology” on page 43.
NOTE
The ColdFusion MX Administrator lets you enable or disable Flex Data Management
support. If you are running more than one instance of ColdFuison, you must use a unique
ID to specify each instance of ColdFusion for which you want to enable Flex Data
Management support. You do so by specifying the identity in the <identity> element of the
data-management-config.xml file.