For a JVM to use an output redirection class that you have modified or written, the
class must be present in a directory on an appropriate class path in the JVM profile
or properties file. The directory containing the jar file for the sample output
redirection class is automatically included on an appropriate class path, and you do
not need to specify it explicitly in the JVM profile. If you supply your own class, you
need to add the directory to either the shareable application class path, or the
standard class path. Only use the shareable application class path if you are using
Java 1.4.2 with class sharing, otherwise use the standard class path. Adding
application classes to the class paths for a JVM Java Applications in CICS explains
how to do this.
If you decide to write your own classes, you need to know about:
v The OutputRedirectionPlugin interface
v Possible destinations for output
v Handling output redirection errors and internal errors
These considerations are described below.
The com.ibm.cics.server.OutputRedirectionPlugin interface
CICS supplies an interface called com.ibm.cics.server.OutputRedirectionPlugin,
shipped in dfjcics.jar, which can be implemented by classes that intercept the stdout
and stderr output from the JVM. The CICS-supplied samples implement this
interface. The sample classes themselves are made up of:
v A superclass com.ibm.cics.samples.SJStream that implements this interface
v The subclasses com.ibm.cics.samples.SJMergedStream and
com.ibm.cics.samples.SJTaskStream, which are the classes that are actually
named in the JVM profile.
It is recommended that, like the sample classes, your class implements the
interface OutputRedirectionPlugin directly, or extends a class which itself
implements the interface. You can achieve this either by inheriting from the
superclass com.ibm.cics.samples.SJStream, or by implementing a class structure
with the same interface. Whether or not your class implements the interface
OutputRedirectionPlugin, it must extend java.io.OutputStream.
The initRedirect() method receives a set of parameters, which are used by the
output redirection class or classes. The coding for the interface is as follows:
package com.ibm.cics.server;
import java.io.*;
public interface OutputRedirectionPlugin {
public boolean initRedirect( String inDest,
PrintStream inPS,
String inApplid,
String inProgramName,
Integer inTaskNumber,
String inTransid
);
}
The superclass com.ibm.cics.samples.SJStream contains the common components
of com.ibm.cics.samples.SJMergedStream and
com.ibm.cics.samples.SJTaskStream. It contains an initRedirect method that returns
‘false’, which effectively disables output redirection unless this method is overridden
668 Customization Guide
|
|