|
||||
IntroductionNetKernel is not limited to just a single transport - any number of transports can be used as the source of externally initiated processes. In this example we'll show how to use the Intray Transport to provide the basis of an XSL-FO to PDF distiller. SpecificationWe will configure two directories, one an in-tray, the other an out-tray. XSL-FO files copied into the intray directory will be processed into PDF and placed in the out-tray directory. We will create a module xslfo-distiller which will host the Intray transport and the XSL-FO to PDF distiller. Preparation
TestingTo test your module and Intray transport add a simple dpml idoc in the resources/ directory of your module. Name it 'test.idoc'. Here's one that simply copies the param argument to the response. <idoc>
<seq> <instr> <type>copy</type> <operand>this:param</operand> <target>this:response</target> </instr> </seq> </idoc>
To have the Intray invoke this process for every file that is placed in the "in" directory edit the IntrayConfig and set the process URI
to You should now be able to copy a file to your in directory and see it processed and placed in the out directory. The Intray transport prepends a "p" to the filename to indicate it is a processed result. Writing the XSLFO Distiller
The distiller is very simple, it is shown below. Copy it to your resources/ directory as file distiller.idoc. As before edit the etc/TransportIntrayConfig.xml
to <idoc>
<seq> <instr> <type>xslfo-fop</type> <operand>this:param</operand> <operator> <xslfo-fop> <type>pdf</type> </xslfo-fop> </operator> <target>this:response</target> </instr> </seq> </idoc> Copy an XSL-FO file into the in directory. It will be processed to PDF. Note the Intray transport is very simple and does not yet support renaming of the processed file. You will have to edit the filename to end in ".pdf". ConclusionThis pattern shows the use of an alternative transport to initiate requests. It will be obvious to you by now that you could change the process to anything you like. You might also find it useful to look at the Intray transport's code for ideas as to how to create a custom transport for NetKernel.
|
||||
|
© 2003,2004, 1060® Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited
|
||||