opcmsg Java API

Operations Agent provides a set of Java classes to generate messages for open message interface policies. The classes can be used to generate messages from within a Java program.

The Java classes can also be used to acknowledge previously generated messages, and to send monitor values to the Operations Agent. Operations Connector does not support these uses.

JAR files

The JAR files jopcagtbase.jar and jopcagtmsg.jar that are necessary to use the APIs are installed as part of Operations Agent on the Operations Connector server at:

Windows: %OvInstallDir%\java

Linux: /opt/OV/java

Prerequisites

To use the Java classes:

  • The -classpath parameter used for the javac and java commands must include the jopcagtbase.jar and jopcagtmsg.jar files.

  • The PATH system variable must include the directory where the shared library files reside. The agent installation does this automatically.

Documentation

Javadoc style class documentation is available at the following location:

Windows: %OvInstallDir%\www\htdocs\jdoc_agent\index.html

Linux: /opt/OV/www/htdocs/jdoc_agent/index.html

For more information, see the section "Java API" in the Operations Agent Reference section PDF.

Examples

Examples of how the API classes can be used from Java are available in the following directory on the Operations Connector server:

Windows: %OvInstallDir%\examples\jopcagtapi

Linux: /opt/OV/OpC/examples/jopcagtapi

To compile and run the example code on Windows

  1. Change to the folder %OvInstallDir%/examples/jopcagtapi on the Operations Connector server.

  2. Compile the example code, type:

    javac -classpath "%OvInstallDir%/java/jopcagtbase.jar:%OvInstallDir%/java/jopcagtmsg.jar" JOpcAgtMsgTest.java

  3. Run the example code, type:

    java -classpath ".:%OvInstallDir%/java/jopcagtbase.jar:%OvInstallDir%/java/jopcagtmsg.jar" JOpcAgtMsgTest

To compile and run the example code on Linux

  1. Change to the directory /opt/OV/OpC/examples/jopcagtapi on the Operations Connector server.

  2. Compile the example code, type:

    javac -classpath "/opt/OV/java/jopcagtbase.jar:/opt/OV/java/jopcagtmsg.jar" JOpcAgtMsgTest.java

  3. Run the example code, type:

    java -classpath ".:/opt/OV/java/jopcagtbase.jar:/opt/OV/java/jopcagtmsg.jar" JOpcAgtMsgTest