Open topic with navigation

TIBCO® Enterprise Administrator 2.4.2

# How to Get Shared TeaObjects

Any TeaObjects that are shared by an agent can be used by other agents that are registered with the same TIBCO Enterprise Administrator server. The objects are returned in JSON format.

To get a single shared TeaObject use the getObject() method as shown in the example below:

    @TeaOperation(name = "getJohn", description = "getJohn")
    public String getJohn() throws IOException {
      //teaAgentServer is an instance of com.tibco.tea.agent.server.TeaAgentServer or
        com.tibco.tea.agent.server.TeaAgentServlet
    final TeaPersistence persistence = teaAgentServer.getPersistence();
      // We query the method getObject(String agentTypeName, String agentTypeVersion, String objectTypeName,
      //   String key);
      // That returns a org.json.JSONObject, in this case the Json Representation of Person with key John
    final JSONObject object = persistence.getObject("agentTypeNameHere", "Person", "john");
    return object.toString();
    }

Below is an example of how to get all shared TeaObjects for a specific TeaObjectType:

    @TeaOperation(name = "getAllPersons", description = "getAllPersons")
    public String getAllPersons() throws IOException {
    //teaAgentServer is an instance of com.tibco.tea.agent.server.TeaAgentServer or
      com.tibco.tea.agent.server.TeaAgentServlet
    final TeaPersistence persistence = teaAgentServer.getPersistence();
    final Map<String, JSONObject> allPersons = persistence.getObjects("agentTypeNameHere", "Person");
    return Joiner.on(",").join(allPersons.values());
    }

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Enterprise Administrator

Copyright © 1996-2025. Cloud Software Group, Inc. All Rights Reserved.