public class AALSpaceManagerImpl extends Object implements AALSpaceEventHandler, AALSpaceManager, SharedObjectListener
COMUNICATION_TIMEOUT_KEY, COMUNICATION_TIMEOUT_VALUE, DEFAULT_PEER_ROLE, PEER_ID_FILE
Constructor and Description |
---|
AALSpaceManagerImpl(ModuleContext context,
ModuleConfigHome mh) |
Modifier and Type | Method and Description |
---|---|
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) |
public AALSpaceManagerImpl(ModuleContext context, ModuleConfigHome mh)
public Map<String,AALSpaceDescriptor> getManagedAALSpaces()
AALSpaceManager
getManagedAALSpaces
in interface AALSpaceManager
public Map<String,PeerCard> getPeers()
AALSpaceManager
getPeers
in interface AALSpaceManager
public IAALSpace getAalSpaceDefaultConfiguration()
public Boolean getPendingAALSpace()
public long getWaitAfterJoinRequest()
public AALSpaceDescriptor getAALSpaceDescriptor()
AALSpaceManager
getAALSpaceDescriptor
in interface AALSpaceManager
public PeerCard getMyPeerCard()
AALSpaceManager
getMyPeerCard
in interface AALSpaceManager
public Set<AALSpaceCard> getAALSpaces()
AALSpaceManager
getAALSpaces
in interface AALSpaceManager
public boolean init()
Manager
public void initAALSpace(IAALSpace aalSpaceDefaultConfiguration)
aalSpaceDefaultConfiguration
- Default AAL Space configurationspublic void join(AALSpaceCard spaceCard)
AALSpaceManager
join
in interface AALSpaceManager
public void cleanUpJoinRequest()
public void aalSpaceJoined(AALSpaceDescriptor descriptor)
AALSpaceEventHandler
aalSpaceJoined
in interface AALSpaceEventHandler
descriptor
- all the information about the joinined AALSpacepublic IAALSpace readAALSpaceDefaultConfigurations()
public void loadConfigurations(Dictionary configurations)
Manager
loadConfigurations
in interface Manager
configurations
- Dictionary of configurationspublic void joinRequest(AALSpaceCard spaceCard, PeerCard peer)
AALSpaceEventHandler
joinRequest
in interface AALSpaceEventHandler
public void newAALSpacesFound(Set<AALSpaceCard> spaceCards)
AALSpaceEventHandler
newAALSpacesFound
in interface AALSpaceEventHandler
public void peerFound(PeerCard peer)
AALSpaceEventHandler
peerFound
in interface AALSpaceEventHandler
public void peerLost(PeerCard peer)
AALSpaceEventHandler
peerLost
in interface AALSpaceEventHandler
public void sharedObjectAdded(Object sharedObj, Object removeHook)
sharedObjectAdded
in interface SharedObjectListener
public void sharedObjectRemoved(Object removeHook)
sharedObjectRemoved
in interface SharedObjectListener
public void leaveRequest(AALSpaceDescriptor spaceDescriptor)
AALSpaceEventHandler
leaveRequest
in interface AALSpaceEventHandler
public void leaveAALSpace(AALSpaceDescriptor spaceDescriptor)
AALSpaceManager
leaveAALSpace
in interface AALSpaceManager
public void dispose()
Manager
public void addAALSpaceListener(AALSpaceListener listener)
AALSpaceManager
addAALSpaceListener
in interface AALSpaceManager
public void removeAALSpaceListener(AALSpaceListener listener)
AALSpaceManager
removeAALSpaceListener
in interface AALSpaceManager
public void setListOfPeers(Map<String,PeerCard> peers)
AALSpaceEventHandler
setListOfPeers
in interface AALSpaceEventHandler
peers
- Map of peerspublic AALSpaceStatus getAALSpaceStatus()
public void mpaInstalled(AALSpaceDescriptor spaceDescriptor)
AALSpaceEventHandler
mpaInstalled
in interface AALSpaceEventHandler
public void mpaInstalling(AALSpaceDescriptor spaceDescriptor)
AALSpaceEventHandler
mpaInstalling
in interface AALSpaceEventHandler
public void aalSpaceEvent(AALSpaceStatus newStatus)
aalSpaceEvent
in interface AALSpaceEventHandler
public MatchingResult getMatchingPeers(Map<String,Serializable> filter)
AALSpaceManager
Map
with null
value, an
attribute with any value must be available on the matching PeerMap
with a not null
value, an
attribute with same value must be available on the matching Peer. The
#equals(Object)
is used for checking if the value are the sameMap
filter is set to { container=Karaf, tool=OSGI,
version=null }MatchingResult
will contain the peers C and E, while the
other were discarded because
getMatchingPeers
in interface AALSpaceManager
filter
- a Map
that contains a pair of String
as Key
and Object
as value which will be used for looking for
matching among the one available on the AAL spaceMatchingResult
representing the filtering resultpublic Map<String,Serializable> getPeerAttributes(List<String> attributes, PeerCard target)
getPeerAttributes
in interface AALSpaceManager
attributes
- The list of attribute to get value,target
- PeerCard
the peer card that identifies the peer that
we want to read attribute fromMap
with the pair String
, Serializable
representing the attribute requested along with its value.Copyright © 2015 universAAL Consortium. All Rights Reserved.