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

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.facade.TrafficMatrixManagerObserver
      extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.facade.TrafficMatrixManager
All Implemented Interfaces:
InterDomainManagerListener

public class TrafficMatrixManager
extends TrafficMatrixManagerObserver
implements InterDomainManagerListener

The TrafficMatrixManager provides the access to all the traffic matrices. This class is a singleton and the single instance can be obtain using getInstance() method. All the methods here are related to intra-domain traffic matrices.

Creation date: 27-janv.-2005

Author:
Jean Lepropre (lepropre@run.montefiore.ulg.ac.be), Olivier Delcourt (delcourt@run.montefiore.ulg.ac.be)

Method Summary
 void addDomainEvent(Domain domain)
          A new domain added.
 void addTrafficMatrix(TrafficMatrix tm, int tmId)
          Adds the traffic matrix tm with the TM ID tmId.
 void changeAsId(int oldASID, int newASID)
           
 void changeDefaultDomainEvent(Domain domain)
          The default domain has changed for the specified domain.
 TrafficMatrix createEmptyTrafficMatrix(int asId)
          Create a new traffic matrix with all values set to zero.
 TrafficMatrix createEmptyTrafficMatrix(int asId, int tmId)
          Create a new traffic matrix with all values set to zero.
 int generateTMID(int asId)
          Generates a TM ID that can be used for the domain asId.
 void generateTrafficMatrix(int asId, int tmId, TrafficModel model, double fraction)
          Deprecated. Use TrafficGeneratorInterface and sub-classes instead and TrafficGeneratorFactory.
 TrafficMatrix generateTrafficMatrix(int asId, int tmId, TrafficModel model, double fraction, boolean generateOnlyEdgeTraffic)
          Deprecated. Use TrafficGeneratorInterface and sub-classes instead and TrafficGeneratorFactory.
 TrafficMatrix getDefaultTrafficMatrix()
          Returns the default traffic matrix for the default domain of InterDomainManager.
 TrafficMatrix getDefaultTrafficMatrix(int asId)
          Returns the default traffic matrix for the domain asId.
 int getDefaultTrafficMatrixID()
          Returns the TM ID of the default traffic matrix for the default domain of InterDomainManager.
 int getDefaultTrafficMatrixID(int asId)
          Returns the TM ID of the default traffic matrix for the domain asId.
static TrafficMatrixManager getInstance()
          Returns the single instance of this class.
 java.util.List<java.lang.Integer> getTrafficMatrices(int asId)
          Returns all the traffic matrices for a given domain asid
 TrafficMatrix getTrafficMatrix(int asId, int tmId)
          Returns the traffic matrix tmId for the domain asId.
 TrafficMatrix loadTrafficMatrix(java.io.File file, int tmId, boolean isDefaultTrafficMatrix)
          Loads the intra-domain traffic matrix contained in the given file.
 TrafficMatrix loadTrafficMatrix(java.lang.String fileName)
          Loads the intra-domain traffic matrix contained in the file fileName.
 TrafficMatrix loadTrafficMatrix(java.lang.String fileName, int tmId, boolean isDefaultTrafficMatrix)
          Loads the intra-domain traffic matrix contained in the file fileName.
 void printAllRecordedTms()
           
 void removeAllTrafficMatrices()
          Removes all the traffic matrices from the TrafficMatrixManager.
Warning: this method does not signal the listeners.
 void removeDefaultTrafficMatrix()
          Removes the default traffic matrix of the default domain.
 void removeDefaultTrafficMatrix(int asId)
          Removes the default traffic matrix of the domain asId.
 void removeDomainEvent(Domain domain)
          A domain removed.
 void removeTrafficMatrices(int asId)
          Removes all traffic matrices for the domain given by its asId
 void removeTrafficMatrix(int asId, int tmId)
          Removes the traffic matrix tmId of the domain asId.
 void saveTrafficMatrix(int asId, int tmId, java.lang.String fileName)
          Saves the traffic matrix tmId of the domain asId to the file fileName.
 void setDefaultTrafficMatrix(int tmId)
          Sets the traffic matrix tmId as default traffic matrix for the default domain specified in InterDomainManager.
 void setDefaultTrafficMatrix(int asId, int tmId)
          Sets the traffic matrix tmId as default traffic matrix for the domain asId.
 void updateTrafficMatrix(int tmId, java.lang.String fileName)
          Updates the intra-domain traffic matrix tmId with the information contained in the file fileName.
 
Methods inherited from class be.ac.ulg.montefiore.run.totem.trafficMatrix.facade.TrafficMatrixManagerObserver
addListener, getNbListeners, notifyAddTrafficMatrix, notifyChangeDefaultTrafficMatrix, notifyRemoveTrafficMatrix, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TrafficMatrixManager getInstance()
Returns the single instance of this class.

Returns:
The single instance of this class.

getDefaultTrafficMatrixID

public int getDefaultTrafficMatrixID()
                              throws InvalidTrafficMatrixException
Returns the TM ID of the default traffic matrix for the default domain of InterDomainManager.

Returns:
The TM ID of the default traffic matrix for the default domain of InterDomainManager.
Throws:
InvalidTrafficMatrixException - If the default traffic matrix is not set for the default domain.

getDefaultTrafficMatrixID

public int getDefaultTrafficMatrixID(int asId)
                              throws InvalidTrafficMatrixException
Returns the TM ID of the default traffic matrix for the domain asId.

Parameters:
asId - The target domain.
Returns:
The TM ID of the default traffic matrix for the domain asId.
Throws:
InvalidTrafficMatrixException - If there is no default traffic matrix for the domain asId.

getDefaultTrafficMatrix

public TrafficMatrix getDefaultTrafficMatrix()
                                      throws InvalidTrafficMatrixException
Returns the default traffic matrix for the default domain of InterDomainManager.

Returns:
The default traffic matrix for the default domain of InterDomainManager.
Throws:
InvalidTrafficMatrixException - If the default traffic matrix is not set for the default domain.

getTrafficMatrices

public java.util.List<java.lang.Integer> getTrafficMatrices(int asId)
Returns all the traffic matrices for a given domain asid

Parameters:
asId -
Returns:
all the traffic matrices loaded for the given domain asid

getDefaultTrafficMatrix

public TrafficMatrix getDefaultTrafficMatrix(int asId)
                                      throws InvalidTrafficMatrixException
Returns the default traffic matrix for the domain asId.

Parameters:
asId - The AS ID of the target domain.
Returns:
The default traffic matrix for the domain asId.
Throws:
InvalidTrafficMatrixException - If the default traffic matrix is not set for the domain asId.

getTrafficMatrix

public TrafficMatrix getTrafficMatrix(int asId,
                                      int tmId)
                               throws InvalidTrafficMatrixException
Returns the traffic matrix tmId for the domain asId.

Parameters:
asId - The AS ID of the target domain.
tmId - The TM ID of the traffic matrix to return.
Throws:
InvalidTrafficMatrixException - If there is no traffic matrix tmId for domain asId.

printAllRecordedTms

public void printAllRecordedTms()

setDefaultTrafficMatrix

public void setDefaultTrafficMatrix(int tmId)
                             throws InvalidTrafficMatrixException
Sets the traffic matrix tmId as default traffic matrix for the default domain specified in InterDomainManager.

Parameters:
tmId - The TM ID of the default traffic matrix.
Throws:
InvalidTrafficMatrixException - If there is no traffic matrix tmId for the default domain.

setDefaultTrafficMatrix

public void setDefaultTrafficMatrix(int asId,
                                    int tmId)
                             throws InvalidTrafficMatrixException
Sets the traffic matrix tmId as default traffic matrix for the domain asId.

Parameters:
asId - The AS ID of the target domain.
tmId - The TM ID of the default traffic matrix.
Throws:
InvalidTrafficMatrixException - If there is no traffic matrix tmId for the domain asId.

addTrafficMatrix

public void addTrafficMatrix(TrafficMatrix tm,
                             int tmId)
                      throws TrafficMatrixAlreadyExistException,
                             InvalidDomainException,
                             TrafficMatrixIdException
Adds the traffic matrix tm with the TM ID tmId.

Parameters:
tm - The traffic matrix to add.
tmId - The TM ID you wish to give to tm.
Throws:
TrafficMatrixAlreadyExistException - If there is already a traffic matrix with the same TM ID for the same domain.
InvalidDomainException - If the specified domain doesn't exist.
TrafficMatrixIdException - If the traffic matrix id has already been set for the given matrix.

loadTrafficMatrix

public TrafficMatrix loadTrafficMatrix(java.lang.String fileName,
                                       int tmId,
                                       boolean isDefaultTrafficMatrix)
                                throws TrafficMatrixAlreadyExistException,
                                       InvalidDomainException,
                                       NodeNotFoundException,
                                       InvalidTrafficMatrixException
Loads the intra-domain traffic matrix contained in the file fileName.

Parameters:
fileName - The name of the file containing the traffic matrix.
tmId - The TM ID you wish to give to the traffic matrix.
isDefaultTrafficMatrix - true if the traffic matrix must be the default traffic matrix for its domain and false otherwise.
Returns:
the loaded matrix
Throws:
TrafficMatrixAlreadyExistException - If there is already a traffic matrix with the same TM ID for the same domain.
InvalidDomainException - If the specified domain doesn't exist.
NodeNotFoundException - If there is an unknown node in the traffic matrix.
InvalidTrafficMatrixException - If the matrix is not valid (file does not exist, xml error,...)

loadTrafficMatrix

public TrafficMatrix loadTrafficMatrix(java.io.File file,
                                       int tmId,
                                       boolean isDefaultTrafficMatrix)
                                throws TrafficMatrixAlreadyExistException,
                                       InvalidDomainException,
                                       NodeNotFoundException,
                                       InvalidTrafficMatrixException
Loads the intra-domain traffic matrix contained in the given file.

Parameters:
file - the file containing the traffic matrix.
tmId - The TM ID you wish to give to the traffic matrix.
isDefaultTrafficMatrix - true if the traffic matrix must be the default traffic matrix for its domain and false otherwise.
Returns:
the loaded matrix
Throws:
InvalidTrafficMatrixException - If the matrix is not valid (file does not exist, xml error,...)
TrafficMatrixAlreadyExistException - If there is already a traffic matrix with the same TM ID for the same domain.
InvalidDomainException - If the specified domain doesn't exist.
NodeNotFoundException - If there is an unknown node in the traffic matrix.

loadTrafficMatrix

public TrafficMatrix loadTrafficMatrix(java.lang.String fileName)
                                throws InvalidDomainException,
                                       NodeNotFoundException,
                                       InvalidTrafficMatrixException
Loads the intra-domain traffic matrix contained in the file fileName. This method generates a TM ID and sets the traffic matrix as default traffic matrix.

Parameters:
fileName - The name of the file containing the traffic matrix.
Returns:
the loaded matrix
Throws:
InvalidTrafficMatrixException - If the matrix is not valid (file does not exists, xml error,...)
InvalidDomainException - If the specified domain doesn't exist.
NodeNotFoundException - If there is an unknown node in the traffic matrix.

saveTrafficMatrix

public void saveTrafficMatrix(int asId,
                              int tmId,
                              java.lang.String fileName)
                       throws InvalidTrafficMatrixException
Saves the traffic matrix tmId of the domain asId to the file fileName.

Parameters:
asId - The AS ID of the target domain.
tmId - The TM ID of the target traffic matrix.
fileName - The name of the target file.
Throws:
InvalidTrafficMatrixException - If there is no traffic matrix tmId for the domain asId.

updateTrafficMatrix

public void updateTrafficMatrix(int tmId,
                                java.lang.String fileName)
                         throws NodeNotFoundException,
                                InvalidTrafficMatrixException
Updates the intra-domain traffic matrix tmId with the information contained in the file fileName.

Parameters:
tmId - The traffic matrix to update.
fileName - The name of the file containing the update information.
Throws:
InvalidTrafficMatrixException - If the traffic matrix to update can't be retrieved.
NodeNotFoundException - If the information contained in the file is not consistent with the traffic matrix to update.

removeDefaultTrafficMatrix

public void removeDefaultTrafficMatrix()
                                throws InvalidTrafficMatrixException
Removes the default traffic matrix of the default domain.

Throws:
InvalidTrafficMatrixException - If there is no default traffic matrix for the default domain.

removeDefaultTrafficMatrix

public void removeDefaultTrafficMatrix(int asId)
                                throws InvalidTrafficMatrixException
Removes the default traffic matrix of the domain asId.

Parameters:
asId - The AS ID of the target domain.
Throws:
InvalidTrafficMatrixException - If there is no default traffic matrix for the domain asId.

removeTrafficMatrices

public void removeTrafficMatrices(int asId)
Removes all traffic matrices for the domain given by its asId

Parameters:
asId -

removeTrafficMatrix

public void removeTrafficMatrix(int asId,
                                int tmId)
                         throws InvalidTrafficMatrixException
Removes the traffic matrix tmId of the domain asId.

Parameters:
asId - The AS ID of the target domain.
tmId - The TM ID of the target traffic matrix.
Throws:
InvalidTrafficMatrixException - If there is no traffic matrix tmId for the domain asId.

removeAllTrafficMatrices

public void removeAllTrafficMatrices()
Removes all the traffic matrices from the TrafficMatrixManager.
Warning: this method does not signal the listeners. Use with caution.


createEmptyTrafficMatrix

public TrafficMatrix createEmptyTrafficMatrix(int asId,
                                              int tmId)
                                       throws InvalidDomainException,
                                              TrafficMatrixAlreadyExistException
Create a new traffic matrix with all values set to zero.

Parameters:
asId - asid of the domain for which the matrix is to be created
tmId - desired traffic matrix id
Returns:
The new traffic matrix.
Throws:
InvalidDomainException - If the domain with given asid is not loaded
TrafficMatrixAlreadyExistException - If a matrix with the same tmId already exists

createEmptyTrafficMatrix

public TrafficMatrix createEmptyTrafficMatrix(int asId)
                                       throws InvalidDomainException
Create a new traffic matrix with all values set to zero.

Parameters:
asId - asid of the domain for which the matrix is to be created
Returns:
The new traffic matrix.
Throws:
InvalidDomainException - If the domain with given asid is not loaded

generateTrafficMatrix

public void generateTrafficMatrix(int asId,
                                  int tmId,
                                  TrafficModel model,
                                  double fraction)
                           throws TrafficMatrixAlreadyExistException,
                                  InvalidDomainException,
                                  RoutingException,
                                  NoRouteToHostException,
                                  TrafficGenerationException
Deprecated. Use TrafficGeneratorInterface and sub-classes instead and TrafficGeneratorFactory.

Generates a new traffic matrix tmId for the domain asId.

Parameters:
asId - The target domain.
tmId - The TM ID that the new traffic matrix will have.
model - The model used to generate the matrix.
fraction - The fraction of the nodes that generate traffic.
Throws:
TrafficMatrixAlreadyExistException - If there is already a traffic matrix tmId for the domain asId.
InvalidDomainException - If the domain asId doesn't exist.
RoutingException - If an error occurred during the routing process.
NoRouteToHostException - If there is no route between a pair of nodes.
TrafficGenerationException - If the generator didn't succeed in generating traffic with the required parameters.

generateTrafficMatrix

public TrafficMatrix generateTrafficMatrix(int asId,
                                           int tmId,
                                           TrafficModel model,
                                           double fraction,
                                           boolean generateOnlyEdgeTraffic)
                                    throws InvalidDomainException,
                                           TrafficMatrixAlreadyExistException,
                                           NoRouteToHostException,
                                           RoutingException
Deprecated. Use TrafficGeneratorInterface and sub-classes instead and TrafficGeneratorFactory.

Generates a new traffic matrix tmId for the domain asId. (FSK)

Parameters:
asId - The target domain.
tmId - The TM ID that the new traffic matrix will have.
model - The model used to generate the matrix.
fraction - The fraction of the nodes that generate traffic.
generateOnlyEdgeTraffic - true if the generator must only generate traffic for edge nodes
Returns:
the generated matrix
Throws:
TrafficMatrixAlreadyExistException - If there is already a traffic matrix tmId for the domain asId.
InvalidDomainException - If the domain asId doesn't exist.
RoutingException - If an error occurred during the routing process.
NoRouteToHostException - If there is no route between a pair of nodes.

generateTMID

public int generateTMID(int asId)
                 throws InvalidDomainException
Generates a TM ID that can be used for the domain asId.

Parameters:
asId - The target domain.
Returns:
A TM ID that can be used for the domain asId.
Throws:
InvalidDomainException - If there is no domain asId.

addDomainEvent

public void addDomainEvent(Domain domain)
A new domain added.

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

removeDomainEvent

public void removeDomainEvent(Domain domain)
A domain removed.

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

changeDefaultDomainEvent

public void changeDefaultDomainEvent(Domain domain)
The default domain has changed for the specified domain.

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

changeAsId

public void changeAsId(int oldASID,
                       int newASID)


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