Modeling State in Annotation Style

To model a managed object that has states, implement a method the returns the current state, and annotate that method as @TeaGetStatus.

See also States Aspect.

Prerequisites

The object is defined in annotation style. Top-level object types cannot have state.

Procedure

  • Implement a method to get the state. Annotate it as @TeaGetStatus.
    The status method must return an instance of the class com.tibco.tea.agent.types.AgentObjectStatus. AgentObjectStatus is a standard format for encapsulating state within agents. It has three fields:
    state
    Required. The state name.
    desc
    Optional. An interpretive description of the state.
    uptime
    Optional. The length of time that the managed object has been in this state.
    @TeaGetStatus
    AgentObjectStatus getStatus(@KeyParam final String key) {
        AgentObjectStatus result = new AgentObjectStatus();
        ...
        return result;
        }