Documente Academic
Documente Profesional
Documente Cultură
Objectives
After completing this lab, you should be able to:
• Start and stop the default server instance.
• Access the default samples suite.
• Run the default collaboration scenarios.
Steps
Starting the default samples server and database
1. Open a new command window.
2. Navigate to “c:\lcds\sampledb”.
3. Enter “startdb.bat”.
4. Open a new command window.
5. Navigate to “c:\lcds\tomcat\bin”.
6. Enter "catalina start”.
Page 1
Collaborative Applications with Flex and BlazeDS/LCDS
Objectives
After completing this lab, you should be able to:
• Add/modify messaging channels.
• Add/modify messaging destinations.
Steps
1. Open new explorer window.
2. Navigate to “c:\lcds\tomcat\webapps\lcds-samples\WEB-INF\flex”.
3. Open “services-config.xml” with a text editor (Notepad for instance).
<channel-definition id="my-longpolling-amf"
class="mx.messaging.channels.AMFChannel”>
<endpoint
url=http://{server.name}:{server.port}/{context.root}/messagebroker/amflo
ngpolling class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>5</polling-interval-seconds>
<wait-interval-millis>60000</wait-interval-millis>
<client-wait-interval-millis>1</client-wait-interval-millis>
<max-waiting-poll-requests>200</max-waiting-poll-requests>
</properties>
</channel-definition>
Page 2
Collaborative Applications with Flex and BlazeDS/LCDS
<destination id="gmaprooms">
<properties>
<server>
<allow-subtopics>true</allow-subtopics>
<subtopic-separator>.</subtopic-separator>
</server>
</properties>
<channels>
<channel ref="my-longpolling-amf"/>
<channel ref="my-polling-amf"/>
</channels>
</destination>
Page 3
Collaborative Applications with Flex and BlazeDS/LCDS
Objectives
After completing this lab, you should be able to:
• Create a Flex Builder project that is configured for use with BlazeDS/LCDS
• Use the Producer and Consumer classes within a Flex application
• Define event handlers to handle and display data received from the Message Service
• Construct a message and send it using the Message Service
Steps
1. Open Adobe Flex Builder 3
Page 4
Collaborative Applications with Flex and BlazeDS/LCDS
8. Define the handler for the message event in the script block:
http://localhost:8400/lcds-samples/gmaprooms-debug/gmaprooms.html
case (“zoom”):
map.setZoom(data.zoomLevel);
break;
case (“move”):
map.setCenter(new LatLng(data.latitide,data.longitude);
map.setZoom(data.zoomLevel);
break;
…
}
15. Save the “MapArea.mxml” file
16. Launch the application in two separate browser windows and test the map functionality you
have just implemented
Page 5
Collaborative Applications with Flex and BlazeDS/LCDS
Objectives
After completing this lab, you should be able to:
• Add/Modify a Data Management destination.
• Add and configure a DataService instance.
• Perform automatic data synchronization.
Steps
1. Open new explorer window.
2. Navigate to “c:\lcds\tomcat\webapps\lcds-samples\WEB-INF\flex”.
3. Open “data-management-config.xml” with a text editor (Notepad for instance).
<destination id="insync">
<adapter ref="java-dao" />
<properties>
<source>lcds.samples.contact.ContactAssembler</source>
<scope>application</scope>
<metadata>
<identity property="contactId" undefined-value="0"/>
</metadata>
</properties>
</destination
Page 6
Collaborative Applications with Flex and BlazeDS/LCDS
[Bindable]
private var ds:DataService;
ds = new DataService("insync");
ds.addEventListener(DataConflictEvent.CONFLICT, conflictHandler);
ds.addEventListener(DataServiceFaultEvent.FAULT, faultHandler);
ds.fill( contacts );
}
contact.firstName = firstName.text;
contact.lastName = lastName.text;
contact.title = contactTitle.text;
contact.email = email.text;
contact.phone = phone.text;
if (!contacts.contains(contact)) {
trace("Adding contact");
contacts.addItem(contact);
}
Page 7