Skip to content
nimcoh0 edited this page Dec 18, 2023 · 1 revision

Plugin

Jdry use java spi as plugin mechanism . plugin consist of minimum two classes provider & provider Impl .

add the following dependencies to the pom

<dependency>  
 <groupId>org.softauto</groupId>  
 <artifactId>jdry-core</artifactId>  
 <version>${jdry-core}</version>  
</dependency>

PluginProvider

create Plugin Provider class

 // load the plugin impl class * @return 
 Provider create();  
  

 //the name of this plugin provider 
 String getVendor();  
  
  
 //the version of this plugin provider
 String getVersion();  
  

 the name of this plugin name 
 String getName();

Provider

create provider impl class should be singleton

   // initilize plugin   
    Provider initialize()throws IOException;  

   // register plugin in the ServiceLocator
    void register();  

   //shutdown plugin 
    void shutdown();  
      
   //get this plugin type 
    String getType();  

   // parse new element of this provider type   
    JsonNode parser(Element element);  
      
   //set schema interface class 
    Provider iface(Class iface);  
      
      
    <RespT> Object exec(String name, ManagedChannel channel, Object[] args, Class[] types, HashMap<String,Object> callOptions,String scenarioId);  
    <RespT> void exec(String name, org.softauto.core.Callback<RespT> callback, ManagedChannel channel, Object[] args, Class[] types, HashMap<String,Object> callOptions,String scenarioId);

configuration

configuration to your plugin should be add to the Configuration.yaml load by the Tester .

my:  
  host: "localhost"  
  port: "5092"

Configuration will contain the Configuration.yaml and support json query so you can access your configuration like this Configuration.get("my/host").asText()

resources

under resources create

META-INF
		services
		   org.softauto.plugin.spi.PluginProvider 

org.softauto.plugin.spi.PluginProvider should point to org.softauto.my.MyProvider

Clone this wiki locally