G.3 SampleCommandHandler.java

Source code for a sample custom command handler is included with the driver distribution. The source code is found in the manual_task_docs.zip file in the distribution image.

The handler is implemented in the com.novell.nds.dirxml.driver.manualtask.samples.SampleCommandHandler class.

The sample handler simply generates a document using style sheets and templates and writes the resulting document to a file.

G.3.1 Compiling the SampleCommandHandler Class

You can use any Java 2 compiler to compile the SampleCommandHandler class. You must place nxsl.jar, dirxml.jar, collections.jar, and ManualTaskServiceBase.jar in the Java compiler classpath.

G.3.2 Trying the SampleCommandHandler Class

Start by importing the Room Number sample configuration for the driver.

Compile the SampleCommandHandler class and place the resulting class file in a .jar file. Place the .jar file in the DirXML .jar file directory appropriate to the platform on which you are running the driver.

Add the following XML element under the <subscriber-options> element found in the Driver Parameters XML section of the driver properties:

<output-path display-name="Sample Output Path"></output-path>

Edit the Driver Parameters. In the item labeled Sample Output Path, place a path to a directory in which the SampleCommandHandler will write its created documents. In the item labeled Additional Handlers, add the string com.novell.nds.dirxml.driver.manualtask.samples.SampleCommandHandler.

Replace the Subscriber channel command transformation policy with CommandXform.xsl which is found in the same directory as the SampleCommandHandler.java file.

Create a User object and add a manager reference to the User object. If the manager has an e-mail address value, then a <sample> command element is sent to the Subscriber and the SampleCommandHandler writes a file in the location you specified above.