com.ls.lars.communication
Interface ICommunication

All Known Subinterfaces:
IToLars

public interface ICommunication

This interface is required to use the communication of an Agent from a utility class (e.g. an Bean which is used in an Workflow etc.)

Version:
$Revision: 1.15 $
Author:
Last modified by $Author: OHittmeyer $

Field Summary
static String AUTHENTICATION_PASSWORD
          Constant for setting the password in JSecureSocketMessenger's authentication mechanism
Value is set to "connectionAuthenticationPassword"
static String AUTHENTICATION_USER
          Constant for setting the user in JSecureSocketMessenger's authentication mechanism
Value is set to "connectionAuthenticationUser"
static String COMPRESSION_AUTO_COMPRESSION
          Constant for setting/getting whether or not automatic compression shall be used for socket communication
Value is set to "connectionAutoCompression"
static String COMPRESSION_AUTO_COMPRESSION_START_SIZE
          Constant for setting/getting the start size being used for socket communication (if auto compression is activated)
Value is set to "connectionAutoCompressionStartSize"
static String COMPRESSION_LEVEL
          Constant for setting/getting the compression level being used for socket communication
Value is set to "connectionCompressionLevel"
static String COMPRESSION_TYPE
          Constant for setting/getting the compression type being used for socket communication
Value is set to "connectionCompressionType"
static String COMPRESSION_ZIP_ENTRY_NAME
          Constant for setting/getting the compression zip entry name being used for socket communication
Value is set to "connectionZipEntryName"
static String[] CONNECTION_TYPE
          Collection of all connection types
Values are set to "rmi", "socket", "jsocket", "jsecuresocket", "http", "jms" (in that order)
static String HOST_ID
          Constant for setting/getting the hostId for setting up a connection
Value is set to "connectionHostId"
static String HOST_IP
          Constant for setting/getting the hostIp for setting up a connection
Value is set to "connectionHostIp"
static String HOST_PORT
          Constant for setting/getting the hostPort for setting up a connection
Value is set to "connectionHostPort"
static String HTTP
          Constant indicating the http connection type This is used to set the communication protocol to HTTP
Value is set to "http"
static String J_SECURE_SOCKET
          Constant indicating the jsecuresocket connection type This is used to set the communication protocol to JSecureSocket
Value is set to "jsecuresocket"
static String J_SOCKET
          Constant indicating the jsocket connection type This is used to set the communication protocol to JSocket
Value is set to "jsocket"
static String JMS
          Constant indicating the jms connection type This is used to set the communication protocol to JMS
Value is set to "jms"
static String JMS_INITIAL_CONTEXT_FACTORY
          Constant for setting/getting the initial context factory for JMS communication
Value is set to "java.naming.factory.initial"
static String JMS_JMSMESSENGER_APPLICATION_LOCATION
          Constant for JMSMessenger to indicate whether it is used on LARS server side or client side
Value is set to "serverSideUsage"
static String JMS_PROVIDER_URL
          Constant for setting/getting the url of the JMS provider for JMS communication
Value is set to "java.naming.provider.url"
static String JMS_RECEIVING_QUEUE_NAME
          Constant for JMS queue connection - for receiving JMS message from JMS Server
Value is set to "receivingQueueName
static String JMS_SECURITY_CREDENTIALS
          Constant for setting/getting the security credentials for JMS communication
Value is set to "java.naming.security.credentials"
static String JMS_SECURITY_PRINCIPAL
          Constant for setting/getting the security principal for JMS communication
Value is set to "java.naming.security.principal"
static String JMS_SENDING_QUEUE_NAME
          Constant for JMS queue connection - for sending JMS message to JMS Server
Value is set to "sendingQueueName"
static String MAXIMUM_MESSAGE_LENGTH
          Constant for setting/getting the maximum message length being used for socket communication
Value is set to "connectionMaximumMessageLength"
static String PROTOCOL
          Constant for setting/getting the connection type for setting up a connection
Value is set to "connectionProtocol"
static String RMI
          Constant indicating the RMI connection type This is used to set the communication protocol to RMI
Value is set to "rmi"
static String SOCKET
          Constant indicating the socket connection type This is used to set the communication protocol to Socket
Value is set to "socket"
static String TIMEOUT
          Constant for setting/getting the timeout for waiting on incoming messages
Value is set to "connectionTimeout"
static String USE_OUTBOX
          Constant for setting/getting whether or not the messenger's outbox shall be used for remote communication
Value is set to "connectionUseOutbox"
 
Method Summary
 void forwardMessage(Message message, List forwardReceivers)
          Forwards a message by creating a shallow copy and then exchanging the receiver in the copy.
 void forwardMessage(Message message, String forwardReceiver)
          Forwards a message by creating a shallow copy and then exchanging the receiver in the copy.
 String getAgentName()
          Returns the agent name.
 void sendMessage(Message message)
          sends a message and returns immediately
 Message sendSynchronousRequest(Message message)
          Sends a message and waits for an answer for a predefined timeout
 Message sendSynchronousRequest(Message message, long timeout)
          Sends a message and waits answer in time which user defines in parameters.
 

Field Detail

RMI

public static final String RMI
Constant indicating the RMI connection type This is used to set the communication protocol to RMI
Value is set to "rmi"

SOCKET

public static final String SOCKET
Constant indicating the socket connection type This is used to set the communication protocol to Socket
Value is set to "socket"

J_SOCKET

public static final String J_SOCKET
Constant indicating the jsocket connection type This is used to set the communication protocol to JSocket
Value is set to "jsocket"

J_SECURE_SOCKET

public static final String J_SECURE_SOCKET
Constant indicating the jsecuresocket connection type This is used to set the communication protocol to JSecureSocket
Value is set to "jsecuresocket"

HTTP

public static final String HTTP
Constant indicating the http connection type This is used to set the communication protocol to HTTP
Value is set to "http"

JMS

public static final String JMS
Constant indicating the jms connection type This is used to set the communication protocol to JMS
Value is set to "jms"

JMS_PROVIDER_URL

public static final String JMS_PROVIDER_URL
Constant for setting/getting the url of the JMS provider for JMS communication
Value is set to "java.naming.provider.url"

JMS_INITIAL_CONTEXT_FACTORY

public static final String JMS_INITIAL_CONTEXT_FACTORY
Constant for setting/getting the initial context factory for JMS communication
Value is set to "java.naming.factory.initial"

JMS_SECURITY_PRINCIPAL

public static final String JMS_SECURITY_PRINCIPAL
Constant for setting/getting the security principal for JMS communication
Value is set to "java.naming.security.principal"

JMS_SECURITY_CREDENTIALS

public static final String JMS_SECURITY_CREDENTIALS
Constant for setting/getting the security credentials for JMS communication
Value is set to "java.naming.security.credentials"

JMS_SENDING_QUEUE_NAME

public static final String JMS_SENDING_QUEUE_NAME
Constant for JMS queue connection - for sending JMS message to JMS Server
Value is set to "sendingQueueName"

JMS_RECEIVING_QUEUE_NAME

public static final String JMS_RECEIVING_QUEUE_NAME
Constant for JMS queue connection - for receiving JMS message from JMS Server
Value is set to "receivingQueueName

JMS_JMSMESSENGER_APPLICATION_LOCATION

public static final String JMS_JMSMESSENGER_APPLICATION_LOCATION
Constant for JMSMessenger to indicate whether it is used on LARS server side or client side
Value is set to "serverSideUsage"

HOST_ID

public static final String HOST_ID
Constant for setting/getting the hostId for setting up a connection
Value is set to "connectionHostId"

HOST_IP

public static final String HOST_IP
Constant for setting/getting the hostIp for setting up a connection
Value is set to "connectionHostIp"

HOST_PORT

public static final String HOST_PORT
Constant for setting/getting the hostPort for setting up a connection
Value is set to "connectionHostPort"

PROTOCOL

public static final String PROTOCOL
Constant for setting/getting the connection type for setting up a connection
Value is set to "connectionProtocol"

TIMEOUT

public static final String TIMEOUT
Constant for setting/getting the timeout for waiting on incoming messages
Value is set to "connectionTimeout"

AUTHENTICATION_USER

public static final String AUTHENTICATION_USER
Constant for setting the user in JSecureSocketMessenger's authentication mechanism
Value is set to "connectionAuthenticationUser"

AUTHENTICATION_PASSWORD

public static final String AUTHENTICATION_PASSWORD
Constant for setting the password in JSecureSocketMessenger's authentication mechanism
Value is set to "connectionAuthenticationPassword"

COMPRESSION_TYPE

public static final String COMPRESSION_TYPE
Constant for setting/getting the compression type being used for socket communication
Value is set to "connectionCompressionType"

COMPRESSION_AUTO_COMPRESSION

public static final String COMPRESSION_AUTO_COMPRESSION
Constant for setting/getting whether or not automatic compression shall be used for socket communication
Value is set to "connectionAutoCompression"

COMPRESSION_AUTO_COMPRESSION_START_SIZE

public static final String COMPRESSION_AUTO_COMPRESSION_START_SIZE
Constant for setting/getting the start size being used for socket communication (if auto compression is activated)
Value is set to "connectionAutoCompressionStartSize"

COMPRESSION_LEVEL

public static final String COMPRESSION_LEVEL
Constant for setting/getting the compression level being used for socket communication
Value is set to "connectionCompressionLevel"

COMPRESSION_ZIP_ENTRY_NAME

public static final String COMPRESSION_ZIP_ENTRY_NAME
Constant for setting/getting the compression zip entry name being used for socket communication
Value is set to "connectionZipEntryName"

MAXIMUM_MESSAGE_LENGTH

public static final String MAXIMUM_MESSAGE_LENGTH
Constant for setting/getting the maximum message length being used for socket communication
Value is set to "connectionMaximumMessageLength"

USE_OUTBOX

public static final String USE_OUTBOX
Constant for setting/getting whether or not the messenger's outbox shall be used for remote communication
Value is set to "connectionUseOutbox"

CONNECTION_TYPE

public static final String[] CONNECTION_TYPE
Collection of all connection types
Values are set to "rmi", "socket", "jsocket", "jsecuresocket", "http", "jms" (in that order)
Method Detail

getAgentName

public String getAgentName()
Returns the agent name. This variable is set after the connection.
Returns:
agentName name of the agent

sendMessage

public void sendMessage(Message message)
sends a message and returns immediately
Parameters:
message - Message to be sent

sendSynchronousRequest

public Message sendSynchronousRequest(Message message)
                               throws TimeoutException
Sends a message and waits for an answer for a predefined timeout
Parameters:
message - Message to be sent
Returns:
message The answer of the message
Throws:
TimeoutException - If the specified timeout is specified

sendSynchronousRequest

public Message sendSynchronousRequest(Message message,
                                      long timeout)
                               throws TimeoutException
Sends a message and waits answer in time which user defines in parameters.
Parameters:
message - Message to be sent
timeout - The waiting time for an answer. Otherwise an exception shall be raised.
Returns:
message The answer of the message
Throws:
TimeoutException - If the specified timeout is specified

forwardMessage

public void forwardMessage(Message message,
                           String forwardReceiver)
Forwards a message by creating a shallow copy and then exchanging the receiver in the copy.
Note: If the given message is not an instance of SingleMessage, it is converted into a SingleMessage. Then the original message type cannot be determined at the forwardReceiver any more.
Note: For performance reasons the message's content is only a shallow copy - if you need to change parts of the message (e.g. the content), make a copy by yourself before calling forwardMessage.
Parameters:
message - message to be forwarded
forwardReceiver - new receiver of the message (the one, to whom the message will be forwarded)

forwardMessage

public void forwardMessage(Message message,
                           List forwardReceivers)
Forwards a message by creating a shallow copy and then exchanging the receiver in the copy.
Note: If the given message is not an instance of MulticastMessage, it is converted into a MulticastMessage. Then the original message type cannot be determined at the forwardReceivers any more.
Note: For performance reasons the message's content is only a shallow copy - if you need to change parts of the message (e.g. the content), make a copy by yourself before calling forwardMessage.
Parameters:
message - message to be forwarded
forwardReceivers - list of new receivers of the message (the ones, to whom the message will be forwarded)