Introducing Flex Data Services (FDS)


FDS enables you to create real-time, data-driven applications that have been built with the Flex framework. FDS itself is a server-side Java application that is designed to work with most Java application servers, including JRun, JBoss, WebLogic, WebSphere, Oracle 10g, and Tomcat. There are four different parts to FDS, which include the following:

  • Flex Message Service (FMS)

  • Flex Data Management Service

  • Flex Proxy Service (FPS)

  • Remoting Service

Following is a diagram of the FDS basic architecture and an explanation of the functionality of the different elements:

The Flex Message Service (FMS) enables you to build applications that support real-time chat and collaboration. A client application in Flash Player uses a client-side API to send and receive messages from a server-side destination. Messages are sent via a special protocol. You can build applications that allow collaboration, such as Adobe Breeze, which enables the synchronization of desktops. Using the FMS, you also can push data out from the server. For example, using FMS, you could build an application that updates sports scores or stock data on the fly. The application data in Flash Player would update whenever the server-side data changed.

The Flex Data Management Service provides tools for managing distributed data in Flex applications. The service consists of both server- and client-side components. On the server side, there are adaptors for common data persistence frameworks. On the client side, there are components that automate synchronization of an application's client and server tiers. You can use the Data Management Service to create applications that might be occasionally connected, as well as performing data synchronization and replication. You can manage large sets of data by paging through that data. Using the Data Management Service, you can also manage nested data relationships such as one-to-one and one-to-many relationships.

For security reasons, a Flex application is not permitted to access data from another domain unless a cross-domain security file has been installed on that remote server. The Flex Proxy Service (FPS) is designed to overcome the sandbox security restrictions of Flash Player when you try to retrieve data or other assets at run time from remote servers. The Proxy Service relays HTTP and web service requests from the Flex application in Flash Player to the server that is hosting the remote service. The communication with the remote server now occurs from FDS instead of Flash Player. This means that when you use the server-side proxy, the security sandbox error will no longer appear.

Remoting Service is similar to web service, but communication between the application and the server is done in Action Message Format (AMF), which is a binary format that is faster than a textual protocol such as SOAP or XML. Java classes that are used as remote objects are hosted by an application server that is compatible with version 3 of the AMF protocol. FDS can host Plain old Java objects (POJOs) as well as ColdFusion 7 applications built with ColdFusion components.

You can install FDS on an integrated JRun server or as a J2EE web application. You should use the integrated JRun server only for testing because it is not designed for production environments. For production environments, you can select the J2EE web application option to create an installable .war file, which can then be deployed on a J2EE server.

FDS uses a directory structure that follows the standard model for all J2EE web applications. The application root is known in J2EE as the context root; under this directory, there is a WEB-INF subdirectory that contains all the directories and files that configure the behavior of a J2EE web application. In this lesson, you will install the FDS and learn about the capabilities by building a simple application.

Flex projects built with FDS have the added benefit of being able to generate or compile SWF files on the server. Up until now, all the SWF files you have created have been compiled on the client by default in a directory called bin. FDS has the capability to generate SWF files dynamically based on a browser request. The browser will request a SWF file from FDS, and data services (on the server) will generate a SWF file along with the required HTML and JavaScript code that will detect Flash Player. The server will then send the generated SWF back to the client. After the SWF file has been generated, it will be cached in the server memory. The process looks as shown in the following example:

It is also possible to configure FDS to compile an application locally. The compiled Flex application does not need to reside in the root directory of FDS. However, the application must be delivered to the web browser from a web root directory that is in the same domain as the installation of the FDS. When you build a project in Flex Builder, there is an option for choosing local compilation of the file. Also, you can use the command-line compiler (mxmlc) to compile the application, which is included with FDS.

With FDS, you have a very powerful way to increase the personalization and customization of your applications. Using FDS, you can create applications that can communicate even more efficiently with Flash Player, resulting in a best of breed-rich Internet application. The Remoting Service speeds up data transfer using the AMF protocol, the messaging service can push data from the server into Flash Player. The Flex Data Management Service enables you to efficiently synchronize data between the client and the server. The FPS solves the security sandbox issues that might have frustrated you up until this point. FDS will run on a variety of industry-standard J2EE application servers so they can fit into many production environments and offer solutions for all applications.




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