Publishing Engine Programmer's Guide > PTC Arbortext Publishing > Arbortext Publishing Engine Client Composer > Arbortext Publishing Engine Client Composer Operation
  
Arbortext Publishing Engine Client Composer Operation
The Arbortext Publishing Engine Client Composer performs only processing that is common to all publishing types. To perform processing specific to the output type, the Client Composer loads a Client Composer Extension object and calls methods defined by the extension just before the request is transmitted to the Arbortext PE server, and does it again after the response has been received.
The Client Composer is a Java object named com.arbortext.e3c.ClientComposer. It defines one public method called compose(Map-parameters, Map-types).
The method returns either the string ok or an error message. The two Map arguments are parallel associative arrays. For each map key name, parameters[name] is the parameter value and types[name] is the parameter type.
If a parameter appears in parameters[name] but not in types[name] the default parameter type is string. If a parameter appears in types[name] but not in parameters[name], it is ignored.
For example, to pass a parameter named test1 of type string and with value abcdef, store the values in the parameters[name] and types[name] maps as follows:
parameters[ "test1"] = "abcdef";
types[ "test1"] = "string";
The Client Composer starts running when the publishing framework routine compose_for_type calls the ACL routine compose::e3_compose. Then e3_compose creates the parameters and types arrays and invokes the Java method com.arbortext.e3c.ClientComposer.compose.
ClientComposer.compose starts by searching the parameters[name] array for a parameter named e3.asynchronous. If the parameter is not present or it has a value other than 1, then ClientComposer.compose simply calls the private method doCompose and returns its result. If e3.asynchronous is present and equal to 1, ClientComposer.compose creates a new thread which calls doCompose, and then ClientComposer.compose returns ok to its caller immediately. All of the real work is performed by doCompose, which has the same parameters and result signature as ClientComposer.compose.
The doCompose method begins by creating an input directory. The content of this input directory will be transmitted to the Arbortext PE server. Next, it processes the list of parameters. It looks for a few parameters by name, but, for most parameters, processing is driven by the parameter type. For each parameter, doCompose performs some action based upon the parameter name or type. Some parameters are saved for transmission to the Arbortext PE server, possibly with a modified value or type.
Next, doCompose loads the Client Composition Extension and calls its preProcess method. It writes key information about the publishing operation, including the modified parameter list, to the input directory file index.xml. Then it compresses the input directory into a single JAR file.
After creating the JAR file, the ClientComposer.doCompose method obtains the server URL from the Arbortext Editor (from the Tools > Preferences > Publishing Engine or the value of the set peserverurl option), then uses the Java Client SDK to construct a request and transmit the request to the Arbortext PE server. The request includes the query parameters f=java and class=com.arbortext.e3c.Application. The JAR file containing the input directory is sent as the body of the request. Then the Client Composer waits for the Arbortext PE server to respond.
After it finishes processing, the Arbortext PE server returns a response that contains a JAR file as the response body. The Arbortext Publishing Engine Client Composer saves the response JAR to disk and extracts two files. One is an XML document named response.xml which contains basic information about whether the request succeeded. The other file is the server composer log from the JAR which contains information generated by the server during the publishing process. The Client Composer analyzes response.xml to determine if the request succeeded or failed, and then copies information from the server event log into the client event log. The Arbortext Publishing Engine Client Composer then calls the Client Composition Extension method postProcess. Lastly, the Client Composer calls the postprocess callback of the publishing framework (described in the postprocess Callback section of The Outer Layer of the Publishing Framework).