be.ac.ulg.montefiore.run.totem.repository.facade
Class RepositoryManager

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.repository.facade.RepositoryManagerObserver
      extended by be.ac.ulg.montefiore.run.totem.repository.facade.RepositoryManager

public class RepositoryManager
extends RepositoryManagerObserver

This class is a singleton that provides a global access point to the algorithms. Note that this class uses the preferences.xml file to list the available algorithms.

Creation date: 10-mars-2005

Author:
Jean Lepropre (lepropre@run.montefiore.ulg.ac.be)

Method Summary
 TotemAlgorithm getAlgo(java.lang.String name)
          Returns the instance of the algorithm name.
 TotemAlgorithm getAlgo(java.lang.String name, int asId)
          Returns the instance of the algorithm name.
 TotemAlgorithm getAlgo(java.lang.String name, int asId, int tmId)
          Returns the instance of the algorithm name.
 java.util.List<ParameterDescriptor> getAlgoParameters(java.lang.String algoName)
          Returns a list of the algorithm parameters used to start the algorithm
 java.util.List<TotemAlgorithm> getAllStartedAlgos()
          returns a list of all the started algorithms
 java.util.List<TotemAlgorithm> getAllStartedAlgos(java.lang.Class filter)
          returns a list of all the started algorithms that inherits from the class filter
 java.util.List<TotemAlgorithm> getAllStartedAlgos(int asId)
          returns all started algos that can be used on the given domain i.e.
 java.util.List<TotemAlgorithm> getAllStartedAlgos(int asId, java.lang.Class filter)
          returns all started algos of class filter that can be used on the given domain, i.e.
 java.util.List<java.lang.Class> getAllTotemAlgos()
          returns a list containing the class of each algo
 java.util.List<java.lang.Class> getAllTotemAlgos(java.lang.Class filter)
          returns a list containing the class of each algo that inherits from the class filter
static RepositoryManager getInstance()
          Returns the single instance of the RepositoryManager.
 void startAlgo(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> params)
          Starts the algorithm name.
 void startAlgo(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> params, int asId)
          Starts the algorithm name.
 void startAlgo(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> params, int asId, int tmId)
          Starts the algorithm name.
 void stopAlgorithm(java.lang.String name)
          Stops the algorithm name.
 void stopAlgorithm(java.lang.String name, int asId)
          Stops the algorithm name.
 void stopAlgorithm(java.lang.String name, int asId, int tmId)
          Stops the algorithm name.
 void stopAlgorithms()
          Stops all the started algorithms.
 void stopAlgorithms(int asId)
           
 
Methods inherited from class be.ac.ulg.montefiore.run.totem.repository.facade.RepositoryManagerObserver
addListener, getNbListeners, notifyStartAlgo, notifyStopAlgo, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static RepositoryManager getInstance()
Returns the single instance of the RepositoryManager.


startAlgo

public void startAlgo(java.lang.String name,
                      java.util.HashMap<java.lang.String,java.lang.String> params)
               throws AlgorithmInitialisationException
Starts the algorithm name. This algorithm must have been specified in the preferences.xml file. If it implements DomainSyncAlgorithm or DomainTMSyncAlgorithm, we use default values for the AS ID and the TM ID.

Parameters:
name - The name of the algorithm to start.
params - The parameters to give to the algorithm. It can be null.
Throws:
AlgorithmInitialisationException - If the algorithm was not specified in the preferences file, if the specified class was not found, if the algorithm doesn't implement TotemAlgorithm, if there is an error during the instantiation of the class, if the algorithm was already started, or if the algorithm requires an AS ID and/or a TM ID and that there are no default values.

startAlgo

public void startAlgo(java.lang.String name,
                      java.util.HashMap<java.lang.String,java.lang.String> params,
                      int asId)
               throws AlgorithmInitialisationException
Starts the algorithm name. This algorithm must have been specified in the preferences.xml file and must implement DomainSyncAlgorithm or DomainTMSyncAlgorithm (we use default value for the TM ID in this latter case).

Parameters:
name - The name of the algorithm to start.
params - The parameters to give to the algorithm. It can be null.
asId - The domain on which the algorithm will operate.
Throws:
AlgorithmInitialisationException - If the algorithm was not specified in the preferences file, if the specified class was not found, if there is an error during the instantiation of the class, if the algorithm was already started, if the algorithm doesn't implement TotemAlgorithm, or if the algorithm requires a TM ID and that there is no default value.

startAlgo

public void startAlgo(java.lang.String name,
                      java.util.HashMap<java.lang.String,java.lang.String> params,
                      int asId,
                      int tmId)
               throws AlgorithmInitialisationException
Starts the algorithm name. This algorithm must have been specified in the preferences.xml file and must implement DomainTMSyncAlgorithm.

Parameters:
name - The name of the algorithm to start.
params - The parameters to give to the algorithm. It can be null.
asId - The domain on which the algorithm will operate.
tmId - The traffic matrix on which the algorithm will operate.
Throws:
AlgorithmInitialisationException - If the algorithm was not specified in the preferences file, if the specified class was not found, if the algorithm doesn't implement DomainTMSyncAlgorithm, if there is an error during the instantiation of the class, or if the algorithm was already started.

getAlgo

public TotemAlgorithm getAlgo(java.lang.String name)
                       throws NoSuchAlgorithmException
Returns the instance of the algorithm name. We use default values for the AS ID and TM ID if necessary.

Parameters:
name - The name of the algorithm.
Returns:
The instance of the algorithm name.
Throws:
NoSuchAlgorithmException - If the algorithm doesn't exist or if it was not started, or if default values are required but not available.

getAlgo

public TotemAlgorithm getAlgo(java.lang.String name,
                              int asId)
                       throws NoSuchAlgorithmException
Returns the instance of the algorithm name. We use default value for TM ID if necessary. If the algorithm doesn't require an AS ID, asId is ignored.

Parameters:
name - The name of the algorithm.
asId - The domain on which it operates.
Returns:
The instance of the algorithm name.
Throws:
NoSuchAlgorithmException - If the algorithm doesn't exist or if it was not started, or if a default value is required but not available.

getAlgo

public TotemAlgorithm getAlgo(java.lang.String name,
                              int asId,
                              int tmId)
                       throws NoSuchAlgorithmException
Returns the instance of the algorithm name. If the algorithm doesn't require an AS ID and/or a TM ID, asId and/or tmId are ignored.

Parameters:
name - The name of the algorithm.
asId - The domain on which it operates.
tmId - The traffic matrix on which it operates.
Returns:
The instance of the algorithm name.
Throws:
NoSuchAlgorithmException - If the algorithm doesn't exist or if it was not started.

stopAlgorithms

public void stopAlgorithms()
Stops all the started algorithms.


stopAlgorithms

public void stopAlgorithms(int asId)

stopAlgorithm

public void stopAlgorithm(java.lang.String name)
                   throws NoSuchAlgorithmException
Stops the algorithm name. We use default values for the AS ID and the TM ID if necessary.

Parameters:
name - The name of the algorithm to stop.
Throws:
NoSuchAlgorithmException - If the algorithm doesn't exist, if it was not started or if there is no default value for the AS ID and/or the TM ID.

stopAlgorithm

public void stopAlgorithm(java.lang.String name,
                          int asId)
                   throws NoSuchAlgorithmException
Stops the algorithm name. We use a default value for the TM ID if necessary.

Parameters:
name - The name of the algorithm to stop.
asId - The AS ID of the domain on which the algorithm operated.
Throws:
NoSuchAlgorithmException - If the algorithm doesn't exist, if it was not started or if there is no default value for the TM ID.

stopAlgorithm

public void stopAlgorithm(java.lang.String name,
                          int asId,
                          int tmId)
                   throws NoSuchAlgorithmException
Stops the algorithm name.

Parameters:
name - The name of the algorithm to stop.
asId - The AS ID of the domain on which the algorithm operated.
tmId - The TM ID of the traffic matrix on which the algorithm operated.
Throws:
NoSuchAlgorithmException - If the algorithm doesn't exist or if it was not started.

getAllTotemAlgos

public java.util.List<java.lang.Class> getAllTotemAlgos()
returns a list containing the class of each algo

Returns:

getAllTotemAlgos

public java.util.List<java.lang.Class> getAllTotemAlgos(java.lang.Class filter)
returns a list containing the class of each algo that inherits from the class filter

Parameters:
filter -
Returns:

getAllStartedAlgos

public java.util.List<TotemAlgorithm> getAllStartedAlgos()
returns a list of all the started algorithms

Returns:

getAllStartedAlgos

public java.util.List<TotemAlgorithm> getAllStartedAlgos(java.lang.Class filter)
returns a list of all the started algorithms that inherits from the class filter

Parameters:
filter -
Returns:

getAllStartedAlgos

public java.util.List<TotemAlgorithm> getAllStartedAlgos(int asId,
                                                         java.lang.Class filter)
returns all started algos of class filter that can be used on the given domain, i.e. every DomainAlgorithm and DomainTrafficAlgorithm started on the given domain, plus algorithms that are independant of any domain.

Parameters:
asId -
filter -
Returns:

getAllStartedAlgos

public java.util.List<TotemAlgorithm> getAllStartedAlgos(int asId)
returns all started algos that can be used on the given domain i.e. every DomainAlgorithm and DomainTrafficAlgorithm started on the given domain, plus algorithms that are independant of any domain.

Parameters:
asId -
Returns:

getAlgoParameters

public java.util.List<ParameterDescriptor> getAlgoParameters(java.lang.String algoName)
                                                      throws NoSuchAlgorithmException
Returns a list of the algorithm parameters used to start the algorithm

Parameters:
algoName - Algorithm name
Returns:
Throws:
NoSuchAlgorithmException - if the algorithm was not found


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