Modeling Members in Interface Style

To model a managed object that contains other managed objects, implement the supplemental interface com.tibco.tea.agent.api.WithMembers.

Members indicates a containment relationship. Model any other type of relationship using @TeaReference. See also References Aspect.

Prerequisites

The container object is defined in interface style.

Procedure

  1. Implement the WithMembers interface in your managed object type.
    public class TomcatServer implements TeaObject, WithMembers
        ...
        public Collection<BaseTeaObject> getMembers() {
        }
    }
  2. Implement the getMembers method to return the set of member objects.
    getMembers must return a generic collection of BaseTeaObject (or any compatible type).
    For example, the members of a Tomcat server are the web applications that run in the server.
    public class TomcatServer implements TeaObject, WithMembers
        ...
        public Collection<BaseTeaObject> getMembers() {
            final Collection<BaseTeaObject> members = new ArrayList<BaseTeaObject>();
            for (final WebApp wapp : this.getWebApps()) {
                members.add(wapp);
            }
            return members;
            ...
        }
    }
    Implementing this method allows the Tomcat agent to supply the members when the TIBCO Enterprise Administrator server requests them.