
public class SpaceModuleImpl extends Object implements SpaceModule, MessageListener, SharedObjectListener, ServiceListener, Broker
| Constructor and Description |
|---|
SpaceModuleImpl(ModuleContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPeer(SpaceDescriptor spaceDescriptor,
PeerCard newPeer)
This method allows to add a new Peer to the Space.
|
void |
announceNewPeer(SpaceCard spaceCard,
PeerCard peerCard)
This method propagates the event of new PeerAdded to the whole Space
|
void |
configureSpaceChannel()
This method configures the channel used in order to send/receive
Space messages
|
void |
destroySpace(SpaceCard spaceCard)
Destroy a Space
|
void |
dispose()
Routine in order to release resources
|
String |
getBrokerName() |
String |
getDescription() |
String |
getName() |
List<String> |
getPeersAddress()
This method fetches the list of peer address joining to the same
Space
|
String |
getProvider() |
List<SpaceCard> |
getSpaces()
This method fetches a list of Spaces without any filter
|
List<SpaceCard> |
getSpaces(Dictionary<String,String> filters)
This method fetches a list of Spaces according to a filter
|
String |
getVersion() |
void |
handleSendError(ChannelMessage message,
CommunicationConnectorException exception)
Callback for error handling
|
boolean |
init()
This method configures the SpaceModule: -to obtain the reference to
all the DiscoveryConnector present in the fw -to obtain the reference to
the CommunicationModdule -to obtain the reference to the ControlBroker
|
void |
joinSpace(PeerCard spaceCoordinator,
SpaceCard spaceCard)
This method allows to join to an existing Space
|
void |
leaveSpace(PeerCard spaceCoordinator,
SpaceCard spaceCard)
This method allows to leave a Space
|
void |
loadConfigurations(Dictionary configurations) |
void |
messageFromSpace(SpaceMessage message,
PeerCard sender)
This method is called as soon as an SpaceMessage has been received
|
void |
messageReceived(ChannelMessage message)
Callback for the reception of messages
|
void |
newSpace(SpaceCard spaceCard)
This method creates a new Space
|
void |
newSpacesFound(Set<SpaceCard> spaceCards)
Called when a new Space has been found
|
void |
renewSpace(SpaceCard spaceCard)
This method renews the Space
|
void |
requestPeerCard(SpaceDescriptor spaceDescriptor,
String peerAddress)
This method allows to send a request for the PeerCard of the peer with
the specified address
|
void |
requestToLeave(SpaceDescriptor spaceDescriptor)
This method announces to all the peers to leave the space
|
void |
sharedObjectAdded(Object arg0,
Object arg1) |
void |
sharedObjectRemoved(Object arg0) |
void |
spaceLost(SpaceCard spaceCard)
Called when an Space has been destroyed
|
BrokerMessage |
unmarshall(String message)
From String to Broker Message
|
public SpaceModuleImpl(ModuleContext context)
public boolean init()
public List<SpaceCard> getSpaces()
SpaceModulegetSpaces in interface SpaceModulepublic List<SpaceCard> getSpaces(Dictionary<String,String> filters) throws SpaceModuleException
SpaceModulegetSpaces in interface SpaceModulefilters - A set of key, value pairs for filtering the SpacesSpaceModuleExceptionpublic void newSpace(SpaceCard spaceCard) throws SpaceModuleException
SpaceModulenewSpace in interface SpaceModuleSpaceModuleExceptionpublic String getDescription()
getDescription in interface Modulepublic String getProvider()
getProvider in interface Modulepublic String getVersion()
getVersion in interface Modulepublic void loadConfigurations(Dictionary configurations)
loadConfigurations in interface Modulepublic void leaveSpace(PeerCard spaceCoordinator, SpaceCard spaceCard)
SpaceModuleleaveSpace in interface SpaceModulespaceCard - Space Card of the Space to leavepublic void requestToLeave(SpaceDescriptor spaceDescriptor)
SpaceModulerequestToLeave in interface SpaceModulepublic void requestPeerCard(SpaceDescriptor spaceDescriptor, String peerAddress)
SpaceModulerequestPeerCard in interface SpaceModulespaceDescriptor - the Space descriptorpeerAddress - the address of the peerpublic void newSpacesFound(Set<SpaceCard> spaceCards)
ServiceListenernewSpacesFound in interface ServiceListenerpublic void joinSpace(PeerCard spaceCoordinator, SpaceCard spaceCard)
SpaceModulejoinSpace in interface SpaceModulespaceCoordinator - The PeerCard of the Space coordinator to which to sent the
requestspaceCard - The SpaceCard of the space the peer aims to joinpublic void addPeer(SpaceDescriptor spaceDescriptor, PeerCard newPeer)
SpaceModuleaddPeer in interface SpaceModulespaceDescriptor - All the information regarding the Space for the new PeernewPeer - The Peer to add to the Spacepublic void announceNewPeer(SpaceCard spaceCard, PeerCard peerCard)
SpaceModuleannounceNewPeer in interface SpaceModulespaceCard - The Space where to propagate the eventpeerCard - The new peer addedpublic void messageFromSpace(SpaceMessage message, PeerCard sender) throws SpaceModuleException
SpaceModulemessageFromSpace in interface SpaceModuleSpaceModuleExceptionpublic void configureSpaceChannel()
SpaceModuleconfigureSpaceChannel in interface SpaceModulepublic void messageReceived(ChannelMessage message)
MessageListenermessageReceived in interface MessageListenerpublic void handleSendError(ChannelMessage message, CommunicationConnectorException exception) throws SpaceModuleException
MessageListenerhandleSendError in interface MessageListenerSpaceModuleExceptionpublic void destroySpace(SpaceCard spaceCard)
SpaceModuledestroySpace in interface SpaceModulespaceCard - Space to destroypublic void spaceLost(SpaceCard spaceCard)
ServiceListenerspaceLost in interface ServiceListenerspaceCard - Information about the Spacepublic void sharedObjectAdded(Object arg0, Object arg1)
sharedObjectAdded in interface SharedObjectListenerpublic void sharedObjectRemoved(Object arg0)
sharedObjectRemoved in interface SharedObjectListenerpublic String getBrokerName()
getBrokerName in interface Brokerpublic void dispose()
Modulepublic List<String> getPeersAddress()
SpaceModulegetPeersAddress in interface SpaceModulepublic void renewSpace(SpaceCard spaceCard)
SpaceModulerenewSpace in interface SpaceModulepublic BrokerMessage unmarshall(String message)
Brokerunmarshall in interface BrokerCopyright © 2018 universAAL Consortium. All rights reserved.