Adobe Labs
 
 

cap bottom

Hub Overview

Hub is an Adobe® AIR® application that invokes a set of Adobe LiveCycle® ES processes. Hub takes an input document, or set of documents, some configuration parameters, such as PDF settings in Create PDF, and invokes the corresponding LiveCycle ES processes. Hub provides the following functionality:

  • PDF Generator: PDF Generator converts supported documents to PDF using LiveCycle PDF Generator ES. If more than one document is given as input, then the converted PDFs are merged into a single PDF.
  • PDF Package: PDF Package converts the input documents to PDFs and then packages them into a single PDF package. The user has the option to include a cover page. If the user does not provide a cover page, Hub uses the default cover page.
  • Export PDF: Export PDF takes an input PDF file and converts it into a user specified format.
  • PDF 3D: PDF 3D takes an input 3D file and converts it into a 3D PDF.

Communication with LiveCycle ES

Hub communicates with the LiveCycle ES server using Adobe Flex® Remoting. Hub sends and receives ActionScript Message Format (AMF) data to the LiveCycle ES server. AMF is a binary format for ActionScript. AMF is transported over HTTP or HTTPS as configured by the end user. The ActionScript serialization and de-serialization takes place at the server side by the remoting gateway.

Hub Chart

High Level Organization of Code

Icon Component MXML File LiveCycle ES Process
PDF Generator PDF Generator MergeInputPage.mxml HubAssembler
Export PDF Export PDF ExportPDFPage.mxml HubFileTransformation
PDF 3D PDF 3D CreatePDF3dGeneratorPage.mxml HubPDF3D
PDF Package PDF Package PackageInputPage.mxml HubPackage
Settings Settings SelectServiceSettingsPage.mxml  

Flex Remoting in Code

Invoking a LiveCycle ES process or service via Flex Remoting requires the following:

  • RemoteObject: Defines the name of the process or the service.
  • ChannelSet: The ChannelSet contains an AMF channel to communicate with the LiveCycle ES server. A channel represents a physical connection to a remote endpoint.
  • Invoking the Service: An operation call that passes in the required input parameters needed to invoke the service. A LiveCycle ES process exposes the “invoke” operation to invoke the process.

The RemotingFramework library is responsible for creating ChannelSet and RemoteObject. The server information required by ChannelSet is loaded from the server.xml file every time the application starts. For a description of the server.xml file, see Settings.

The serverDataLoaded method in the Hub.mxml file assigns the server information to the ChannelSet:

private function serverDataLoaded(xml:Object):void
{
     var cache:RemoteObjectCache = 
RemotingService.remoteObjectCache;  
     ....
     ....
     cache.setCredentials(userName, password);
     cache.setServer(serverProtocol, serverName, serverPort);
}

A remote object is defined for each of the processes that the application invokes on the server. For Example, the method below invokes the HubPDF3D in the Create3dGeneratorpage.mxml page.

private function convertTo3DPDF(file:DocumentReference, 
                                fileName:String,
                                uploadService:UploadService):void
{
     //points the RemoteObject to the service name
     var remoteObject:RemoteObject = 
RemotingService.remoteObjectCache.getRemoteObject("HubPDF3D");
     
     //operation to invoke the process
     var token:AsyncToken = 
remoteObject.invoke({monDocIn:file, monFilenameIn:fileName});

     token.uploadService = uploadService;
     
     //handles the service response
     token.addResponder(new mx.rpc.Responder(onServiceResponse, 
                                             onServiceResponse));
}

Note: The input parameters in LiveCycle ES services are named parameters. In the code above, monDocIn and monFileNameIn are the parameter names and file and fileName are the parameter values being passed in.

Handling of Input Documents

LiveCycle ES accepts a document in a DocumentReference object. A DocumentReference object is constructed by uploading the documents to the LiveCycle ES server and then setting the URL in DocumentReference. All files that are dragged or added in the application are stored in an ArrayCollection of FileReference objects. These documents are then uploaded to the server and corresponding DocumentReference objects are created. Documents are loaded via the remoting framework library. The  onUploadResponse method in each panel handles the transformation between FileReference to DocumentReference.

Downloading Documents from LiveCycle ES Server

The LiveCycle ES service response returns the output document in a URL. However, to support the drag-and-drop features from Hub to the desktop, the application loads the URL and saves it under <user-documents-directory>/HubResult.

The code for the response is handled in each panel. The onServiceResponse and dragOut methods handle the response and drag-and-drop features respectively.

Settings

When Hub is installed, a server.xml file is created in the installed directory. This XML file contains connection information, such as protocol, Server name, port and credentials, to the LiveCycle ES server.

The user enters the settings in the Server Settings dialog box. The settings are saved in the <user-home>/Hub/Server.xml file. For subsequent startups, the XML file is used. The code for creating the server.xml file is in SelectServiceSetting.mxml in the saveXML() method. While saving the settings on the disk, the user’s password is not persisted. Each time Hub is started, the user must supply a password in the Server Settings dialog box.

Hub

All Technologies

Technology Groups

Showcase Gallery