|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
MXDJ TOP LINKS YOU MUST CLICK ON ! Flash Flex & Flash Communication Server
Collaboration in the enterprise
By: Peter Ent
Nov. 18, 2004 12:00 AM
The challenge of enterprise-level collaboration is to make data sharing effective and keep costs down. Applications built with C++ or Java must be delivered to the end-users' desktops along with some piece of the collaboration software. That can be a headache for IT departments because it is another set of files to deploy, upgrade, and test. For me, collaboration has a broad meaning: two or more applications running on distinct computers sharing data. There is usually some sort of middleware connecting them: software that moves the data from one location to another. After spending nearly 10 years in the financial services arena, I can tell you that enterprise applications are highly collaborative affairs. Traders need to know current stock prices, orders for buying and selling equities flow across the Internet, and conversations between counter parties take place in real time around the world 24x7. IT departments in the financial services industry have been reluctant to place their bread-and-butter applications onto the Web because the means to push information onto the end-user's desktop has not been practical. Java applets, which can use Java Messaging Services, have appeared from time to time. However, their large downloads and browser-compatibility issues have dissuaded IT from heavy investment. Now the combination of Macromedia Flex and Macromedia Flash Communication Server (FCS) make it possible for a new generation of Web applications to take on the collaborative mantle and challenge traditional desktop applications. IT departments finally have the combination that they have long sought of rapid development, simple deployment, small download, and integrated collaboration. After all, most PCs already have the Flash Player and that's all you need. There is no additional software required. IT departments can deploy their collaborative applications to their Web and application servers, and the users' browsers do the rest. This article shows you how to build a simple collaborative application in Flex that uses FCS's shared remote objects. FCS Note that Java has its version called Java Messaging Service (JMS) that has a number of implementations. CORBA (Common Object Request Broker Architecture) often underpins many middleware systems. FCS is a piece of software (usually run on its own machine) tasked with moving information from one Flash Player to another Flash Player. Macromedia typically markets FCS as a way to stream video and audio to and from the Flash Player. Proprietary software within FCS makes it possible not only to broadcast video to many users simultaneously, but to receive video as well. One example application is an online conference with an interactive whiteboard. Each participant has a camera and the program provides a virtual whiteboard. The current speaker's image is transmitted to all members of the conference. As the speaker draws on the whiteboard, everyone sees the diagram taking shape. In my opinion, the most powerful aspect of FCS isn't its ability to share data. The real power is the fact that it can be programmed or scripted so its behavior supplements the application. I have written Java- and C++-based applications that use software to share data with remotely connected users. The middleware (i.e., JMS or CORBA) is normally a black box. That is, you can install and configure it, but you cannot make it perform any functions that its creators did not intend. This is not true for FCS. As with Flash and Flex, FCS uses ActionScript as its language. Each FCS actually runs multiple applications (see Figure 1). A single FCS can run a video conference application as well as a stock price ticker. For example, if an FCS application is acting as a chat room, the FCS application can save the messages to a database (using Flash Remoting and a J2EE server). The FCS application can also authorize each user that attempts to connect to the application by allowing or rejecting the connection. Flex Flex applications are written in a form of XML called MXML (Macromedia's XML) that defines the content and placement of the user interface. There are lots of controls from which to choose: button, label, data grid, tree, slider, and so forth. There are also layout containers to help manage the placement of the controls. Of course, placing controls on a page would be useless without program code to control them. Flex uses Flash's ActionScript language to provide the necessary event handling and data management. Example: Drag and Drop In Figure 3, user peter is dragging two orders over the drop zone for user joseph. Notice how the drop zone highlights to indicate that it will accept the data. If user peter were to try to drop the orders over his own icon, the drop zone would not highlight. It would not make sense to send orders to yourself. When user peter releases the mouse over the drop zone, Flex animates the graphics to show the data falling into the drop zone. If user peter moves out of the drop zone and releases the mouse, Flex animates the data to show it returning to its point of origin. When the user releases the mouse over a highlighted drop zone, the Flex application extracts the orders from the data grid and sends them to FCS along with the name of the target user (i.e., user joseph). FCS then takes those orders and pushes them to user joseph's Flex application, which in turn, updates its data grid. How FCS knows what to do and how the Flex application sends and receives the data is discussed in the section, Connecting Flex to FCS. Figure 4 shows user joseph's grid after receiving the orders. At this point user joseph could modify one of the orders and send it back to user peter by dragging it over user peter's drop zone. The application is written such that it examines the data being received and replaces orders it already has (using the order code). It adds new rows to the grid for orders it does not have. Note that the example illustrates just how easy it is to implement data sharing. Flex and FCS not only do the job of collaboration, they make it easy to do the job. The sample application provides you with a glimpse of what is possible. If you choose to download the program code, make sure you run at least two separate instances of the application on different computers to get the full effect. Although the sample uses fairly simple data (and an array of order objects), you can send more complex structures. In fact nearly anything you can build with ActionScript you can share. More Examples Example 3 is one of the most common applications seen in financial data systems: real-time price updates. This is often seen as a band of stock symbols; prices streaming around the screen; or as a table of symbols, prices, and other information. Figure 6 shows a Flex DataGrid with currency exchange rates and volumes. The application works with FCS to bring real-time information directly to your desktop. Connecting Flex to the FCS In Example 1 there is a list of active users. I describe the list by labeled images. When a user signs on to the application, an image automatically appears. Similarly, when a user signs off (closes their browser), their corresponding icon automatically disappears. To achieve this, I created a shared object called users (see Figure 7) for the sole purpose of conveying who is currently using the application. Within the FCS application code, I add a new user to the list whenever an application connects. Because this is a shared object, FCS automatically synchronizes its list with those of all of the attached Flex applications. I coded the Flex applications to display a labeled icon.
Making the Connection
Listing 1 shows the instantiation of my FlashComm class within the application's MXML file and some of the events it handles.
The boldfaced lines are the event handlers for the drag-and-drop operation. The doDragDrop method is shown here:
function doDragDrop(event) {
flashComm.sendOrders(dataGrid.selectedItems, event.target.label);
restoreDragTarget(event);
}
Whenever the user releases the mouse, the selected items (orders) from the data grid are given to my FlashComm class to be sent to FCS along with the name (the icon's label) of the intended recipient. FCS then invokes the receiveOrders method defined on the recipient's unique shared object. FCS Application
To Collaborate Is Human I have developed similar Java-based applications using Swing for the user interface and an implementation of the Java Message Service as the middleware. Flex and FCS are, in my opinion, a tonic for the developer's soul. Resources LATEST FLEX STORIES & POSTS
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||