tibco.tea Module
The tibco.tea module gives you access to the members and functions that can be used to access the TIBCO Enterprise Administrator server, and all products that have agents registered with the server. With the help of this module, you can perform just about any activity that can be performed using the Shell commands or the Web UI.
The tibco.tea Module
import tibco.teaYou can now create an instance of the Enterprise Administrator by using the following statement:
tea=tibco.tea.EnterpriseAdministrator()The EnterpriseAdministrator() constructor can also take the following parameters:
The object, tea, in this example refers to an instance of EnterpriseAdministrator. You can use any name for the object, but this example uses tea. This is the root object of the entire object hierarchy. You need this object to perform any activity on TIBCO Enterprise Administrator. After creating this object, you can use this to register agents, create users, view machines, and so on.
The Object Hierarchy
Using the tea object, created earlier in the example, you can get more information on the object hierarchy. Any reference to the tea object is a dictionary, such as tea.products, tea.agents and so on. Standard functions such as keys(), items(), and values() are available on all reference dictionaries. The standard help() function can be applied to any expression resolving to a TIBCO Enterprise Administrator object, to discover the functions available on that class of object.
- tea.products
-
tea.products is a dictionary with a collection of (name,value) pairs. The
tea.products command is used to list the products registered with the server that support Python binding. The following is an example of the product list generated by the command:
>>> tea.products {'tomcat': <tomcat_7_0_42_tomcat object at 0x00000000037E59E8>, 'HelloWorldTopLevelType': <HelloWorldAgent_1_0_HelloWorldTopLevelType object at 0x00000000037E85F8>} >>>
The output shows Tomcat as the product registered. The command help(tea.products['tomcat']) lists the functions supported by the Tomcat product.>>> help(tea.products['tomcat']) Help on tomcat_7_0_42_tomcat in module builtins object: please update the help snippet as follows - Help on tomcat_7_0_42_tomcat in module builtins object: tomcat = class tomcat_7_0_42_tomcat(tibco.tea.TeaObject) | Tomcat Tea Agent | | Method resolution order: | tomcat_7_0_42_tomcat | tibco.tea.TeaObject | object | | Methods defined here: | | cleanup(self, agentId=None) | Remove all server instances | | Parameters: | agentId -- Identifier for the agent (default None) | | createserver(self, name, port, ajpport=-1, shutdownport=-1, agentId=None) | Create a tomcat server instance | | Parameters: | name -- Name of the tomcat instance | port -- Port for HTTP Connector | ajpport -- Port for AJP Connector. If value is -1, agent will randomly pick a port. (default -1) | shutdownport -- Port for shutting down tomcat. If value is -1, agent will randomly pick a port. (default -1) | agentId -- Identifier for the agent (default None) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | type_descr = {'agentTypeId': 'tomcat:7.0.42', 'concept': 'TOP_LEVEL', ... | | ---------------------------------------------------------------------- | Methods inherited from tibco.tea.TeaObject: | | __init__(self, tea, obj_descr) | | __repr__(self) | | __str__(self) | | refresh_(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from tibco.tea.TeaObject: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined)
- tea.products.keys()
- You can use
tea.products.keys() to get a list of names of the products registered with the server.
>>> tea.products.keys() dict_keys(['HelloWorldTopLevelType', 'tomcat'])
- tea.agents
- You can use tea.agents to access the agents registered with the server. For example, tea.agents.agents.registerAgent(name,url,description) helps you register an agent with the server.tea.agents offers the following functions:
- tea.users
- You can use tea.users to create users, assign roles, groups to users. For example, you can create users using the tea.users.createUser(self, name, password, groups, roles) command.
- tea.machines
- You can use tea.machines to get more information about the machines on which the agents are running.
- tea._unsupported_products
- tea._unsupported_products is used to list the products registered with the server that do not support Python binding. By default, the APIs exposed by the TIBCO Enterprise Administrator server do not support Python binding.
- tea.unsupported_product(name)
- You can check whether or not a product supports Python binding by using the function, tea.unsupported_product(name). Pass the product name as the parameter to the function. On finding the product in the tea._unsupported_products dictionary, the function returns the object of the product type along with a message that the product is unsupported. If the product is not found in the tea._unsupported_products dictionary, the function returns None along with a message that the product supports Python binding. If the product name is not found in tea._unsupported_products or in tea.products, the function returns None along with a message that the product name is wrong.
The refresh_() Function
- After registering the first agent, the products list gets refreshed automatically, but after registering the second agent, the products list does not refresh. Remember to explicitly refresh the products list of the second agent.
- After unregistering the agent, the agents dictionary must be refreshed explicitly.
- Recently updated agents, solutions, products, and dictionaries should be explicitly refreshed before accessing their members, keys, items, and other details.