com.ls.lars.server
Class AgentListener
java.lang.Object
|
+--java.lang.Thread
|
+--com.ls.lars.communication.CommunicationTemplate
|
+--com.ls.lars.server.AgentTemplate
|
+--com.ls.lars.server.AgentListener
- All Implemented Interfaces:
- ICommunication, IToLars, Runnable, Serializable
- Direct Known Subclasses:
- AgentJMSListener, AgentRMIListener, AgentSocketListener
- public abstract class AgentListener
- extends AgentTemplate
This agent is managing a part of the security regarding the client-to-lars- and the inter-lars-communication and
provides for trusted ip addresses, denied agents and the communication port for all inheriting listener agents.
to Class Specification
Incoming Messages:
You can send messages requesting the following services to any agent
inheriting from AgentListener. Input parameters you have to specify
are listed with the messages and must be transmitted using a map.
-----------------------------------------------------------------------
set_port (config file only!)
-----------------------------------------------------------------------
Function: Sets the port number where the agent will listen for
incoming communication requests.
Parameters: port (String)
Responses: none
-----------------------------------------------------------------------
ask_for_connection_parameters
-----------------------------------------------------------------------
Function: Every listener is a service provider for the service
SERVICE_ASK_FOR_CONNECTION_PARAMETERS.
Your can send the listeners an ask_for_connection_parameters.
The listener will reply with the message
response_for_connection_parameters.
Parameters: sender of the message
Responses: message: response_for_connection_paramters with
hashkeys: port (String), ip-address (String)
-----------------------------------------------------------------------
set_outbox (config file only!)
-----------------------------------------------------------------------
Function: Sets the status of the outbox. xml-values
* true: use outbox
* false: do not use outbox
Parameters: status value for outbox (String: true/false)
Responses: none
- Version:
- $Revision: 1.18 $
- Author:
- Last modified by $Author: MFehrenbach $
- See Also:
- Serialized Form
Field Summary |
protected int |
port
the port for the communication |
protected String |
revisionInformation
revision information string, managed by our version control system. |
Fields inherited from class com.ls.lars.server.AgentTemplate |
agentMaxPool, agentMessageRouterName, agentMinPool, defaultServiceAccessPermission, defaultServiceAccessPrivilege, dynamicObjectController, FULL_SERVICE_ACCESS, iXMLHandlerForConfigLoader, localPlatform, maxInvokeStackCounter, NO_SERVICE_ACCESS, RUN_LEVEL_ACTIONS_INITIALIZED, RUN_LEVEL_CONFIG_FILE_INTERPRETED, RUN_LEVEL_CONFIG_FILE_READ, RUN_LEVEL_EMBRYONIC, RUN_LEVEL_INTERPRET_METHODS_REGISTERED, RUN_LEVEL_POOL_INITIALIZED, RUN_LEVEL_RUNNING, RUN_LEVEL_STOPPED, RUN_LEVEL_TERMINATED |
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 |
Constructor Summary |
AgentListener(String agentName,
String homePlatform,
List agentConfigFiles)
Constructor with the agentName, its homePlatform and a List
containing the names of the configuration file(s) of the new agent.
|
Methods inherited from class com.ls.lars.server.AgentTemplate |
executeLifeCycle, executeWhileRunning, getAgentRevisionInformation, getIPKIHandler, getOwnPublicKeyCertificate, initializeAction, interpret, interpretAccessDenied, interpretAgentConnected, interpretCheckRegisteredServices, interpretCloseConnection, interpretDefineObject, interpretDeliveryFailed, interpretGetRevisionInformation, interpretInterpretationSuccessful, interpretLoadObject, interpretLogInbox, interpretMonitorLookup, interpretNotifiedAgent, interpretNotifyCanceled, interpretNotifyNotCanceled, interpretNotUnderstood, interpretPing, interpretRegisterService, interpretSendAsConfigured, interpretSetAccessPrivileges, interpretSetForeignPublicKeyCertificate, interpretSetLog, interpretSetOwnPublicKeyCertificate, interpretSetPkiEnvironment, interpretSetPkiMessages, interpretSetPrivateKey, interpretSetRunLevel, interpretSignatureNotValid, interpretStartupConstraint, loadConfigFile, performDefaultBehavior, reconnectAfterMigration, registerInterpretMethods, registerInterpretMethods, registerInterpretMethods, reInitializeAction, setAgentMessageRouterName, setIXMLHandler, setLocalPlatform, setPKIMessage, terminateAction, toString |
Methods inherited from class com.ls.lars.communication.CommunicationTemplate |
addConnectionParameter, checkSendSystemReply, connect, createReplyId, disconnect, disconnectForMigration, finalize, forwardMessage, forwardMessage, getAgentName, getConnectionParameters, getInboxSize, getLarsHost, getNumberOfProcessedMessages, getNumberOfProcessedMessagesPerMinute, getStartTime, isConnected, logInbox, receiveBlockedMessage, receiveBlockedMessage, run, sendMessage, sendSynchronousRequest, sendSynchronousRequest, setConnectionParameters, setLog, setMeantimeBetweenConnectionCheck, waitForConnection, waitForConnection |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from interface com.ls.lars.communication.IToLars |
start |
revisionInformation
protected String revisionInformation
- revision information string, managed by our version control system.
port
protected int port
- the port for the communication
AgentListener
public AgentListener(String agentName,
String homePlatform,
List agentConfigFiles)
- Constructor with the agentName, its homePlatform and a
List
containing the names of the configuration file(s) of the new agent.
It sets the connection port by calling setDefaultPort()
and initializes the list of trusted IP
addresses, that are allowed to contact this listener (note: any IP address is trusted until a security
config file contains special trusted IP addresses) and the list of agents, that are not allowed to contact
this listener (note: by default any agent is allowed to contact).
- Parameters:
agentName
- name of the agent (example: xyz )homePlatform
- name of the homePlatform where the agent was created (example: 195.52.158.233/lars)agentConfigFiles
- the config file(s), which should be read by the agent when it starts up
initializeMessages
public void initializeMessages()
- Calls super.initializeMessages(), calls
ILogger.logThreadName(boolean)
and afterwards registers AgentListener
as a service provider for the service "ask_for_connection_parameters".
- Overrides:
initializeMessages
in class AgentTemplate
getRevisionInformation
protected String getRevisionInformation()
- gets the revision information of this agent
- Overrides:
getRevisionInformation
in class AgentTemplate
- Returns:
- the revision information
setDefaultPort
protected abstract void setDefaultPort()
- Sets the default port of the communication channel. This method is called in the AgentListener's constructor.
interpretSetPort
protected boolean interpretSetPort(Message currentMessage)
- Sets the port of the communication channel. For security reasons, the sender of the message is checked: If
the message is not read from a config file, its content is ignored and a warning is written to the log file.
- Parameters:
currentMessage
- message which contains the port for the communication channel as content- Returns:
- true, if setting the port was successful; false else
interpretAskForConnectionParameters
protected boolean interpretAskForConnectionParameters(Message currentMessage)
- Another agent can ask the listener for the connection parameters. It will send a reply with a content
containing:
- service: response_for_connection_paramters
- hashkeys: port (String), ip-address (String)
to the asker. Usually the ip address is the local ip address. The ip address is
not local, if the rmiregistry is not running on the local machine.
- Parameters:
currentMessage
- message which is empty- Returns:
- true, if reply message successfully send; false else
interpretSetOutbox
protected boolean interpretSetOutbox(Message currentMessage)
- Sets the usage of the oubox.
- Parameters:
currentMessage
- message which contains the status of the outbox- Returns:
- true, if setting the port was successful; false else