be.ac.ulg.montefiore.run.totem.trafficMatrix.facade
Class LinkLoadComputerManager

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.facade.LinkLoadComputerManagerObserver
      extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.facade.LinkLoadComputerManager
All Implemented Interfaces:
InterDomainManagerListener, TrafficMatrixManagerListener

public class LinkLoadComputerManager
extends LinkLoadComputerManagerObserver
implements TrafficMatrixManagerListener, InterDomainManagerListener

Maintains a set of LinkLoadComputer corresponding to existing domains in InterDomainManager and existing traffic matrices in TrafficMatrixManager.

It contains a default computer per domain which is the selected one. Each LinkLoadComputer is identified by a String id which is unique per domain.

The role of the LinkLoadComputerManager is three-fold:

Creation date: 10 mars 2006

Author:
Gaƫl Monfort (monfort@run.montefiore.ulg.ac.be)

Method Summary
 void addDomainEvent(Domain domain)
          A new domain added.
 java.lang.String addLinkLoadComputer(LinkLoadComputer llc)
          Add the given LinkLoadComputer to the manager.
 void addLinkLoadComputer(LinkLoadComputer llc, boolean addAsDefault, java.lang.String id)
          Adds a LinkLoadComputer to the manager and make it start listening to events by calling LinkLoadComputer.startListening().
 void addTrafficMatrixEvent(TrafficMatrix tm, int tmId)
          A TrafficMatrix has been loaded
 void changeDefaultDomainEvent(Domain domain)
          The default domain has changed for the specified domain.
 void changeDefaultTrafficMatrixEvent(int asId, TrafficMatrix tm)
          The default traffic matrix has changed for the domain given by its asId.
 void destroy()
          remove listeners
 java.lang.String generateId(Domain domain)
          Generates an unique string id for the specified domain.
 java.lang.String generateId(Domain domain, java.lang.String prefix)
          Generates an unused id for the specified domain, starting with the given prefix.
 LinkLoadComputer getDefaultLinkLoadComputer(Domain domain)
          Returns the default LinkLoadComputer for the specified domain.
 java.lang.String getDefaultLinkLoadComputerId(Domain domain)
          Returns the id of the default LinkLoadComputer of the given domain.
static LinkLoadComputerManager getInstance()
          Returns the unique instance, create it if necessary.
 LinkLoadComputer getLinkLoadComputer(Domain domain, java.lang.String id)
          Returns the LinkLoadComputer corresponding to the given id.
 Pair<java.lang.String,LinkLoadComputer> getLinkLoadComputer(LinkLoadComputer llc)
          Returns a pair associating a LinkLoadComputer that is equal to the given one with its id in the manager.
 java.lang.String getLinkLoadComputerId(LinkLoadComputer llc)
          Return the id associated with a LinkLoadComputer that is equal to the given one.
 java.util.Set<java.lang.String> getLinkLoadComputerIds(Domain domain)
          Returns a set of all ids associated with the given domain
 java.util.Set<LinkLoadComputer> getLinkLoadComputers(Domain domain)
          Returns a set of LinkLoadComputer for the given domain.
 java.util.Set<Pair<java.lang.String,LinkLoadComputer>> getLinkLoadComputersWithId(Domain domain)
          Returns a set of all LinkLoadComputers of the given domain and their id.
 void removeDomainEvent(Domain domain)
          A domain removed.
 void removeLinkLoadComputer(Domain domain, java.lang.String id)
          Remove a LinkLoadComputer corresponding to the given id from the manager and destroys it, after signaling the event LinkLoadComputerManagerObserver.notifyRemoveLinkLoadComputer(be.ac.ulg.montefiore.run.totem.trafficMatrix.model.LinkLoadComputer).
 void removeLinkLoadComputer(LinkLoadComputer llc)
          Remove a LinkLoadComputer that is equal to the given one from the manager and destroys it, after signaling the event LinkLoadComputerManagerObserver.notifyRemoveLinkLoadComputer(be.ac.ulg.montefiore.run.totem.trafficMatrix.model.LinkLoadComputer).
 void removeTrafficMatrixEvent(TrafficMatrix tm, int tmId)
          A traffic matrix has been removed
 void setDefaultLinkLoadComputer(Domain domain, java.lang.String id)
          Sets the LinkLoadComputer identified by id as the default one.
 void setDefaultLinkLoadComputer(LinkLoadComputer llc)
          Sets a LinkLoadComputer as the default one.
 
Methods inherited from class be.ac.ulg.montefiore.run.totem.trafficMatrix.facade.LinkLoadComputerManagerObserver
addListener, getNbListeners, notifyAddLinkLoadComputer, notifyChangeDefaultLinkLoadComputer, notifyRemoveLinkLoadComputer, notifyRemoveMultipleLinkLoadComputer, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LinkLoadComputerManager getInstance()
Returns the unique instance, create it if necessary.

Returns:

generateId

public java.lang.String generateId(Domain domain)
Generates an unique string id for the specified domain.

Returns:

generateId

public java.lang.String generateId(Domain domain,
                                   java.lang.String prefix)
Generates an unused id for the specified domain, starting with the given prefix.

Parameters:
domain -
prefix -
Returns:

destroy

public void destroy()
remove listeners


addLinkLoadComputer

public void addLinkLoadComputer(LinkLoadComputer llc,
                                boolean addAsDefault,
                                java.lang.String id)
                         throws LinkLoadComputerIdException,
                                LinkLoadComputerAlreadyExistsException
Adds a LinkLoadComputer to the manager and make it start listening to events by calling LinkLoadComputer.startListening().

Parameters:
llc - the LinkLoadComputer
addAsDefault - Tells if it should be added as default for the LinkLoadComputer domain
id - Id to associate to the LinkLoadComputer
Throws:
LinkLoadComputerIdException - If a LinkLoadComputer with the same id already exists in the manager for the same domain.
LinkLoadComputerAlreadyExistsException - If a LinkLoadComputer that is equal to the given one already exists in the manager.

addLinkLoadComputer

public java.lang.String addLinkLoadComputer(LinkLoadComputer llc)
                                     throws LinkLoadComputerAlreadyExistsException
Add the given LinkLoadComputer to the manager. It will be added as default with a generated id. Make it start listening to events by calling LinkLoadComputer.startListening().

Parameters:
llc -
Returns:
the id to which the LinkLoadComputer is associated.
Throws:
LinkLoadComputerAlreadyExistsException - If a LinkLoadComputer that is equal to the given one already exists

getLinkLoadComputers

public java.util.Set<LinkLoadComputer> getLinkLoadComputers(Domain domain)
Returns a set of LinkLoadComputer for the given domain.

Parameters:
domain -
Returns:

getLinkLoadComputersWithId

public java.util.Set<Pair<java.lang.String,LinkLoadComputer>> getLinkLoadComputersWithId(Domain domain)
Returns a set of all LinkLoadComputers of the given domain and their id.

Parameters:
domain -
Returns:

getLinkLoadComputerIds

public java.util.Set<java.lang.String> getLinkLoadComputerIds(Domain domain)
Returns a set of all ids associated with the given domain

Parameters:
domain -
Returns:

getLinkLoadComputerId

public java.lang.String getLinkLoadComputerId(LinkLoadComputer llc)
                                       throws InvalidLinkLoadComputerException
Return the id associated with a LinkLoadComputer that is equal to the given one.

Parameters:
llc -
Returns:
Throws:
InvalidLinkLoadComputerException - If no LinkLoadComputer equals to the given one can be found.

getLinkLoadComputer

public Pair<java.lang.String,LinkLoadComputer> getLinkLoadComputer(LinkLoadComputer llc)
                                                            throws InvalidLinkLoadComputerException
Returns a pair associating a LinkLoadComputer that is equal to the given one with its id in the manager.

Parameters:
llc -
Returns:
Throws:
InvalidLinkLoadComputerException - If no LinkLoadComputer equals to the given one can be found.

getDefaultLinkLoadComputer

public LinkLoadComputer getDefaultLinkLoadComputer(Domain domain)
                                            throws InvalidLinkLoadComputerException
Returns the default LinkLoadComputer for the specified domain.

Parameters:
domain -
Returns:
Throws:
InvalidLinkLoadComputerException - If there is no default LinkLoadComputer for the given domain.

getDefaultLinkLoadComputerId

public java.lang.String getDefaultLinkLoadComputerId(Domain domain)
                                              throws InvalidLinkLoadComputerException
Returns the id of the default LinkLoadComputer of the given domain.

Parameters:
domain -
Returns:
Throws:
InvalidLinkLoadComputerException - If there is no default LinkLoadComputer for the given domain.

getLinkLoadComputer

public LinkLoadComputer getLinkLoadComputer(Domain domain,
                                            java.lang.String id)
                                     throws InvalidLinkLoadComputerException
Returns the LinkLoadComputer corresponding to the given id.

Parameters:
id -
domain -
Returns:
Throws:
InvalidLinkLoadComputerException - if no LinkLoadComputers exists with this id.

setDefaultLinkLoadComputer

public void setDefaultLinkLoadComputer(LinkLoadComputer llc)
                                throws InvalidLinkLoadComputerException
Sets a LinkLoadComputer as the default one. A linkLoadComputer that is equal to the given one should be in manager.

Parameters:
llc -
Throws:
InvalidLinkLoadComputerException - if the linkLoadComputer cannot be found in the manager.

setDefaultLinkLoadComputer

public void setDefaultLinkLoadComputer(Domain domain,
                                       java.lang.String id)
                                throws InvalidLinkLoadComputerException
Sets the LinkLoadComputer identified by id as the default one.

Parameters:
id -
Throws:
InvalidLinkLoadComputerException - If the LinkLoadComputer with id id cannot be found in the manager.

removeLinkLoadComputer

public void removeLinkLoadComputer(LinkLoadComputer llc)
Remove a LinkLoadComputer that is equal to the given one from the manager and destroys it, after signaling the event LinkLoadComputerManagerObserver.notifyRemoveLinkLoadComputer(be.ac.ulg.montefiore.run.totem.trafficMatrix.model.LinkLoadComputer).

Parameters:
llc -

removeLinkLoadComputer

public void removeLinkLoadComputer(Domain domain,
                                   java.lang.String id)
Remove a LinkLoadComputer corresponding to the given id from the manager and destroys it, after signaling the event LinkLoadComputerManagerObserver.notifyRemoveLinkLoadComputer(be.ac.ulg.montefiore.run.totem.trafficMatrix.model.LinkLoadComputer).

Parameters:
domain -
id -

addTrafficMatrixEvent

public void addTrafficMatrixEvent(TrafficMatrix tm,
                                  int tmId)
Description copied from interface: TrafficMatrixManagerListener
A TrafficMatrix has been loaded

Specified by:
addTrafficMatrixEvent in interface TrafficMatrixManagerListener
Parameters:
tm - the new loaded traffic matrix
tmId - the id of the newly loaded matrix

removeTrafficMatrixEvent

public void removeTrafficMatrixEvent(TrafficMatrix tm,
                                     int tmId)
Description copied from interface: TrafficMatrixManagerListener
A traffic matrix has been removed

Specified by:
removeTrafficMatrixEvent in interface TrafficMatrixManagerListener
Parameters:
tm - a reference to the removed traffic Matrix

changeDefaultTrafficMatrixEvent

public void changeDefaultTrafficMatrixEvent(int asId,
                                            TrafficMatrix tm)
Description copied from interface: TrafficMatrixManagerListener
The default traffic matrix has changed for the domain given by its asId.

Specified by:
changeDefaultTrafficMatrixEvent in interface TrafficMatrixManagerListener
Parameters:
asId - Asid of the domain for which the traffic matrix has changed
tm - The new default traffic matrix for the domain

addDomainEvent

public void addDomainEvent(Domain domain)
Description copied from interface: InterDomainManagerListener
A new domain added.

Specified by:
addDomainEvent in interface InterDomainManagerListener
Parameters:
domain - The new domain.

removeDomainEvent

public void removeDomainEvent(Domain domain)
Description copied from interface: InterDomainManagerListener
A domain removed.

Specified by:
removeDomainEvent in interface InterDomainManagerListener
Parameters:
domain - A reference to the domain removed.

changeDefaultDomainEvent

public void changeDefaultDomainEvent(Domain domain)
Description copied from interface: InterDomainManagerListener
The default domain has changed for the specified domain.

Specified by:
changeDefaultDomainEvent in interface InterDomainManagerListener
Parameters:
domain - the new default domain.


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.