Question:
The EPAgent is concerned with the following class:
com.wily.introscope.epagent.ClassPlugIn extends EPAPlugIn
The configuration should look something like
introscope.epagent.stateless.MYCLASS.class=com.wily.myplugins.MyClass
The main() method is the entry point.
The format for an EPAgent Java class is as follows:
public static void main(String[], PrintStream) or public static void main(String[])
If both formats are present, the first one takes precendence.
The second format is only useful if planning on using the DataAPI to publish metrics. Use the first one if you want to use the existing "simple" or XML data formats.
You can test the first variety stand-alone by doing something like:
public class EPAPlugin
{
public static void main(String[] args)
{
main(args, System.out);
}
public static void main(String[] args, PrintStream out) {
out.println("myMetric=100");
}
}
This way you can run it without the EPA harness and make sure the output looks right, then plug it into EPA unmodified and EPA will use the second entry point.
Below is a sample class that can be compiled and run in the EPAgent with the following settings.
lib\EPAgent.jar;lib\demoPlugIn.jar;lib\Agent.jar;lib\IntroscopeServices.jar com.wily.introscope.api.IntroscopeEPAgent
introscope.epagent.plugins.stateless.names=MYCLASS
introscope.epagent.stateless.MYCLASS.class=com.wily.epagent.plugins.TestPlugIn introscope.epagent.stateless.MYCLASS.delayInSeconds=60
package com.wily.epagent.plugins;
import java.util.Iterator;
import com.wily.org.apache.log4j.Logger;
/**
* Sample EPAgent Java class
*
*/
public class TestPlugIn implements Runnable { Logger logger =
Logger.getLogger(TestPlugIn.class);
public void run() {
while (true) {
try {
logger.info("Testing PlugIn " + this.getClass().getName());
Thread.sleep(2000);
}
catch (InterruptedException e) { // TODO
Auto-generated catch block e.printStackTrace(); }
}
}
public static void main(String[] args) {
new Thread(new TestPlugIn()).start();
}
}
Additional Information:
This document was created to help you with your customization, any further help needed related to this Knowledge Document must be addressed by CA Professional Services.