T - a sub-class of IClientpublic abstract class ReconfigurableClient<T extends IClient> extends Object implements IClient
IClient.ListenerCommand| Constructor and Description |
|---|
ReconfigurableClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
associateMessageProcessor(AbstractMessageProcessor<T> messageProcessor)
Associates a message processor with this instance.
|
protected abstract void |
configureMessageProcessor(AbstractMessageProcessor<T> messageProcessor)
Configures the message processor.
|
protected abstract T |
createNewMessagingClient(String messageServerIp,
String messageServerUser,
String messageServerPwd,
String factoryName)
Creates a new messaging client and opens a connection with the messaging server.
|
protected abstract T |
getDismissedClient() |
AbstractMessageProcessor<T> |
getMessageProcessor() |
protected T |
getMessagingClient() |
boolean |
hasValidClient() |
protected abstract void |
openConnection(T newMessagingClient)
Configures a newly created client.
|
protected void |
resetInternalClient()
Resets the internal client (sets it to null).
|
void |
switchMessagingClient(String messageServerIp,
String messageServerUser,
String messageServerPwd,
String factoryName)
Changes the internal messaging client.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseConnection, isConnected, listenToTheDm, openConnection, sendMessageToTheDm, setMessageQueue, setParameterspublic void switchMessagingClient(String messageServerIp, String messageServerUser, String messageServerPwd, String factoryName)
messageServerIp - the IP address of the messaging servermessageServerUser - the user name for the messaging servermessageServerPwd - the password for the messaging serverfactoryName - the factory name (see MessagingConstants)protected abstract T createNewMessagingClient(String messageServerIp, String messageServerUser, String messageServerPwd, String factoryName) throws IOException
messageServerIp - the server's IPmessageServerUser - the server's user namemessageServerPwd - the server's passwordfactoryName - the factory name (see MessagingConstants)IOException - if something went wrongprotected abstract void openConnection(T newMessagingClient) throws IOException
For an agent, it consists into listening to messages coming from the DM.
For the DM, it consists in listening to messages coming from various agents.
newMessagingClient - the messaging client to configureIOException - if something went wrongprotected abstract T getDismissedClient()
protected abstract void configureMessageProcessor(AbstractMessageProcessor<T> messageProcessor)
messageProcessor - the message processorpublic void associateMessageProcessor(AbstractMessageProcessor<T> messageProcessor)
The message processor cannot be started before. This method will start it.
This method must be invoked only once.
messageProcessor - the message processorpublic AbstractMessageProcessor<T> getMessageProcessor()
public boolean hasValidClient()
protected T getMessagingClient()
protected void resetInternalClient()
Copyright © 2015. All rights reserved.