com.ls.lars.communication
Interface IToLars

All Superinterfaces:
ICommunication
All Known Implementing Classes:
CommunicationTemplate

public interface IToLars
extends ICommunication

This interface is required to communicate betweeen the lars system and any agent-like client (e.g. an Applet, a Java Application, etc.).

Version:
$Revision: 1.10 $
Author:
Last modified by $Author: MHeitz $

Fields inherited from interface com.ls.lars.communication.ICommunication
AUTHENTICATION_PASSWORD, AUTHENTICATION_USER, COMPRESSION_AUTO_COMPRESSION, COMPRESSION_AUTO_COMPRESSION_START_SIZE, COMPRESSION_LEVEL, COMPRESSION_TYPE, COMPRESSION_ZIP_ENTRY_NAME, CONNECTION_TYPE, HOST_ID, HOST_IP, HOST_PORT, HTTP, J_SECURE_SOCKET, J_SOCKET, JMS, JMS_INITIAL_CONTEXT_FACTORY, JMS_JMSMESSENGER_APPLICATION_LOCATION, JMS_PROVIDER_URL, JMS_RECEIVING_QUEUE_NAME, JMS_SECURITY_CREDENTIALS, JMS_SECURITY_PRINCIPAL, JMS_SENDING_QUEUE_NAME, MAXIMUM_MESSAGE_LENGTH, PROTOCOL, RMI, SOCKET, TIMEOUT, USE_OUTBOX
 
Method Summary
 void connect()
          Connects to the lars system.
 void disconnect()
          Disconnects from the lars system (if already connected).
 Map getConnectionParameters()
          Gets the connection parameters e.g. compression settings, secure settings, ...
 String getLarsHost()
          Returns the host name of the lars system.
 boolean isConnected()
          Checks if the object(messenger) is connected to the lars system or not.
 void setConnectionParameters(Map connectionParameters)
          Sets the connection parameters e.g. compression settings, secure settings, ...
 void start()
          Starts the thread in the CommmunicationTemplate.
 void waitForConnection()
          Blocks the calling thread, if the current connection status is CommunicationTemplate.STATUS_NOT_CONNECTED.
 void waitForConnection(long timeout)
          Blocks the calling thread as long as the following conditions are both true: timeout time in milliseconds is not expired current connection status is CommunicationTemplate.STATUS_NOT_CONNECTED.
 
Methods inherited from interface com.ls.lars.communication.ICommunication
forwardMessage, forwardMessage, getAgentName, sendMessage, sendSynchronousRequest, sendSynchronousRequest
 

Method Detail

connect

public void connect()
             throws ConnectionException
Connects to the lars system. This method uses the connection parameters, which have to be provided by setConnectionParameters(java.util.Map) before.
Throws:
ConnectionException - if the connection fails

isConnected

public boolean isConnected()
Checks if the object(messenger) is connected to the lars system or not.
Returns:
true, if connected; false return

disconnect

public void disconnect()
Disconnects from the lars system (if already connected). This method closes the connection and assings null to the messenger.

getLarsHost

public String getLarsHost()
Returns the host name of the lars system. This variable is set after the connection.
Returns:
hostName The host name of the lars system

waitForConnection

public void waitForConnection()
                       throws ConnectionException
Blocks the calling thread, if the current connection status is CommunicationTemplate.STATUS_NOT_CONNECTED. The thread blocks as long as the connection status is not changed in a Messenger#connect or Messenger#connect call (by another thread).
Throws:
ConnectionException - if the connection setup fails

waitForConnection

public void waitForConnection(long timeout)
                       throws ConnectionException
Blocks the calling thread as long as the following conditions are both true: If the timeout is zero, then the thread blocks as long as the connection status is not changed in a connection setup inside of a Messenger (then called by another thread).
Parameters:
timeout - time in milliseconds; How long is the calling thread waits until an exception is thrown
Throws:
ConnectionException - if the connection status is CommunicationTemplate.STATUS_NOT_CONNECTED even after the wait() or the connection setup fails

start

public void start()
Starts the thread in the CommmunicationTemplate.

setConnectionParameters

public void setConnectionParameters(Map connectionParameters)
Sets the connection parameters e.g. compression settings, secure settings, ... .
Parameters:
connectionParameters - contains any Map with any parameters

getConnectionParameters

public Map getConnectionParameters()
Gets the connection parameters e.g. compression settings, secure settings, ... .
Returns:
connectionParameters contains any Map with any parameters