Defining References for Object Types with Annotations

A method on one of the registered objects types, created using annotations, can be exposed as a reference available to TIBCO Enterprise Administrator server and the user interface. In this manner, you can refer to a TeaObject from another TeaObject.

Procedure

  1. Define a method, which has an object key as a parameter and returns an array of com.tibco.tea.agent.types.AgentObjectIdentifier objects. Each reference is invoked in context of the object and the parameter key identifies the source object. This attribute can be skipped for references on top-level types, as there can be only one instance of a top level object per agent. For example, the getApplications() method returns an array of com.tibco.tea.agent.types.AgentObjectIdentifier references.
     public AgentObjectIdentifier[] getApplications(final String key){
                //The code...
            }
  2. Add the TeaReference annotation. For example, the getApplications() method is marked as a reference using the TeaReference annotation.
    @TeaReference(name = "applications", referenceType = "applicationType", objectType = "applicationObjectType")
    public AgentObjectIdentifier[] getApplications( final String key){
        //The code...
    }
    Code explanation:
    • The TeaReference annotation marks the method as a reference. It gives you the following information:
    Parameters Description
    name Name of the reference
    referenceType Type of the element
    objectType (optional) Needed when more than one object type is defined on the referenced class
    • AgentObjectIdentifier[] -The getApplications() method returns an array of AgentObjectIdentifier references.
    • @keyParam - Each reference is invoked in context of the object, KeyParam, which is a key of the source object. This attribute can be skipped for references on top-level types, as there can be only one instance of top level object per agent.