Package adams.db
Class CQETableManager<T extends AbstractCQETable>
- java.lang.Object
-
- adams.db.CQETableManager<T>
-
- Type Parameters:
T
- the type of cqe this manager is for
- All Implemented Interfaces:
Serializable
public class CQETableManager<T extends AbstractCQETable> extends Object implements Serializable
Manages the database URL/CQEngine table relations.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CQETableManager(String cqeName, adams.db.DatabaseManager manager)
Initializes the manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
add(adams.db.AbstractDatabaseConnection dbcon, T cqe)
Adds the cqe object for the specified database connection.protected String
createURL(adams.db.AbstractDatabaseConnection dbcon)
Generates a URL that includes the user name.T
get(adams.db.AbstractDatabaseConnection dbcon)
Gets the cqe object for the specified database connection.String
getCQEName()
Returns the name of the cqe this manager is handling.adams.db.DatabaseManager
getDatabaseManager()
Returns the database manager in use.boolean
has(adams.db.AbstractDatabaseConnection dbcon)
Checks whether a cqe object for the specified database connection is available.boolean
hasDatabaseManager()
Checks whether a database manager is available.Iterator<T>
iterator()
Returns an iterator over all cqes.String
toString()
Returns a short string representation of the manager.
-
-
-
Field Detail
-
m_CQEName
protected String m_CQEName
the cqe this manager is for.
-
m_CQEs
protected HashMap<String,T extends AbstractCQETable> m_CQEs
for storing the cqe objects.
-
m_DatabaseManager
protected adams.db.DatabaseManager m_DatabaseManager
the database manager to use for default connection.
-
-
Constructor Detail
-
CQETableManager
public CQETableManager(String cqeName, adams.db.DatabaseManager manager)
Initializes the manager.- Parameters:
cqeName
- the name of the cqe this manager is formanager
- the database manager to obtain the default database connection from
-
-
Method Detail
-
getCQEName
public String getCQEName()
Returns the name of the cqe this manager is handling.- Returns:
- the cqe name
-
hasDatabaseManager
public boolean hasDatabaseManager()
Checks whether a database manager is available.- Returns:
- true if a database manager is available
-
getDatabaseManager
public adams.db.DatabaseManager getDatabaseManager()
Returns the database manager in use.- Returns:
- the database manager
-
createURL
protected String createURL(adams.db.AbstractDatabaseConnection dbcon)
Generates a URL that includes the user name.- Parameters:
dbcon
- the database connection- Returns:
- the complete URL
-
has
public boolean has(adams.db.AbstractDatabaseConnection dbcon)
Checks whether a cqe object for the specified database connection is available.- Parameters:
dbcon
- the connection to check- Returns:
- true if a cqe object is available
-
get
public T get(adams.db.AbstractDatabaseConnection dbcon)
Gets the cqe object for the specified database connection.- Parameters:
dbcon
- the connection to get the cqe for- Returns:
- the cqe object if available, otherwise null
-
add
public T add(adams.db.AbstractDatabaseConnection dbcon, T cqe)
Adds the cqe object for the specified database connection.- Parameters:
dbcon
- the connection to add the cqe forcqe
- the cqe object to add- Returns:
- the previous cqe, null if no previous one stored
-
-