Summary: This section presents the design and use of the Agent Application Block.
The Agent Application Block demonstrates the use of the com.genesyslab.ail.Agent, com.genesyslab.ail.Place, com.genesyslab.ail.event.AgentListener interfaces.
Figure 4.1. Class Diagram of the Agent Application Block
Table 4.1 describes each of the components in Figure 4.1.
Table 4.1: Agent Application Block Component Description
Class Name |
Description |
AgentHandler |
Manages agent actions. |
AgentListenerAdapter |
Monitors agent events. |
The Agent Application Block can be used independently from the other Agent Interaction Application Blocks.
To initialize this application block, you need to connect using the com.genesyslab.ail.AilLoader class, so that you retrieve the AilFactory required to initialize your AgentLoader instance.
AilLoader al = new AilLoader("myPrimaryHostname",
0000, "myBackup_hostname", 0000, "Username", "Password",
"ApplicationName", AilLoader.ApplicationType.SERVER, 0000, 3,
5);
AilFactory af = al.getAilFactory();
mAgentHdl = new AgentHandler(af);
mAgentHdl.init("Place11", "Agent11");
To perform agent actions, you simply make calls to the corresponding
method of your AgentHandler
instance. The following code
snippet makes the agent in ready status on the chat media.
mAgentHdl.ready("chat","reason",
"description for this ready action");
To see the messages displayed by the AgentListenerAdapter
handler, add this listener to the Agent
instance associated
with your AgentHandler
instance, as shown here:
Agent anAg = mAgentHdl.getAgent();
anAg.addAgentListener(new AgentHandler.AgentListenerAdapter() );