org.universAAL.middleware.brokers.control
Class ControlBroker

Package class diagram package ControlBroker
java.lang.Object
  extended by org.universAAL.middleware.brokers.control.ControlBroker
All Implemented Interfaces:
Broker, SharedObjectListener, MessageListener

public class ControlBroker
extends Object
implements SharedObjectListener, Broker, MessageListener

The Control Broker

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

Constructor Summary
ControlBroker(ModuleContext context)
           
 
Method Summary
 void aalSpaceJoined(AALSpaceDescriptor descriptor)
           
 void addNewPeer(AALSpaceDescriptor spaceDescriptor, PeerCard peer)
           
 void buildAALSpace(AALSpaceCard aalSpaceCard)
           
 void configureChannels(List<ChannelDescriptor> communicationChannels, String peerName)
          Only configures the communication channels by creating a list of channels for the Communication Module
 void configurePeeringChannel(ChannelDescriptor peeringChannel, String peerName)
          Configures the peering channel by configuring the AALSpaceModule and by creating a new channel for the Communication Module
 void destroyAALSpace(AALSpaceCard spaceCard)
           
 List<AALSpaceCard> discoverAALSpace(Dictionary<String,String> filters)
           
 void dispose()
          Release the resources
 Map<PeerCard,Map<String,Serializable>> findMatchingPeers(Map<String,Serializable> filter, int limit, int timeout)
           
 String getBrokerName()
           
 AALSpaceDescriptor getmyAALSpaceDescriptor()
          This method returns the AALSpaceDescriptor of my AALSpace
 PeerCard getmyPeerCard()
          This method returns the PeerCard of the current MW instance
 List<String> getPeersAddress()
           
 void handleSendError(ChannelMessage message, CommunicationConnectorException e)
          Callback for error handling
 boolean init()
           
 void installArtefactLocally(String serializedPart)
           
 void join(PeerCard spaceCoordinator, AALSpaceCard spaceCard)
           
 void joinRequest(AALSpaceCard spaceCard, PeerCard sender)
           
 void leaveAALSpace(PeerCard spaceCoordinator, AALSpaceCard spaceCard)
           
 void leaveRequest(AALSpaceDescriptor spaceDescriptor)
           
 void messageReceived(ChannelMessage message)
          Callback for the reception of messages
 void newAALSpaceFound(Set<AALSpaceCard> spaceCards)
           
 void newPeerAdded(AALSpaceCard spaceCard, PeerCard peer)
           
 void notifyRequestToInstallPart(UAPPCard mpaCard, String partID, UAPPPartStatus partStatus)
           
 void peerFound(PeerCard peer)
           
 void peerLost(PeerCard sender)
           
 void renewAALSpace(AALSpaceCard spaceCard)
           
 Map<String,Serializable> requestPeerAttributes(List<String> attributes, PeerCard target, int limit, int timeout)
           
 void requestPeerCard(String peerAddress)
           
 void requestToInstallPart(byte[] partAsZip, PeerCard target, UAPPCard card)
          This method allows to request the installation of an uApp part to a target node
 void requestToLeave(AALSpaceDescriptor spaceDescriptor)
           
 void requestToUninstallPart(PeerCard target, UAPPCard card)
          This method allows to request the installation of an uApp part to a target node
 void resetModule(List<ChannelDescriptor> channels)
           
 void sharedObjectAdded(Object arg0, Object arg1)
           
 void sharedObjectRemoved(Object arg0)
           
 void signalAALSpaceStatus(AALSpaceStatus status, AALSpaceDescriptor spaceDescriptor)
           
 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

ControlBroker

public ControlBroker(ModuleContext context)
Method Detail

init

public boolean init()
Specified by:
init in interface Broker

discoverAALSpace

public List<AALSpaceCard> discoverAALSpace(Dictionary<String,String> filters)

buildAALSpace

public void buildAALSpace(AALSpaceCard aalSpaceCard)

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

joinRequest

public void joinRequest(AALSpaceCard spaceCard,
                        PeerCard sender)

leaveRequest

public void leaveRequest(AALSpaceDescriptor spaceDescriptor)

requestToLeave

public void requestToLeave(AALSpaceDescriptor spaceDescriptor)

peerLost

public void peerLost(PeerCard sender)

join

public void join(PeerCard spaceCoordinator,
                 AALSpaceCard spaceCard)

getmyPeerCard

public PeerCard getmyPeerCard()
This method returns the PeerCard of the current MW instance

Returns:
PeerCard

getmyAALSpaceDescriptor

public AALSpaceDescriptor getmyAALSpaceDescriptor()
This method returns the AALSpaceDescriptor of my AALSpace

Returns:

aalSpaceJoined

public void aalSpaceJoined(AALSpaceDescriptor descriptor)

peerFound

public void peerFound(PeerCard peer)

newAALSpaceFound

public void newAALSpaceFound(Set<AALSpaceCard> spaceCards)

configureChannels

public void configureChannels(List<ChannelDescriptor> communicationChannels,
                              String peerName)
Only configures the communication channels by creating a list of channels for the Communication Module

Parameters:
communicationChannels -

configurePeeringChannel

public void configurePeeringChannel(ChannelDescriptor peeringChannel,
                                    String peerName)
Configures the peering channel by configuring the AALSpaceModule and by creating a new channel for the Communication Module

Parameters:
peeringChannel -

resetModule

public void resetModule(List<ChannelDescriptor> channels)

destroyAALSpace

public void destroyAALSpace(AALSpaceCard spaceCard)

leaveAALSpace

public void leaveAALSpace(PeerCard spaceCoordinator,
                          AALSpaceCard spaceCard)

addNewPeer

public void addNewPeer(AALSpaceDescriptor spaceDescriptor,
                       PeerCard peer)

newPeerAdded

public void newPeerAdded(AALSpaceCard spaceCard,
                         PeerCard peer)

requestToUninstallPart

public void requestToUninstallPart(PeerCard target,
                                   UAPPCard card)
This method allows to request the installation of an uApp part to a target node

Parameters:
target - The node into which to install the part
card - The reference information of the part of the application within a service to install

requestToInstallPart

public void requestToInstallPart(byte[] partAsZip,
                                 PeerCard target,
                                 UAPPCard card)
This method allows to request the installation of an uApp part to a target node

Parameters:
partAsZip - The part serialized as a String. The payload of the DeployMessage has to be a string
target - The node into which to install the part
card - The reference information of the part of the application within a service to install

notifyRequestToInstallPart

public void notifyRequestToInstallPart(UAPPCard mpaCard,
                                       String partID,
                                       UAPPPartStatus partStatus)
Parameters:
mpaCard -
partID -
peer - The peer notifying the staus of the part
partStatus -

getBrokerName

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

handleSendError

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

Specified by:
handleSendError in interface MessageListener

messageReceived

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

Specified by:
messageReceived in interface MessageListener

installArtefactLocally

public void installArtefactLocally(String serializedPart)

getPeersAddress

public List<String> getPeersAddress()

requestPeerCard

public void requestPeerCard(String peerAddress)

dispose

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

Specified by:
dispose in interface Broker

renewAALSpace

public void renewAALSpace(AALSpaceCard spaceCard)

signalAALSpaceStatus

public void signalAALSpaceStatus(AALSpaceStatus status,
                                 AALSpaceDescriptor spaceDescriptor)

unmarshall

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

Specified by:
unmarshall in interface Broker
Returns:

requestPeerAttributes

public Map<String,Serializable> requestPeerAttributes(List<String> attributes,
                                                      PeerCard target,
                                                      int limit,
                                                      int timeout)

findMatchingPeers

public Map<PeerCard,Map<String,Serializable>> findMatchingPeers(Map<String,Serializable> filter,
                                                                int limit,
                                                                int timeout)


Copyright © 2014 universAAL Consortium. All Rights Reserved.