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
-
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);
-
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);
-
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);
-
(Optional) To disable the default search capability of an agent registered in the server, use the method
disableIndex() on the server instance.
server.disableIndex();
-
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();
Copyright © Cloud Software Group, Inc. All Rights Reserved.