Dr. Dobb's Journal - August 2008 - (Page 44) into instances of the Task.cfc component. Inside the Tasks.cfc file, a similar alias annotation states that an instance of a ColdFusion Task sent to Flex should be marshalled into an instance of an ActionScript 3.0 Task. With this aliasing in place, when Task instances are sent back-and-forth between ColdFusion and the Flex application, properties declared in both Tasks.as and Tasks.cfc are automatically populated, thanks to a technology known as “Flash Remoting.” Without this capability, you would need something like SOAP or XML/REST, and write code to parse XML. With a model in place, the server-side components need a persistence mechanism. In a production environment, this would probably involve a relational database. With ColdFusion’s flexibility and Java foundation, you have options for working with databases. You could hand-write SQL for persistence, use a native ColdFusion Object-Relational Mapping (ORM) framework such as Transfer, or employ a pure Java solution such as Hibernate. Task List maintains a memory-resident list of Task instances, simulating the presence of a database. To enable future expansion to a true database, this knowledge is hidden inside of a Data Access Object pattern implementation. The ColdFusion interface com.firemoss.tasks.persistence.ITaskDAO is used to define methods such as list() and save(). A MockTaskDAO component then implements these methods using the memory-resident application scope provided by ColdFusion. Obviously, use of such global variables is strongly discouraged for production applications. With a model and persistence mechanism implemented, the server must expose its functionality. All that’s required is a Remote Façade Pattern implementation that’s implemented as another ColdFusion component, TaskService.cfc, within /com/firemoss/tasks/ service. This provides two coarse-grained methods corresponding to the high-level use cases within the application: listTasks() and saveTask(). The listTasks() method is simple, using MockTaskDAO to read the tasks. The saveTasks() method, however, must also 44 Dr. Dobb’s Journal l www.ddj.com l August 2008 perform real-time pushing of updated tasks to all clients currently running the application. Thanks to ColdFusion event gateways, this requires just four lines of code (Listing Seven). A ColdFusion structure (HashTable) is created and populated with the configuredby-convention destination of “ColdFusionGateway.” A body consisting of the Task instance to push is also created and then dispatched to the appropriate event gateway instance with the sendGatewayMessage() function. When this code is executed, the Flex application’s Consumer tag receives the HashTable as a messaging object, invoking an appropriate event handler that modifies its collection of tasks. Your application is now ready to run. Simply click the green Run arrow in Flex Builder 3 and the application executes. If there’s an error in Task List, you can use the Eclipse-based ColdFusion Debugger (provided by ColdFusion 8) and the Flex Debugger (built into Flex Builder 3) to step through the code without ever leaving Eclipse. Creating a Deployable WAR When the application is debugged, you can create a deployable WAR of your application that compresses the application into a single file, much like a ZIP archive. To deploy a WAR to most Java application servers, the only installation step is to place the WAR file into the deployment directory. When Flex Builder 3 compiles a Flex application, it creates a debug build. For production purposes, it provides an Export Release Build wizard, which lets you create an optimized Flash SWF file. To complete the tasks.war file, the Export Release Build wizard is used to build the application into /tasks.war, which contains files such as {JBoss root}/server/default/deploy/tasks.war/ Tasks.html. To create a distributable WAR of both the client and server applications, ColdFusion provides a wizard that’s accessed through the ColdFusion administrator. The ColdFusion J2EE Archive wizard handles all of the building and configuration for you. Pointing it at the /tasks.war directory creates a single WAR file ready to be deployed to any http://www.leadtools.com/dobbs http://www.ddj.com
Table of Contents Feed for the Digital Edition of Dr. Dobb's Journal - August 2008 Dr. Dobb's Journal - August 2008 Contents Friday Night Fish Fry Alia Vox Developer Diaries Developer’s Notebook A Conversation with Christos Papadimitriou OpenGL and Mobile Devices: Round 2 Ellipse Specification Using Vectors Embed Custom GUIs in WPF Building RIAs on J2EE Foundations Disentangling Concepts in Object-Oriented Systems The Agile Edge Effective Concurrency Swaine’s Flames Dr. Dobb's Journal - August 2008 Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page Cover1) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page Cover2) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page 1) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page 2) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page 3) Dr. Dobb's Journal - August 2008 - Contents (Page 4) Dr. Dobb's Journal - August 2008 - Contents (Page 5) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 6) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 7) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 8) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 9) Dr. Dobb's Journal - August 2008 - Alia Vox (Page 10) Dr. Dobb's Journal - August 2008 - Alia Vox (Page 11) Dr. Dobb's Journal - August 2008 - Developer Diaries (Page 12) Dr. Dobb's Journal - August 2008 - Developer Diaries (Page 13) Dr. Dobb's Journal - August 2008 - Developer’s Notebook (Page 14) Dr. Dobb's Journal - August 2008 - Developer’s Notebook (Page 15) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 16) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 17) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 18) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 19) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 20) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 21) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 22) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 23) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 24) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 25) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 26) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 27) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 28) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 29) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 30) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 31) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 32) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 33) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 34) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 35) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 36) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 37) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 38) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 39) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 40) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 41) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 42) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 43) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 44) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 45) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 46) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 47) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 48) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 49) Dr. Dobb's Journal - August 2008 - The Agile Edge (Page 50) Dr. Dobb's Journal - August 2008 - The Agile Edge (Page 51) Dr. Dobb's Journal - August 2008 - The Agile Edge (Page 52) Dr. Dobb's Journal - August 2008 - Effective Concurrency (Page 53) Dr. Dobb's Journal - August 2008 - Effective Concurrency (Page 54) Dr. Dobb's Journal - August 2008 - Effective Concurrency (Page 55) Dr. Dobb's Journal - August 2008 - Swaine’s Flames (Page 56) Dr. Dobb's Journal - August 2008 - Swaine’s Flames (Page Cover3) Dr. Dobb's Journal - August 2008 - Swaine’s Flames (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.