org.universAAL.middleware.modules.aalspace
Class AALSpaceModuleImpl

Package class diagram package AALSpaceModuleImpl
java.lang.Object
  extended by org.universAAL.middleware.modules.aalspace.AALSpaceModuleImpl
All Implemented Interfaces:
Broker, ServiceListener, SharedObjectListener, AALSpaceModule, MessageListener, Module

public class AALSpaceModuleImpl
extends Object
implements AALSpaceModule, MessageListener, SharedObjectListener, ServiceListener, Broker

Implementation of the AALSpaceModule

Author:
Michele Girolami

Constructor Summary
AALSpaceModuleImpl(ModuleContext context)
           
 
Method Summary
 void aalSpaceLost(AALSpaceCard spaceCard)
          Called when an AALSpace has been destroyed
 void addPeer(AALSpaceDescriptor spaceDescriptor, PeerCard newPeer)
          This method allows to add a new Peer to the AALSpace.
 void announceNewPeer(AALSpaceCard spaceCard, PeerCard peerCard)
          This method propagates the event of new PeerAdded to the whole AALSpace
 void configureAALSpaceChannel(String group)
          This method configures the channel used in order to send/receive AAL Space messages
 void destroyAALSpace(AALSpaceCard spaceCard)
          Destroy an AAL Space
 void dispose()
          Routine in order to release resources
 List<AALSpaceCard> getAALSpaces()
          This method fetches a list of AALSpaces without any filter
 List<AALSpaceCard> getAALSpaces(Dictionary<String,String> filters)
          This method fetches a list of AALSpaces according to a filter
 String getBrokerName()
           
 String getDescription()
           
 String getName()
           
 List<String> getPeersAddress()
          This method fetches the list of peer address joining to the same AAL Space
 String getProvider()
           
 String getVersion()
           
 void handleSendError(ChannelMessage message, CommunicationConnectorException exception)
          Callback for error handling
 boolean init()
          This method configures the AALSpaceModule: -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 joinAALSpace(PeerCard spaceCoordinator, AALSpaceCard spaceCard)
          This method allows to join to an existing AALSpace
 void leaveAALSpace(PeerCard spaceCoordinator, AALSpaceCard spaceCard)
          This method allows to leave an AALSpace
 void loadConfigurations(Dictionary configurations)
           
 void messageFromSpace(AALSpaceMessage message, PeerCard sender)
          This method is called as soon as an AALSpaceMessage has been received
 void messageReceived(ChannelMessage message)
          Callback for the reception of messages
 void newAALSpace(AALSpaceCard aalSpaceCard)
          This method creates a new AALSpace
 void newAALSpacesFound(Set<AALSpaceCard> spaceCards)
          Called when a new AALSpace has been found
 void renewAALSpace(AALSpaceCard spaceCard)
          This method renews the AALSpace
 void requestPeerCard(AALSpaceDescriptor spaceDescriptor, String peerAddress)
          This method allows to send a request for the PeerCard of the peer with the specified address
 void requestToLeave(AALSpaceDescriptor spaceDescriptor)
          This method announces to all the peers to leave the AAL space
 void sharedObjectAdded(Object arg0, Object arg1)
           
 void sharedObjectRemoved(Object arg0)
           
 BrokerMessage unmarshall(String message)
          From String to Broker Message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AALSpaceModuleImpl

public AALSpaceModuleImpl(ModuleContext context)
Method Detail

init

public boolean init()
This method configures the AALSpaceModule: -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

Specified by:
init in interface Broker
Specified by:
init in interface Module
Returns:
true if initialized with the connectors and the module, false otherwise

getAALSpaces

public List<AALSpaceCard> getAALSpaces()
Description copied from interface: AALSpaceModule
This method fetches a list of AALSpaces without any filter

Specified by:
getAALSpaces in interface AALSpaceModule
Returns:
List of discovered AAL Spaces

getAALSpaces

public List<AALSpaceCard> getAALSpaces(Dictionary<String,String> filters)
                                throws AALSpaceModuleException
Description copied from interface: AALSpaceModule
This method fetches a list of AALSpaces according to a filter

Specified by:
getAALSpaces in interface AALSpaceModule
Parameters:
filters - A set of key, value pairs for filtering the AAL Spaces
Returns:
Throws:
AALSpaceModuleException

newAALSpace

public void newAALSpace(AALSpaceCard aalSpaceCard)
                 throws AALSpaceModuleException
Description copied from interface: AALSpaceModule
This method creates a new AALSpace

Specified by:
newAALSpace in interface AALSpaceModule
Throws:
AALSpaceModuleException

getDescription

public String getDescription()
Specified by:
getDescription in interface Module

getProvider

public String getProvider()
Specified by:
getProvider in interface Module

getVersion

public String getVersion()
Specified by:
getVersion in interface Module

getName

public String getName()
Specified by:
getName in interface Module

loadConfigurations

public void loadConfigurations(Dictionary configurations)
Specified by:
loadConfigurations in interface Module

leaveAALSpace

public void leaveAALSpace(PeerCard spaceCoordinator,
                          AALSpaceCard spaceCard)
Description copied from interface: AALSpaceModule
This method allows to leave an AALSpace

Specified by:
leaveAALSpace in interface AALSpaceModule

requestToLeave

public void requestToLeave(AALSpaceDescriptor spaceDescriptor)
Description copied from interface: AALSpaceModule
This method announces to all the peers to leave the AAL space

Specified by:
requestToLeave in interface AALSpaceModule

requestPeerCard

public void requestPeerCard(AALSpaceDescriptor spaceDescriptor,
                            String peerAddress)
Description copied from interface: AALSpaceModule
This method allows to send a request for the PeerCard of the peer with the specified address

Specified by:
requestPeerCard in interface AALSpaceModule
Parameters:
spaceDescriptor - the AAL Space descriptor
peerAddress - the address of the peer

newAALSpacesFound

public void newAALSpacesFound(Set<AALSpaceCard> spaceCards)
Description copied from interface: ServiceListener
Called when a new AALSpace has been found

Specified by:
newAALSpacesFound in interface ServiceListener

joinAALSpace

public void joinAALSpace(PeerCard spaceCoordinator,
                         AALSpaceCard spaceCard)
Description copied from interface: AALSpaceModule
This method allows to join to an existing AALSpace

Specified by:
joinAALSpace in interface AALSpaceModule
Parameters:
spaceCoordinator - The PeerCard of the AALSpace coordinator to which to sent the request

addPeer

public void addPeer(AALSpaceDescriptor spaceDescriptor,
                    PeerCard newPeer)
Description copied from interface: AALSpaceModule
This method allows to add a new Peer to the AALSpace.

Specified by:
addPeer in interface AALSpaceModule
newPeer - The Peer to add to the AALSpace

announceNewPeer

public void announceNewPeer(AALSpaceCard spaceCard,
                            PeerCard peerCard)
Description copied from interface: AALSpaceModule
This method propagates the event of new PeerAdded to the whole AALSpace

Specified by:
announceNewPeer in interface AALSpaceModule
peerCard - The new peer added

messageFromSpace

public void messageFromSpace(AALSpaceMessage message,
                             PeerCard sender)
                      throws AALSpaceModuleException
Description copied from interface: AALSpaceModule
This method is called as soon as an AALSpaceMessage has been received

Specified by:
messageFromSpace in interface AALSpaceModule
Throws:
AALSpaceModuleException

configureAALSpaceChannel

public void configureAALSpaceChannel(String group)
Description copied from interface: AALSpaceModule
This method configures the channel used in order to send/receive AAL Space messages

Specified by:
configureAALSpaceChannel in interface AALSpaceModule
Parameters:
group - Name of the group to use

messageReceived

public void messageReceived(ChannelMessage message)
Description copied from interface: MessageListener
Callback for the reception of messages

Specified by:
messageReceived in interface MessageListener

handleSendError

public void handleSendError(ChannelMessage message,
                            CommunicationConnectorException exception)
                     throws AALSpaceModuleException
Description copied from interface: MessageListener
Callback for error handling

Specified by:
handleSendError in interface MessageListener
Throws:
AALSpaceModuleException

destroyAALSpace

public void destroyAALSpace(AALSpaceCard spaceCard)
Description copied from interface: AALSpaceModule
Destroy an AAL Space

Specified by:
destroyAALSpace in interface AALSpaceModule

aalSpaceLost

public void aalSpaceLost(AALSpaceCard spaceCard)
Description copied from interface: ServiceListener
Called when an AALSpace has been destroyed

Specified by:
aalSpaceLost in interface ServiceListener
Parameters:
spaceCard - Information about the AALSpace

sharedObjectAdded

public void sharedObjectAdded(Object arg0,
                              Object arg1)
Specified by:
sharedObjectAdded in interface SharedObjectListener

sharedObjectRemoved

public void sharedObjectRemoved(Object arg0)
Specified by:
sharedObjectRemoved in interface SharedObjectListener

getBrokerName

public String getBrokerName()
Specified by:
getBrokerName in interface Broker

dispose

public void dispose()
Description copied from interface: Module
Routine in order to release resources

Specified by:
dispose in interface Broker
Specified by:
dispose in interface Module

getPeersAddress

public List<String> getPeersAddress()
Description copied from interface: AALSpaceModule
This method fetches the list of peer address joining to the same AAL Space

Specified by:
getPeersAddress in interface AALSpaceModule
Returns:
The consolidated list of peers

renewAALSpace

public void renewAALSpace(AALSpaceCard spaceCard)
Description copied from interface: AALSpaceModule
This method renews the AALSpace

Specified by:
renewAALSpace in interface AALSpaceModule

unmarshall

public BrokerMessage unmarshall(String message)
Description copied from interface: Broker
From String to Broker Message

Specified by:
unmarshall in interface Broker
Returns:


Copyright © 2014 universAAL Consortium. All Rights Reserved.