Advanced Customization > Services and Infrastructure Customization > Import Export Framework > How to Write an IX Application
  
How to Write an IX Application
The export starts with Export application. The code of the application that invokes export should look as follows:
ExportHandler appHandler = new ExportHandler ();
Exporter exporter = IxbHelper.newExporter(handle,
IxbHelper.STANDARD_DTD,
clientSettingsElement,
policyFile==null?(File)null:policyFile.getFile());

Iterator iter = objectSet.iterator();
while (iter.hasNext()) {
Persistable ob = (Persistable)iter.next();
exporter.doExport(ob);
}
exporter.finalizeExport();
appHandler.cleanUp ();
Create an Application Export Handler (appHandler). This is an instance of a class either implementing ApplicationExportHandler interface or extending the abstract class ApplicationExportHandlerTemplate. In the export application in StandardIXBService, the appHandler extends ApplicationExportHandlerForJar, a subclass of ApplicationExportHandlerTemplate
The job of the appHandler is:
To create a file to store exported objects (e.g. a JAR file).
To store logs to be sent back to the client (optional).
To clean up temporary files and do other clean-up jobs (advised, but optional).
To create, the following methods must be implemented in appHandler:
storeLogMessage(...) methods are used to send logs back to clients. It is up to the developer how to implement the mechanism to send the logs back. If you do not want to send any log messages, make your Export Handler extend ApplicationExportHandlerTemplate. This class has the default storeLogMessage() (empty method).
It is optional to have clean up and other concluding tasks here, and these jobs must be called explicitly after exporter.finalizeExport().
The Application Export Handler may also contain methods to perform tasks of transforming the output if the application needs to modify the exported XML. For example, PDXExportHandler has methods for XSL transformation to PDX format. These methods must be called explicitly after exporter.finalizeExport().
The existing implementations of the Application Export Handler is:
PDXExportHandler extends ApplicationExportHandlerTemplate. This class performs specific tasks connected with export to PDX format. This includes creating additional XML attributes/elements and XSL transformation to PDX format.
Create an instance of the Exporter class, and use it to export objects by calling exporter.doExport(obj), where obj runs through all WT objects collected for export.
After this, call exporter.finalizeExport(), perform any additional tasks (for example, transformation to another format), call methods of appHandler to clean up after the export process, send log messages to client.
The methods doExport(…), doExportImpl(…) and the inner class ExportHandler in StandardIXBService are examples of one export application. Please see the details of the example in Export Application.
Prerequisite
In order to create the export jar at a client specific location, the following prerequisite needs to be satisfied before calling the doExport api of StandardIXBService:
The context key ISBStreamer.CLIENT_SAVE_AS_FILE needs to be set with the complete client side file path:
WTContext.getContext().put(IXBStreamer.CLIENT_SAVE_AS_FILE,CLIENT
JAR);
Where CLIENT_JAR is the complete client side file path, e.g.c:\\mydocuments\\impex.jar.