Configuring Data Management Services


The following configuration instructions assume you have installed the following software according to the setup instructions included in the Appendix, "Setup Instructions":

  • Flex Builder 2

  • Flex Data Services

  • ColdFusion

  • ColdFusion Extensions for Flex Builder 2

You will make changes to two files to configure Flex Data Services to work with the Data Management Service using ColdFusion as the back end.

Caution

You must be very careful when making changes to these files. One mistake or comment in the wrong place can cause Flex Data Services to not start.


Flex Data Services provides the exact code, or at least a template, for you to use during configuration. The files containing the configuration help are in the directory driveroot/fds2/resources/config. In this task, you will be copying data from files in this directory and pasting it into the actual configuration files in the folder driveroot/fds2/jrun4/servers/default/flex/WEB-INF/flex.

1.

Locate the driveroot/fds2/jrun4/servers/default/flex/WEB-INF/flex directory. Make copies of the following files:

  • services-config.xml

  • data-management-config.xml

By making copies of the two files you will be modifying in the next steps of this task, you have the originals to refer to if something should go wrong.

2.

Be sure that Flex Data Services is not running. Open the file services-config.xml located in driveroot/fds2/resources/config. Locate the two channel definitions from lines 137160 that are commented as ColdFusion specific RTMP channel and ColdFusion specific HTTP channel. Copy this block of code:

<!-- ColdFusion specific RTMP channel --> <channel-definition     >    <endpoint uri="rtmp://{server.name}:2048"       />    <properties>       <idle-timeout-minutes>20</idle-timeout-minutes>       <serialization>       <!-- This must be turned off for any CF channel -->          <instantiate-types>false</instantiate-types>       </serialization>    </properties> </channel-definition> <!-- ColdFusion specific HTTP channel --> <channel-definition     >    <endpoint uri="http://{server.name}:      {server.port}/{context.root}/messagebroker/cfamfpolling"      />    <properties>       <serialization>       <!-- This must be turned off for any CF channel -->          <instantiate-types>false</instantiate-types>       </serialization>       <polling-enabled>true</polling-enabled>       <polling-interval-seconds>8</polling-interval-seconds>    </properties> </channel-definition> 


This XML enables these message channels that will be used when configuring ColdFusion destinations.

3.

Open the file services-config.xml from the driveroot/fds2/jrun4/servers/default/flex/WEB-INF/flex directory. Locate the tag that ENDS the channels node of the XML, </channels>. Paste the copied block of code just ABOVE the closing </channels> tag.,

You have moved the channel configurations you need from the "helper" file to the actual configuration file.

4.

Open the file data-management-config.xml from the driveroot/fds2/jrun4/servers/default/flex/WEB-INF/flex directory. You will see an <adapters> node. Add the following as the last line of XML in the node:

<adapter-definition     /> 


This defines the adapter that will be used with ColdFusion.

5.

Be sure your adapters node appears as follows:

<adapters>    <adapter-definition        default="true"/>    <adapter-definition       />    <adapter-definition       /> </adapters> 


This enables the adapter that you will use with ColdFusion.

6.

Open the file data-management-config.xml from the directory driveroot/fds2/resources/config. Locate the destination definition from lines 288395 that is commented as ColdFusion Sample - Contact sample application. Copy this block of code. Be sure you get the entire destination definition marked by the <destination > and </destination> tags.

This defines a destination for a sample application, but not for what you need. After you paste the code into the correct location, you will modify the XML for the application you are building in this lesson.

7.

Open the data-management-config.xml file from the driveroot/fds2/jrun4/servers/default/flex/WEB-INF/flex directory (you added an adapter definition to this file in step 4). Paste the destination definition you just copied BELOW the closing </adapters> and ABOVE the closing </service> tag.g

You have moved a destination definition you need from the "helper" file to the actual configuration file. You will now edit the destination definition so it contains the information for the application you are building in this lesson.

8.

Change the comment at the top of the definition as shown:

<!-- ======================================== --> <!-- flex2tfs Lesson 21 application--> <!-- ======================================== --> 


The comment now reflects the use of the destination.

9.

Just below the comment, change the id of the destination so it is equal to flex2tfs:

<destination > 


When you create a DataService object in your MXML, you will use this id value.

10.

In the properties node, change the component value to flex2tfs.dmsCFCs.smallProductAssembler:

<component>flex2tfs.dmsCFCs.smallProductAssembler</component> 


The CFC indicated will be created automatically by a wizard and acts as the front end to code that will update the data store.

11.

Locate the metadata node, and change the property attribute's value to prodID.

<metadata>    <identity property="prodID"/> </metadata> 


This defines the primary key value of the database table.

12.

Save both the data-management-config.xml and services-config.xml files, and then close them.

These configuration files will be used when you start FDS.

13.

Start Flex Data Services by opening a console window (DOS prompt) and moving to the driveroot/fds2/jrun4/bin directory. Then enter jrun start default. Be sure FDS starts with no errors being shown. To stop the service, use the Ctrl+C key combination, or close the console window. To restart the service, if you are still in the console, just press the up arrow and it will bring back to the prompt what you previously typed.

You will need to leave the console window open when you are using FDS as FDS will only be running while the console window is open.

14.

Start the configured ColdFusion by opening another console window (DOS prompt) and moving to the driveroot/cfusion/bin directory. Then enter jrun start cfusion. Be sure ColdFusion starts with no errors being shown. To stop the service use the Ctrl+C key combination, or close the console window. To restart the service, if you are still in the console, just press the up arrow and it will bring back to the prompt what you previously typed.

You will need to leave the console window open when you are using ColdFusion.




Adobe Flex 2.Training from the Source
Adobe Flex 2: Training from the Source
ISBN: 032142316X
EAN: 2147483647
Year: 2006
Pages: 225

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net