A simple plug-in in Java
The simple plug-in sample in the samples\correlator_plugin\java directory of your Apama installation is comparable to the similar C and C++ simple plug-in samples.
The Java code for the SimplePlugin class contains the public static test method. (Methods that will be called from EPL code need to be public and static.)
public class SimplePlugin
{
  public static final String TEST_STRING = "Hello, World";
  public static String test(String arg)
  {
    System.out.println("SimplePlugin function test called");
    System.out.println("arg = "+arg);
    System.out.println("return value = "+TEST_STRING);
    return TEST_STRING;
  }
}
The SimplePlugin.xml file is the deployment descriptor and contains the following <plugin> stanza that illustrates how to specify the plug-in.
  <application-classes>
    <plugin>
      <plugin-name>SimplePlugin</plugin-name>
      <plugin-class>SimplePlugin</plugin-class>
      <description>A test plugin</description>
    </plugin>
  </application-classes>
		
The SimplePlugin.mon file contains the EPL code. It imports the plug-in and calls the test method.
monitor SimplePluginTest {
  // Load the plugin
  import "SimplePlugin" as simple;
// To hold the return value
  string ret;
  string arg;
  action onload {
    // Call plugin function
    arg := "Hello, Simple Plugin";
	   ret := simple.test(arg);
    // Print out return value
    log "simple.test = " + ret at INFO;
    log "arg = " + arg at INFO;
  }
}