Defining a Top Level Object Type

A top level object type can be defined by creating a class that implements com.tibco.tea.agent.api.TopLevelTeaObject.

Procedure

  1. Define a class that implements com.tibco.tea.agent.api.TopLevelTeaObject

    For example,

    public class MyProduct implements TopLevelTeaObject {
    
        public String getTypeName() {
        	//..
        }
    
        public String getTypeDescription() {
        	//..
        }
    
        public String getName() {
        	//..
        }
    
        public String getDescription() {
        	//..
        }
    
        public Collection(BaseTeaObject) getMembers() {
        	//..
        }
    
        @TeaOperation(description = "get", methodType = MethodType.READ)
        public Result get() {
        	//..
        }
    }

    Code explanation:

    • To define an object type which represents your product, create a class which implements com.tibco.tea.agent.api.TopLevelTeaObject.
    • To describe the top level object type, use com.tibco.tea.agent.api.TopLevelTeaObject.getTypeName() and com.tibco.tea.agent.api.TopLevelTeaObject.getTypeDescription()
    • As there is only one instance possible of this type, the instance specific methods are merged with object type specific methods. com.tibco.tea.agent.api.TopLevelTeaObject.getName() and com.tibco.tea.agent.api.TopLevelTeaObject.getDescription() should be used for describing the single instance of the top level object type.
    • com.tibco.tea.agent.api.TopLevelTeaObject.getMembers() should be used to return the members of the single instance of top level object type.
    • Any TeaOperation should be defined using the TeaOperation annotation.
  2. Register the top level object type definition with the TIBCO Enterprise Administrator agent library.

    For example, create an instance of the top level object type and register it with the TeaAgentServer.

    TeaAgentServer server = //..
    // register other instances including the top level object type
    MyProduct myProduct = //..
    server.registerInstance(myProduct);
    server.start();
    Note: When two different versions of agents co-exist on the same TIBCO Enterprise Administrator server, ensure that you do not change the method signature of TopLevelTeaObject between the two versions.