Class WrapperManager<T extends AbstractWrapper>

  • Type Parameters:
    T - the type of wrapper this manager is for
    All Implemented Interfaces:
    Serializable

    public class WrapperManager<T extends AbstractWrapper>
    extends Object
    implements Serializable
    Manages the database URL/wrapper relations.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_TableName

        protected String m_TableName
        the table this manager is for.
      • m_DatabaseManager

        protected DatabaseManager m_DatabaseManager
        the database manager to use for default connection.
    • Constructor Detail

      • WrapperManager

        public WrapperManager​(String tableName,
                              DatabaseManager manager)
        Initializes the manager.
        Parameters:
        tableName - the name of the table this manager is for
        manager - the database manager to obtain the default database connection from
    • Method Detail

      • getTableName

        public String getTableName()
        Returns the name of the table this manager is handling.
        Returns:
        the table name
      • hasDatabaseManager

        public boolean hasDatabaseManager()
        Checks whether a database manager is available.
        Returns:
        true if a database manager is available
      • getDatabaseManager

        public DatabaseManager getDatabaseManager()
        Returns the database manager in use.
        Returns:
        the database manager
      • createURL

        protected String createURL​(AbstractDatabaseConnection dbcon)
        Generates a URL that includes the user name.
        Parameters:
        dbcon - the database connection
        Returns:
        the complete URL
      • has

        public boolean has​(AbstractDatabaseConnection dbcon)
        Checks whether a table object for the specified database connection is available.
        Parameters:
        dbcon - the connection to check
        Returns:
        true if a table object is available
      • get

        public T get​(AbstractDatabaseConnection dbcon)
        Gets the table object for the specified database connection.
        Parameters:
        dbcon - the connection to get the table for
        Returns:
        the table object if available, otherwise null
      • add

        public T add​(AbstractDatabaseConnection dbcon,
                     T table)
        Adds the table object for the specified database connection.
        Parameters:
        dbcon - the connection to add the table for
        table - the table object to add
        Returns:
        the previous table, null if no previous one stored
      • iterator

        public Iterator<T> iterator()
        Returns an iterator over all tables.
        Returns:
        the iterator
      • toString

        public String toString()
        Returns a short string representation of the manager.
        Overrides:
        toString in class Object
        Returns:
        the string representation