org.universAAL.middleware.managers.aalspace
Class AALSpaceManagerImpl

Package class diagram package AALSpaceManagerImpl
java.lang.Object
  extended by org.universAAL.middleware.managers.aalspace.AALSpaceManagerImpl
All Implemented Interfaces:
SharedObjectListener, AALSpaceEventHandler, AALSpaceManager, Manager

public class AALSpaceManagerImpl
extends Object
implements AALSpaceEventHandler, AALSpaceManager, SharedObjectListener

The implementation of the AALSpaceManager and AALSpaceEventHandler

Version:
$LastChangedRevision$ ( $LastChangedDate$ )
Author:
Michele Girolami, Stefano Lenzi, Giancarlo Riolo

Field Summary
 
Fields inherited from interface org.universAAL.middleware.managers.api.AALSpaceManager
COMUNICATION_TIMEOUT_KEY, COMUNICATION_TIMEOUT_VALUE, DEFAULT_PEER_ROLE, PEER_ID_FILE
 
Constructor Summary
AALSpaceManagerImpl(ModuleContext context, ModuleConfigHome mh)
           
 
Method Summary
 void aalSpaceEvent(AALSpaceStatus newStatus)
           
 void aalSpaceJoined(AALSpaceDescriptor descriptor)
          The method is called asynchronously from the bottom layer of the MW after a previous join(...) request.
 void addAALSpaceListener(AALSpaceListener listener)
          Add a new AAL Space listener.
 void cleanUpJoinRequest()
           
 void dispose()
          Release all the resources
 IAALSpace getAalSpaceDefaultConfiguration()
           
 AALSpaceDescriptor getAALSpaceDescriptor()
          This method returns the AALSpaceDescriptor of the AALSpace where the MW belongs to or null if the mw instance does not join to any AAL Space.
 Set<AALSpaceCard> getAALSpaces()
          This method returns the list of AALSpace discovered
 AALSpaceStatus getAALSpaceStatus()
           
 Map<String,AALSpaceDescriptor> getManagedAALSpaces()
          This method return a map of AALSpace managed by this MW instance
 MatchingResult getMatchingPeers(Map<String,Serializable> filter)
          A method for identifying a possible set of Peer in the AAL space that can be used for installing a part of the universAAL application.
 PeerCard getMyPeerCard()
          This method returns the PeerCard of the current MW instance
 Map<String,Serializable> getPeerAttributes(List<String> attributes, PeerCard target)
           
 Map<String,PeerCard> getPeers()
          This method return the list of neighborhood peers joined to the current AALSpace.
 Boolean getPendingAALSpace()
           
 long getWaitAfterJoinRequest()
           
 boolean init()
          Initialize the AALSpace Manager
 void initAALSpace(IAALSpace aalSpaceDefaultConfiguration)
          Private method to manage the creation of a new AALSpace starting from the default configurations
 void join(AALSpaceCard spaceCard)
          method to join an existing AALSpace according the configuration file: -to configure the peering channel -to send a join request -to receive the join response -to get the AALSpaceDescriptor -to configure the communication channels
 void joinRequest(AALSpaceCard spaceCard, PeerCard peer)
          This method allows the AALSpaceManager to manage a join request from a remote peer.
 void leaveAALSpace(AALSpaceDescriptor spaceDescriptor)
          Method used to leave an AALSpace
 void leaveRequest(AALSpaceDescriptor spaceDescriptor)
          This method forces the peer to leace an AALSpace
 void loadConfigurations(Dictionary configurations)
          This method sets all the configurations for the AALSpaceManager
 void mpaInstalled(AALSpaceDescriptor spaceDescriptor)
          Called in order to alert the AALSpace about the installation of a new MPA
 void mpaInstalling(AALSpaceDescriptor spaceDescriptor)
          Called in order to alert the AALSpace about the installation of a new MPA
 void newAALSpacesFound(Set<AALSpaceCard> spaceCards)
          A new AALSpace has been found
 void peerFound(PeerCard peer)
          Method called when a peer joins the AALSpace managed by the AALSpaceManager
 void peerLost(PeerCard peer)
          This method notifies to the coordinator that a peer wants to leave to the AALSpace
 IAALSpace readAALSpaceDefaultConfigurations()
           
 void removeAALSpaceListener(AALSpaceListener listener)
          Remove an AAL Space Listener
 void setListOfPeers(Map<String,PeerCard> peers)
          This method allows to configure the set of peers that actually join the AAL Space managed or joined by this AALSpaceManager
 void sharedObjectAdded(Object sharedObj, Object removeHook)
           
 void sharedObjectRemoved(Object removeHook)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AALSpaceManagerImpl

public AALSpaceManagerImpl(ModuleContext context,
                           ModuleConfigHome mh)
Method Detail

getManagedAALSpaces

public Map<String,AALSpaceDescriptor> getManagedAALSpaces()
Description copied from interface: AALSpaceManager
This method return a map of AALSpace managed by this MW instance

Specified by:
getManagedAALSpaces in interface AALSpaceManager
Returns:

getPeers

public Map<String,PeerCard> getPeers()
Description copied from interface: AALSpaceManager
This method return the list of neighborhood peers joined to the current AALSpace.
NOTE: The list does not contains the invoker

Specified by:
getPeers in interface AALSpaceManager
Returns:
Map of peers: peerID, PeerCard

getAalSpaceDefaultConfiguration

public IAALSpace getAalSpaceDefaultConfiguration()

getPendingAALSpace

public Boolean getPendingAALSpace()

getWaitAfterJoinRequest

public long getWaitAfterJoinRequest()

getAALSpaceDescriptor

public AALSpaceDescriptor getAALSpaceDescriptor()
Description copied from interface: AALSpaceManager
This method returns the AALSpaceDescriptor of the AALSpace where the MW belongs to or null if the mw instance does not join to any AAL Space.

Specified by:
getAALSpaceDescriptor in interface AALSpaceManager
Returns:
AALSpaceDescriptor

getMyPeerCard

public PeerCard getMyPeerCard()
Description copied from interface: AALSpaceManager
This method returns the PeerCard of the current MW instance

Specified by:
getMyPeerCard in interface AALSpaceManager
Returns:
PeerCard

getAALSpaces

public Set<AALSpaceCard> getAALSpaces()
Description copied from interface: AALSpaceManager
This method returns the list of AALSpace discovered

Specified by:
getAALSpaces in interface AALSpaceManager
Returns:
Set of AALSpace found

init

public boolean init()
Description copied from interface: Manager
Initialize the AALSpace Manager

Specified by:
init in interface Manager
Returns:
true if the initialization is completed, false otherwise

initAALSpace

public void initAALSpace(IAALSpace aalSpaceDefaultConfiguration)
Private method to manage the creation of a new AALSpace starting from the default configurations

Parameters:
aalSpaceDefaultConfiguration - Default AAL Space configurations

join

public void join(AALSpaceCard spaceCard)
Description copied from interface: AALSpaceManager
method to join an existing AALSpace according the configuration file: -to configure the peering channel -to send a join request -to receive the join response -to get the AALSpaceDescriptor -to configure the communication channels

Specified by:
join in interface AALSpaceManager

cleanUpJoinRequest

public void cleanUpJoinRequest()

aalSpaceJoined

public void aalSpaceJoined(AALSpaceDescriptor descriptor)
Description copied from interface: AALSpaceEventHandler
The method is called asynchronously from the bottom layer of the MW after a previous join(...) request.

Specified by:
aalSpaceJoined in interface AALSpaceEventHandler
Parameters:
descriptor - all the information about the joinined AALSpace

readAALSpaceDefaultConfigurations

public IAALSpace readAALSpaceDefaultConfigurations()

loadConfigurations

public void loadConfigurations(Dictionary configurations)
Description copied from interface: Manager
This method sets all the configurations for the AALSpaceManager

Specified by:
loadConfigurations in interface Manager
Parameters:
configurations - Dictionary of configurations

joinRequest

public void joinRequest(AALSpaceCard spaceCard,
                        PeerCard peer)
Description copied from interface: AALSpaceEventHandler
This method allows the AALSpaceManager to manage a join request from a remote peer. In this case this AALSpaceManager is the AALSpace coordinator

Specified by:
joinRequest in interface AALSpaceEventHandler

newAALSpacesFound

public void newAALSpacesFound(Set<AALSpaceCard> spaceCards)
Description copied from interface: AALSpaceEventHandler
A new AALSpace has been found

Specified by:
newAALSpacesFound in interface AALSpaceEventHandler

peerFound

public void peerFound(PeerCard peer)
Description copied from interface: AALSpaceEventHandler
Method called when a peer joins the AALSpace managed by the AALSpaceManager

Specified by:
peerFound in interface AALSpaceEventHandler

peerLost

public void peerLost(PeerCard peer)
Description copied from interface: AALSpaceEventHandler
This method notifies to the coordinator that a peer wants to leave to the AALSpace

Specified by:
peerLost in interface AALSpaceEventHandler

sharedObjectAdded

public void sharedObjectAdded(Object sharedObj,
                              Object removeHook)
Specified by:
sharedObjectAdded in interface SharedObjectListener

sharedObjectRemoved

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

leaveRequest

public void leaveRequest(AALSpaceDescriptor spaceDescriptor)
Description copied from interface: AALSpaceEventHandler
This method forces the peer to leace an AALSpace

Specified by:
leaveRequest in interface AALSpaceEventHandler

leaveAALSpace

public void leaveAALSpace(AALSpaceDescriptor spaceDescriptor)
Description copied from interface: AALSpaceManager
Method used to leave an AALSpace

Specified by:
leaveAALSpace in interface AALSpaceManager

dispose

public void dispose()
Description copied from interface: Manager
Release all the resources

Specified by:
dispose in interface Manager

addAALSpaceListener

public void addAALSpaceListener(AALSpaceListener listener)
Description copied from interface: AALSpaceManager
Add a new AAL Space listener.

Specified by:
addAALSpaceListener in interface AALSpaceManager

removeAALSpaceListener

public void removeAALSpaceListener(AALSpaceListener listener)
Description copied from interface: AALSpaceManager
Remove an AAL Space Listener

Specified by:
removeAALSpaceListener in interface AALSpaceManager

setListOfPeers

public void setListOfPeers(Map<String,PeerCard> peers)
Description copied from interface: AALSpaceEventHandler
This method allows to configure the set of peers that actually join the AAL Space managed or joined by this AALSpaceManager

Specified by:
setListOfPeers in interface AALSpaceEventHandler
Parameters:
peers - Map of peers

getAALSpaceStatus

public AALSpaceStatus getAALSpaceStatus()

mpaInstalled

public void mpaInstalled(AALSpaceDescriptor spaceDescriptor)
Description copied from interface: AALSpaceEventHandler
Called in order to alert the AALSpace about the installation of a new MPA

Specified by:
mpaInstalled in interface AALSpaceEventHandler

mpaInstalling

public void mpaInstalling(AALSpaceDescriptor spaceDescriptor)
Description copied from interface: AALSpaceEventHandler
Called in order to alert the AALSpace about the installation of a new MPA

Specified by:
mpaInstalling in interface AALSpaceEventHandler

aalSpaceEvent

public void aalSpaceEvent(AALSpaceStatus newStatus)
Specified by:
aalSpaceEvent in interface AALSpaceEventHandler

getMatchingPeers

public MatchingResult getMatchingPeers(Map<String,Serializable> filter)
Description copied from interface: AALSpaceManager
A method for identifying a possible set of Peer in the AAL space that can be used for installing a part of the universAAL application.
The matching algorithm returns only the Peer of the space that match the following rules

getPeerAttributes

public Map<String,Serializable> getPeerAttributes(List<String> attributes,
                                                  PeerCard target)
Specified by:
getPeerAttributes in interface AALSpaceManager
Parameters:
attributes - The list of attribute to get value,
target - PeerCard the peer card that identifies the peer that we want to read attribute from
Returns:
a Map with the pair String, Serializable representing the attribute requested along with its value.


Copyright © 2014 universAAL Consortium. All Rights Reserved.