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

Maintain a set of LinkLoadComputer corresponding to existing domains in InterDomainManager and existing traffic matrix in TrafficMatrixManager. It contains a default computer which is the selected one. The manager sets a globally unique id for each LinkLoadComputer it contains (via the LinkLoadComputer.setId(String) call).

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.
 LinkLoadComputer addLinkLoadComputer(Domain domain, TrafficMatrix tm, TmLoadComputer tlc)
          Create a new LinkLoadComputer and add it to the manager with a generated id.
 LinkLoadComputer addLinkLoadComputer(Domain domain, TrafficMatrix tm, TmLoadComputer tlc, boolean addAsDefault, java.lang.String id)
          Create a new LinkLoadComputer and add it to the manager with the id id and return it.
 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
 void destroyLinkLoadComputers(Domain domain)
          Destroys all the linkLoadComputer associated with domain, i.e.
 void destroyLinkLoadComputers(int asId, int tmId)
          Destroys all the linkLoadComputer associated with a given domain and a traffic matrix, i.e.
 java.lang.String generateId()
          generate a globally unique string id
 java.lang.String generateId(java.lang.String prefix)
           
 LinkLoadComputer getDefaultLinkLoadComputer(Domain domain)
          returns the default LinkLoadComputer for the specified domain.
static LinkLoadComputerManager getInstance()
           
 LinkLoadComputer getLinkLoadComputer(java.lang.String id)
          returns the linkLoadComputer with an id corresping to the given one.
 LinkLoadComputer getLinkLoadComputer(TrafficMatrix tm, TmLoadComputer tlc)
          returns the linkLoadComputer corresponding to the given traffic matrix and LinkLoadStrategy.
 java.util.List<LinkLoadComputer> getLinkLoadComputers(Domain domain)
          returns a list of LinkLoadComputer for the given domain.
 java.util.List<LinkLoadComputer> getLinkLoadComputers(TrafficMatrix tm)
          returns a list of LinkLoadComputer for the given trafficMatrix.
 void removeDomainEvent(Domain domain)
          A domain removed.
 void removeLinkLoadComputer(LinkLoadComputer llc)
          Remove a LinkLoadComputer from the manager.
 void removeTrafficMatrixEvent(TrafficMatrix tm, int tmId)
          A traffic matrix has been removed
 void setDefaultLinkLoadComputer(LinkLoadComputer llc)
          Set a LinkLoadComputer as the default one.
 void setDefaultLinkLoadComputer(java.lang.String id)
          Set the LinkLoadComputer identified by id 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()

generateId

public java.lang.String generateId()
generate a globally unique string id

Returns:

generateId

public java.lang.String generateId(java.lang.String prefix)

destroy

public void destroy()
remove listeners


addLinkLoadComputer

public LinkLoadComputer addLinkLoadComputer(Domain domain,
                                            TrafficMatrix tm,
                                            TmLoadComputer tlc,
                                            boolean addAsDefault,
                                            java.lang.String id)
                                     throws DataConsistencyException,
                                            LinkLoadComputerAlreadyExistsException
Create a new LinkLoadComputer and add it to the manager with the id id and return it. If a LinkLoadComputer that is equal (has same domain, tm and lls) exists in manager, no LinkLoadComputer will be created and the LinkLoadComputer that is equal is returned (thus keeping its id).

Parameters:
domain -
tm -
tlc -
addAsDefault - Tell wether the new LinkLoadComputer should be the default one for its domain.
id - Id of the newly created LinkLoadComputer (ignored if a LinkLoadComputer with same parameters already exists in manager)
Returns:
The newly created LinkLoadComputer or a LinkLoadComputer that is already in manager and has the same set of parameters (domain, tm, lls).
Throws:
DataConsistencyException - If the tmId is not set for the trafficMatrix, or something is wrong with the parameters.
LinkLoadComputerAlreadyExistsException - When a linkLoadComputer with the same id already exists in manager.

addLinkLoadComputer

public LinkLoadComputer addLinkLoadComputer(Domain domain,
                                            TrafficMatrix tm,
                                            TmLoadComputer tlc)
                                     throws DataConsistencyException
Create a new LinkLoadComputer and add it to the manager with a generated id. If a LinkLoadComputer that is equal (has same domain, tm and lls) exists in manager, no LinkLoadComputer will be created and the LinkLoadComputer that is equal is returned (thus keeping its id). The LinkLoadComputer will be added as deafult for its domain.

Parameters:
domain -
tm -
tlc -
Returns:
The newly created LinkLoadComputer or a LinkLoadComputer that is already in manager and has the same set of parameters (domain, tm, lls).
Throws:
DataConsistencyException - If the tmId is not set for the trafficMatrix, or something is wrong with the parameters.

getLinkLoadComputers

public java.util.List<LinkLoadComputer> getLinkLoadComputers(Domain domain)
                                                      throws InvalidLinkLoadComputerException
returns a list of LinkLoadComputer for the given domain.

Parameters:
domain -
Returns:
Throws:
InvalidLinkLoadComputerException - if the domain is null.

getLinkLoadComputers

public java.util.List<LinkLoadComputer> getLinkLoadComputers(TrafficMatrix tm)
                                                      throws InvalidLinkLoadComputerException
returns a list of LinkLoadComputer for the given trafficMatrix.

Parameters:
tm -
Returns:
Throws:
InvalidLinkLoadComputerException - if the traffic matrix is null or the traffic matrix is not in manager.

getLinkLoadComputer

public LinkLoadComputer getLinkLoadComputer(TrafficMatrix tm,
                                            TmLoadComputer tlc)
                                     throws InvalidLinkLoadComputerException
returns the linkLoadComputer corresponding to the given traffic matrix and LinkLoadStrategy.

Parameters:
tm -
tlc -
Returns:
Throws:
InvalidLinkLoadComputerException - if traffic matrix or LinkLoadStrategy is null or the trafficMatrix is not in manager, or no corresponding LinkLoadComputer exist in the manager.

getDefaultLinkLoadComputer

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

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

getLinkLoadComputer

public LinkLoadComputer getLinkLoadComputer(java.lang.String id)
                                     throws InvalidLinkLoadComputerException
returns the linkLoadComputer with an id corresping to the given one.

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

setDefaultLinkLoadComputer

public void setDefaultLinkLoadComputer(LinkLoadComputer llc)
                                throws InvalidLinkLoadComputerException
Set 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(java.lang.String id)
                                throws InvalidLinkLoadComputerException
Set 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)
                            throws DataConsistencyException
Remove a LinkLoadComputer from the manager.

Parameters:
llc -
Throws:
DataConsistencyException - if the trafficMatrix associated with llc is not in manager or if llc is not in the manager.

destroyLinkLoadComputers

public void destroyLinkLoadComputers(Domain domain)
Destroys all the linkLoadComputer associated with domain, i.e. remove them from manager and call destroy() for each of them.

Parameters:
domain -

destroyLinkLoadComputers

public void destroyLinkLoadComputers(int asId,
                                     int tmId)
Destroys all the linkLoadComputer associated with a given domain and a traffic matrix, i.e. remove them from manager and call destroy() for each of them.

Parameters:
asId - The ASID of the domain.
tmId - The traffic Matrix 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.