public class CommunicationModuleImpl extends Object implements CommunicationModule, ConfigurableCommunicationModule, SharedObjectListener, RejectedExecutionHandler
Constructor and Description |
---|
CommunicationModuleImpl(ModuleContext context) |
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(MessageListener listener,
String channelName)
Method used by the brokerage layer to add message listener
|
void |
configureChannels(List<ChannelDescriptor> channels,
String peerName)
This method allows to configure the CommunicationModule with a List of
channels
|
void |
dispose()
Routine in order to release resources
|
void |
dispose(List<ChannelDescriptor> channels)
This method allows to reset the Communication module
|
String |
getDescription() |
List<String> |
getGroupMembers(String group)
* This method fetches the set of members that join to the group
|
MessageListener |
getListenerByNameAndType(String name,
Class clz)
Returns the first MessageListener that is an instance of the given clz
and has been registered under the given name.
|
String |
getName() |
String |
getProvider() |
String |
getVersion() |
boolean |
hasChannel(String channelName)
Determines whether a channel with the specified name exists.
|
boolean |
init()
This method configures the CommunicationModule: -to obtain the reference
to all the CommunicationConnector present in the fw
|
void |
loadConfigurations(Dictionary configurations) |
void |
messageReceived(ChannelMessage channelMessage)
This method is invoked by the Connector layer as soon as a message
arrives.
|
void |
rejectedExecution(Runnable r,
ThreadPoolExecutor executor) |
void |
removeMessageListener(MessageListener listener,
String channelName)
Method used by the upper layer to un-register themselves as message
listener
|
void |
send(ChannelMessage message,
MessageListener listener,
PeerCard receiver)
Unicast
|
void |
send(ChannelMessage message,
PeerCard receiver)
Unicast
|
void |
sendAll(ChannelMessage message)
Broadcast
|
void |
sendAll(ChannelMessage message,
List<PeerCard> recipients)
Multicast
|
void |
sendAll(ChannelMessage message,
List<PeerCard> receivers,
MessageListener listener)
Multicast
|
void |
sendAll(ChannelMessage message,
MessageListener listener)
Broadcast with message listener
|
void |
sharedObjectAdded(Object sharedObj,
Object removeHook) |
void |
sharedObjectRemoved(Object removeHook) |
public CommunicationModuleImpl(ModuleContext context)
public boolean init()
public void dispose(List<ChannelDescriptor> channels)
ConfigurableCommunicationModule
dispose
in interface ConfigurableCommunicationModule
public void dispose()
Module
public void messageReceived(ChannelMessage channelMessage)
CommunicationModule
messageReceived
in interface CommunicationModule
public void addMessageListener(MessageListener listener, String channelName)
CommunicationModule
addMessageListener
in interface CommunicationModule
public MessageListener getListenerByNameAndType(String name, Class clz)
CommunicationModule
getListenerByNameAndType
in interface CommunicationModule
public void removeMessageListener(MessageListener listener, String channelName)
CommunicationModule
removeMessageListener
in interface CommunicationModule
public String getDescription()
getDescription
in interface Module
public String getProvider()
getProvider
in interface Module
public String getVersion()
getVersion
in interface Module
public void loadConfigurations(Dictionary configurations)
loadConfigurations
in interface Module
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor)
rejectedExecution
in interface RejectedExecutionHandler
public void configureChannels(List<ChannelDescriptor> channels, String peerName)
ConfigurableCommunicationModule
configureChannels
in interface ConfigurableCommunicationModule
public void send(ChannelMessage message, MessageListener listener, PeerCard receiver)
send
in interface CommunicationModule
listener
- that will manage message failurespublic void send(ChannelMessage message, PeerCard receiver)
send
in interface CommunicationModule
public void sendAll(ChannelMessage message, List<PeerCard> receivers, MessageListener listener)
sendAll
in interface CommunicationModule
message
- Message to sendreceivers
- A list of receiverslistener
- The listener manages failures during the message sendpublic void sendAll(ChannelMessage message, List<PeerCard> recipients)
sendAll
in interface CommunicationModule
public void sendAll(ChannelMessage message)
sendAll
in interface CommunicationModule
public void sendAll(ChannelMessage message, MessageListener listener)
sendAll
in interface CommunicationModule
listener
- The listener that will manage failures during the message sendpublic void sharedObjectAdded(Object sharedObj, Object removeHook)
sharedObjectAdded
in interface SharedObjectListener
public void sharedObjectRemoved(Object removeHook)
sharedObjectRemoved
in interface SharedObjectListener
public List<String> getGroupMembers(String group)
ConfigurableCommunicationModule
getGroupMembers
in interface ConfigurableCommunicationModule
public boolean hasChannel(String channelName)
CommunicationModule
hasChannel
in interface CommunicationModule
channelName
- name of the channel.Copyright © 2018 universAAL Consortium. All rights reserved.