With the Scripting object contributor service, plug-ins can register scripting objects at runtime, without having to restart the Automation Orchestrator server.

Service Description
ScriptingObjectsContributor A service endpoint that registers scripting objects at runtime.
ScriptingObjectDefinition A definition of a scripting object.
ScriptingAttributeDefinition A definition of an attribute of a scripting object.
ScriptingMethodDefinition A definition of a method of a scripting object
ScriptingConstructorDefinition A definition of a constructor of a scripting object

Procedure

  1. Access the service.
    1. If the plug-in is Spring-enabled:
      //Object must be declared in the spring context
      public class MyDomainObject {
       
       @Autowired
       private ScriptingObjectsContributor scriptingObjectContributor;
      
      }
    2. If the plug-in is not Spring-enabled:
      public class PluginAdaptor implements IServiceRegistryAdaptor {
      
       private IServiceRegistry registry;
       private ScriptingObjectsContributor scriptingObjectContributor;
       @Override
       public void setServiceRegistry(IServiceRegistry registry) {
       this.registry = registry;
       }
      
       public ScriptingObjectsContributor getScriptingObjectContributor() {
       if (scriptingObjectContributor == null) {
       scriptingObjectContributor = (ScriptingObjectsContributor)
      registry.getService(IServiceRegistry.SCRIPTING_OBJECTS_CONTRIBUTOR_SERVICE);
       }
       return scriptingObjectContributor;
       }
      }
  2. Contribute a scripting object with a single attribute.
    //Provided the service is already instantiated
    ScriptingObjectsContributor scriptingObjectContributor;
    
    //Init a list of attributes of the scripting object
    List<ScriptingAttributeDefinition> attributes = new LinkedList<>();
    
    //Create a single scripting attribute of type string
    ScriptingAttributeDefinition attribute =
    ScriptingAttributeDefinition.newBuilder()
     .scriptName("scriptingAttributeName") //The attribute will appear with this
    name in the orchestrator
     .javaName("scriptingAttributeName") //The attribute name in the
    corresponding Java class
     .type("string") //The attribute type
     .description("Description of the attribute") //Description of the attribute
     .build();
    attributes.add(attribute);
    
    //Create a scripting object, setting the above created attribute
    ScriptingObjectDefinition object = ScriptingObjectDefinition.newBuilder()
     .scriptingName("scriptingObjectName") //The name of the scripting object as
    it will appear in the orchestrator
     .javaClassName(MyClass.class.getName()) //The corresponding java class
     .attributes(attributes) //The above created attributes
     .description(enumeration.getDocumentation()) //Description of the scripting
    object
     .dynamic(true)
     .dynamicInvocation(true)
     .build();
    
    //Invoke the service
    scriptingObjectContributor.contribute(Collections.singletonList(object));