com.almende.eve.transport.xmpp
Class AgentConnection

java.lang.Object
  extended by com.almende.eve.transport.xmpp.AgentConnection

public class AgentConnection
extends Object


Constructor Summary
AgentConnection(AgentFactory agentFactory)
           
 
Method Summary
 void connect(String agentId, String host, Integer port, String serviceName, String username, String password, String resource)
          Login and connect the agent to the messaging service
 void disconnect()
          Disconnect the agent from the messaging service
 String getAgentId()
          Get the id of the agent linked to this connection
 String getResource()
          Get the resource of the connection.
 String getUsername()
          Get the username of the connection (without host)
 boolean isConnected()
          Check whether the agent is connected to the messaging service
 void send(String username, JSONRequest request, AsyncCallback<JSONResponse> callback)
          Send a message to an other agent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentConnection

public AgentConnection(AgentFactory agentFactory)
Method Detail

getAgentId

public String getAgentId()
Get the id of the agent linked to this connection

Returns:
agentId

getUsername

public String getUsername()
Get the username of the connection (without host)

Returns:
username

getResource

public String getResource()
Get the resource of the connection. Returns null if no resource is set

Returns:
resource

connect

public void connect(String agentId,
                    String host,
                    Integer port,
                    String serviceName,
                    String username,
                    String password,
                    String resource)
             throws Exception
Login and connect the agent to the messaging service

Parameters:
agentId -
host -
port -
serviceName -
username -
password -
resource - optional
Throws:
Exception

disconnect

public void disconnect()
Disconnect the agent from the messaging service


isConnected

public boolean isConnected()
Check whether the agent is connected to the messaging service

Returns:
connected

send

public void send(String username,
                 JSONRequest request,
                 AsyncCallback<JSONResponse> callback)
          throws Exception
Send a message to an other agent

Parameters:
username -
message -
Throws:
Exception


Copyright © 2013 Almende BV. All Rights Reserved.