
यदि प्लगइन जीवनचक्र को महसूस करना चाहता है, तो वह PluginActivator इंटरफ़ेस लागू कर सकता है:
public interface PluginActivator {
// 让插件本身判断是否要启动
boolean enabled(PluginContext context);
public void init(PluginContext context) throws Exception;
/**
* Before calling this method, the {@link PluginState} is
* {@link PluginState#STARTING}, after calling, the {@link PluginState} is
* {@link PluginState#ACTIVE}
*
* @param context
*/
public void start(PluginContext context) throws Exception;
/**
* Before calling this method, the {@link PluginState} is
* {@link PluginState#STOPPING}, after calling, the {@link PluginState} is
* {@link PluginState#RESOLVED}
*
* @param context
*/
public void stop(PluginContext context) throws Exception;
}
प्लगइन निर्देशिका के अंतर्गत एक plugin.properties रखें और मूल agent jar फ़ाइल भी रखें।
उदाहरण के लिए:
type=traditional
name=demo-agent
version=1.0.0
agentJarPath=demo-agent.jar
तो one-java-agent इस demo-agent को प्रारंभ करेगा।
mvn clean install bytekit चलाना आवश्यक हैmvn clean package -DskipTests && mvn testmvn clean package -P local -DskipTests पैकेज करने के बाद नवीनतम संस्करण को स्थानीय ~/oneoneagent निर्देशिका में इंस्टॉल करेगा