de.tum.in.targeteam.pool
Class PoolCreator

java.lang.Object
  extended byde.tum.in.targeteam.pool.PoolCreator

public class PoolCreator
extends java.lang.Object

This class supports maintaining pools of different kinds. It must be used locally on the server, i.e. at the same place where the PoolManager will be started.

Optionally, a source pool or a source directory may be specified. It is needed for some of the methods.


Constructor Summary
PoolCreator()
          Constructor for a PoolCreator without source.
PoolCreator(Pool pool)
          Constructor for a PoolCreator.
 
Method Summary
 void copyPool(java.lang.String url)
          Create a pool and copy the content from the source pool into it.
 void copyPool(java.lang.String url, java.lang.String regexp)
          Create a pool and copy the content from the source pool into it.
 void createPool(java.lang.String url)
          Create a pool.
 void deletePool(java.lang.String url)
          Delete a pool.
 void mergePool(java.lang.String url)
          Merge the content from the source pool into an existing local pool.
 void mergePool(java.lang.String url, java.lang.String regexp)
          Merge the content from the source pool into an existing local pool.
 void updatePool(java.lang.String url)
          Update an existing pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolCreator

public PoolCreator(Pool pool)
Constructor for a PoolCreator.

Parameters:
pool - the source pool.

PoolCreator

public PoolCreator()
Constructor for a PoolCreator without source. Useful for calling deletePool.

Method Detail

createPool

public void createPool(java.lang.String url)
                throws ArgumentException,
                       java.io.IOException,
                       CorruptedPoolException
Create a pool. The pool is specified by a pool url. The pool must not yet exist.

Parameters:
url - the url for identifying the pool. This must not be a targeteam server url.
Throws:
ArgumentException - If the pool already exists or cannot be created or if the url is not valid or if no source has been specified.
java.io.IOException - If any failure happens when initializing the new pool.
CorruptedPoolException - if the source pool content is not valid.

deletePool

public void deletePool(java.lang.String url)
                throws java.io.IOException,
                       ArgumentException
Delete a pool. The pool is deleted with all its content. Make sure that no pool manager is active for the pool while performing this operation.

Parameters:
url - the url for identifying the pool. This must not be a targeteam server url.
Throws:
ArgumentException - if there is a syntax error in the url or the pool does not exist.
java.io.IOException

copyPool

public void copyPool(java.lang.String url)
              throws ArgumentException,
                     java.io.IOException,
                     CorruptedPoolException
Create a pool and copy the content from the source pool into it. The content of the source pool is determined by taking all nodes (modules, atoms and courses) and performing a deep copy for all of them.

Parameters:
url - the url for identifying the pool. This must not be a targeteam server url.
Throws:
ArgumentException - If the pool already exists or cannot be created or if the url is not valid or if no source has been specified or if the source is not a pool.
java.io.IOException - If any failure happens when initializing the new pool.
CorruptedPoolException - if the source pool content is not valid.

copyPool

public void copyPool(java.lang.String url,
                     java.lang.String regexp)
              throws ArgumentException,
                     java.io.IOException,
                     CorruptedPoolException
Create a pool and copy the content from the source pool into it. The content of the source pool is determined by taking all nodes (modules, atoms and courses) where the name attribute matches a regular expression, and performing a deep copy for all of them. If no regular expression is specified, all nodes are copied.

Parameters:
url - the url for identifying the pool. This must not be a targeteam server url.
regexp - the regular expression for matching node names.
Throws:
ArgumentException - If the pool already exists or cannot be created or if the url is not valid or if no source has been specified or if the source is not a pool.
java.io.IOException - If any failure happens when initializing the new pool.
CorruptedPoolException - if the source pool content is not valid.

mergePool

public void mergePool(java.lang.String url)
               throws ArgumentException,
                      java.io.IOException,
                      CorruptedPoolException
Merge the content from the source pool into an existing local pool. The content of the source pool is determined by taking all nodes (modules, atoms and courses) and performing a deep copy for all of them. All the corresponding unities are added to the target pool, using new IDs. No unities are identified, even if they have the same name attribute.

Parameters:
url - the url for identifying the target pool. This must not be a targeteam server url.
Throws:
ArgumentException - If the pool url is not valid or if no source has been specified or if the source is not a pool.
java.io.IOException - If any failure happens when initializing the new pool.
CorruptedPoolException - if the source pool content is not valid.

mergePool

public void mergePool(java.lang.String url,
                      java.lang.String regexp)
               throws ArgumentException,
                      java.io.IOException,
                      CorruptedPoolException
Merge the content from the source pool into an existing local pool. The content of the source pool is determined by taking all nodes (modules, atoms and courses) where the name attribute matches a regular expression, and performing a deep copy for all of them. If no regular expression is specified, all nodes are copied. All the corresponding unities are added to the target pool, using new IDs. No unities are identified, even if they have the same name attribute.

Parameters:
url - the url for identifying the target pool. This must not be a targeteam server url.
regexp - the regular expression for matching node names.
Throws:
ArgumentException - If the pool url is not valid or if no source has been specified or if the source is not a pool.
java.io.IOException - If any failure happens when initializing the new pool.
CorruptedPoolException - if the source pool content is not valid.

updatePool

public void updatePool(java.lang.String url)
                throws ArgumentException,
                       java.io.IOException,
                       CorruptedPoolException
Update an existing pool.

Parameters:
url - the url for identifying the pool.
Throws:
ArgumentException - If the pool does not exist or the url is not valid or no source has been specified.
java.io.IOException - If any failure happens when updating the pool.
CorruptedPoolException - if the pool content is not valid.