org.jplate.tabular.impl.defaults
Class DefaultRepo

java.lang.Object
  extended by org.jplate.tabular.impl.defaults.DefaultRepo
All Implemented Interfaces:
RepoIfc

public class DefaultRepo
extends java.lang.Object
implements RepoIfc

Default repo implementation.

Modifications:
    $Date: 2008-12-02 12:32:45 -0500 (Tue, 02 Dec 2008) $
    $Revision: 479 $
    $Author: sfloess $
    $HeadURL: https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/src/dev/java/org/jplate/tabular/impl/defaults/DefaultRepo.java $
    


Field Summary
private  org.apache.commons.logging.Log _log
          Used for logging.
private  java.lang.String _repoName
          The name of the repo.
private  TableFactoryIfc _tableFactory
          Used to create tables.
private  java.util.List<TableIfc> _tableList
          Holds all tables that belong to a repo.
static java.lang.String DEFAULT_REPO_NAME
          Default repo name.
 
Constructor Summary
DefaultRepo()
          Default constructor.
DefaultRepo(ListFactoryIfc<TableIfc> listFactory)
          This constructor uses listFactory to create a List to hold tables that are logically part of a repo.
DefaultRepo(java.lang.String repoName)
          This constructor sets the repo name and uses a UnsynchronizedLinkedListFactory as the list factory.
DefaultRepo(TableFactoryIfc tableFactory, ListFactoryIfc<TableIfc> listFactory, java.lang.String repoName)
          This constructor sets the repo name and uses listFactory to create a List to hold tables that are logically part of a repo.
 
Method Summary
 void addTable(TableIfc table)
          Add table.
 void close()
          This method will close a repo.
 TableIfc createTable()
           
 java.lang.String getRepoName()
          Return the repo name,
 java.util.List<TableIfc> getTables()
          Return the collection of tables.
 void open()
          This method will open an existing repo.
 boolean removeTable(TableIfc table)
          Remove table.
 void removeTables()
          This method will force the removal of all tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REPO_NAME

public static final java.lang.String DEFAULT_REPO_NAME
Default repo name. Used when one is not supplied on construction.

See Also:
Constant Field Values

_log

private final transient org.apache.commons.logging.Log _log
Used for logging.


_tableFactory

private TableFactoryIfc _tableFactory
Used to create tables.


_tableList

private final java.util.List<TableIfc> _tableList
Holds all tables that belong to a repo.


_repoName

private final java.lang.String _repoName
The name of the repo.

Constructor Detail

DefaultRepo

public DefaultRepo(TableFactoryIfc tableFactory,
                   ListFactoryIfc<TableIfc> listFactory,
                   java.lang.String repoName)
This constructor sets the repo name and uses listFactory to create a List to hold tables that are logically part of a repo.

Parameters:
listFactory - Used to create a list to hold associated tables.
repoName - The name of this repo.

DefaultRepo

public DefaultRepo(ListFactoryIfc<TableIfc> listFactory)
This constructor uses listFactory to create a List to hold tables that are logically part of a repo. The repo name is set to DEFAULT_REPO_NAME

Parameters:
listFactory - Used to create a list to hold associated tables.

DefaultRepo

public DefaultRepo(java.lang.String repoName)
This constructor sets the repo name and uses a UnsynchronizedLinkedListFactory as the list factory.

Parameters:
repoName - The name of this repo.

DefaultRepo

public DefaultRepo()
Default constructor. Set the repo name to DEFAULT_REPO_NAME and uses a UnsynchronizedLinkedListFactory as the list factory.

Method Detail

createTable

public TableIfc createTable()
Specified by:
createTable in interface RepoIfc

getRepoName

public java.lang.String getRepoName()
Return the repo name,

Specified by:
getRepoName in interface RepoIfc
Returns:
The repo name.

open

public void open()
          throws OpenException
This method will open an existing repo.

Specified by:
open in interface RepoIfc
Throws:
OpenException - If a problem arose opening the repo.

close

public void close()
           throws CloseException
This method will close a repo.

Specified by:
close in interface RepoIfc
Throws:
CloseException - If a problem arose closing the repo.

addTable

public void addTable(TableIfc table)
              throws AddException
Add table.

Specified by:
addTable in interface RepoIfc
Parameters:
table - The table to Add.
Throws:
AddException - if any issues arise adding table.

removeTables

public void removeTables()
                  throws RemoveException
This method will force the removal of all tables.

Specified by:
removeTables in interface RepoIfc
Throws:
RemoveException - if a problem arose removing all tables.

removeTable

public boolean removeTable(TableIfc table)
                    throws RemoveException
Remove table.

Specified by:
removeTable in interface RepoIfc
Parameters:
table - The table to remove.
Returns:
true if successful or false if not.
Throws:
RemoveException - if any issues arise removing table.

getTables

public java.util.List<TableIfc> getTables()
Return the collection of tables.

Specified by:
getTables in interface RepoIfc
Returns:
the collection of tables.