Running TIBCO Enterprise Administrator Agent Library in the Server mode

In the server mode, the TIBCO Enterprise Administrator Agent runs as a standalone process. The TIBCO Enterprise Administrator Agent Library comes bundled with the Jetty server which will be used for serving the agent service endpoints.

Procedure

  1. To configure the TIBCO Enterprise Administrator Agent library to run in server mode, instantiate an object of the class com.tibco.tea.agent.server.TeaAgentServer. There are a few overloaded constructors available to instantiate the TeaAgentServer. The one used in this example takes the following arguments:
    Option Description
    name Name of the agent
    version Version of the agent
    agentinfo Description for the agent
    hostname Hostname for the jetty connector
    port Port for the jetty connector
    context-path Path for ServletContext
    enable-metrics Enables metrics for the TIBCO Enterprise Administrator SDK Agent Library
    TeaAgentServer server = new TeaAgentServer("HelloWorldAgent", "1.1", "Hello World Agent", 1234, "/helloworldagent", true);
  2. To register Object Types with the TIBCO Enterprise Administrator Agent library, use any of the following: com.tibco.tea.agent.server.TeaAgentServer.registerInstance() and com.tibco.tea.agent.server.TeaAgentServer.registerInstances(). The registerInstance() method takes an instance of a TeaAgent as a parameter. The registerInstances() method takes a varargs parameter that receives a variable number of Object Types.
    server.registerInstance(new HelloWorldAgent());
    server.registerInstances(arg0);
  3. You can configure the TIBCO Enterprise Administrator Agent library to customize the content specific to your requirements. The content includes HTML, CSS, javascript, images, and so on. Use com.tibco.tea.agent.server.TeaAgentServer.registerResourceLocation() to register the resource location that has these files.
    server.registerResourceLocation(file);
  4. (Optional) To disable the default search capability of an agent registered in the server, use the method disableIndex() on the server instance.
    server.disableIndex();
  5. After the TIBCO Enterprise Administrator agent server has been configured, use com.tibco.tea.agent.server.TeaAgentServer.start() to initiate and start the TIBCO Enterprise Administrator agent server.
    server.start();

Starting the sample: HelloWorldAgent

TeaAgentServer server = new TeaAgentServer("HelloWorldAgent", "1.1", "Hello World Agent", 1234, "/helloworldagent", true);
server.registerInstance(new HelloWorldAgent());
server.registerInstances(arg0)
server.registerResourceLocation(file);
server.start();