CICS JVM 插件机制
除了 JVM 中的标准 JPDA 调试接口外, CICS® 还在 CICS Java™ 中间件中提供了一组拦截点 (插件) ,这对于调试应用程序很有用。 可以使用这些插件在运行应用程序 Java 代码之前和之后立即插入其他 Java 程序。
有关应用程序的信息 (例如,类名和方法名) 可供插件使用。 这些插件还可以使用 JCICS API 来获取有关应用程序的信息,还可以与标准 JPDA 接口结合使用,以提供专门针对 CICS的其他调试工具。 这些插件还可以通过与 CICS 用户出口类似的方式用于除调试以外的其他用途。
Java 出口是一个 CICS Java 包装器插件,它提供在调用 Java 程序之前和之后立即调用的方法。
要部署插件,请将插件打包为 OSGi 捆绑软件。 有关更多信息,请参阅 在 JVM 服务器中部署 OSGi 捆绑软件。
提供了两个 Java 编程接口。
这两个接口都在 com.ibm.cics.server.jar中提供,并记录在 Javadoc 中。
Java 编程接口包括:
- DebugControl:
com.ibm.cics.server.debug.DebugControl. 此编程接口定义可以对用户提供的实现进行的方法调用。 - 插件:
com.ibm.cics.server.debug.Plugin。 这是用于注册插件实现的通用编程接口。
以下是 DebugControl 接口的示例:
public interface DebugControl
{
// called before an application object method or program main is invoked
public void startDebug(java.lang.String className,java.lang.String methodName);
// called after an application object method or program main is invoked
public void stopDebug(java.lang.String className,java.lang.String methodName);
// called before an application object is deleted
public void exitDebug();
}
public interface Plugin
{
// initaliser, called when plug-in is registered
public void init();
}
以下是 DebugControl 和插件接口的示例实现:
import com.ibm.cics.server.debug.*;
public class SampleCICSDebugPlugin
implements Plugin, DebugControl
{
// Implementation of the plug-in initialiser
public void init()
{
// This method is called when the CICS Java middleware loads and
// registers the plug-in. It can be used to perform any initialization
// required for the debug control implementation.
}
// Implementations of the debug control methods
public void startDebug(java.lang.String className,java.lang.String methodName)
{
// This method is called immediately before the application method is
// invoked. It can be used to start operation of a debugging tool. JCICS
// calls such as Task.getTask can be used here to obtain further
// information about the application.
}
public void stopDebug(java.lang.String className,java.lang.String methodName)
{
// This method is called immediately after the application method is
// invoked. It can be used to suspend operation of a debugging tool.
}
public void exitDebug()
{
// This method is called immediately before an application object is
// deleted. It can be used to terminate operation of a debugging tool.
}
public static void main(com.ibm.cics.server.CommAreaHolder ca)
{
}
}