|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.afcs.warts.db.AccountConfiguration
A AccountConfiguration instance contains the information needed to connect to a database and retrieve a set of tables. The information is configured in a Java properties file.
This class is responsible for making use of database metadata to obtain information about both tables (in the event that the tables to load specified in the configuration contains a '*') and the columns in each table in a database-independent way.
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Method Summary | |
boolean |
equals(java.lang.Object otherObj)
Returns true if the specified object is a AccountConfiguration instance with the same database, username and table specs as this one. |
java.sql.Connection |
getConnection()
Returns a database connection to the database account configured in this instance. |
java.lang.String |
getDatabaseUri()
Returns the database URI that is used to obtain a connection to the database. |
java.lang.String |
getDisplayName()
Returns a display name for the account, which is of the format 'username/instancename@machineName'. |
java.lang.String |
getInstanceName()
Returns the name of the instance that we're connecting to, which is given by the last part of the URI (the text after the last colon). |
TableDescription |
getTableDescription(java.lang.String tableName)
Returns the table description for the specified table name (which should be one of the names returned by getTableNames() , or null if the
description can not be loaded. |
java.util.List |
getTableDescriptions()
Returns a list of all of the table descriptions configured in this account. |
java.util.List |
getTableNames()
This method converts the table names that were specified in the account configuration file into a list of tablenames in an 'owner.tablename' format. |
java.lang.String |
getUsername()
Returns the username used to log into this account. |
int |
hashCode()
Returns a hashcode for this instance that obeys the general contract. |
boolean |
isUtf8Encoded()
Returns true if the account configuration specified that this account was in a UTF-8 encoded database. |
static java.util.List |
loadFromProperties(java.util.Properties properties)
This method initialises and returns a list of AccountConfiguration instances which are created by processing the specified properties, which have been presumably been loaded from a account configuration file. |
java.lang.String |
toString()
Returns a string suitable for use in debugging. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public java.sql.Connection getConnection()
public java.lang.String getDatabaseUri()
public java.lang.String getDisplayName()
public java.lang.String getInstanceName()
public java.lang.String getUsername()
public boolean isUtf8Encoded()
public java.util.List getTableNames()
getTableDescription(java.lang.String)
. The owner and tablename are both case-
sensitive strings. The java.sql.DatabaseMetadata
class is
used to obtain tablenames in a database-independent manner in the event
that any of the table names in the configuration included a '*'. The list
is left in the same order that the configuration specified, so that
tables will be processed in the specified order when running in batch
mode.
public TableDescription getTableDescription(java.lang.String tableName)
getTableNames()
, or null if the
description can not be loaded.
tableName
- The name of the table to obtain a description of.
java.lang.NullPointerException
- If tableName is null.public java.util.List getTableDescriptions()
public java.lang.String toString()
public boolean equals(java.lang.Object otherObj)
otherObj
- The object to compare to this one.
public int hashCode()
public static java.util.List loadFromProperties(java.util.Properties properties)
properties
- The set of properties that define the account
configuration information.
java.lang.NullPointerException
- If properties is null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |