|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--java.util.Properties
|
+--gov.sns.tools.database.ConnectionDictionary
ConnectionDictionary contains properties that can be used to establish a database connection. It should contain at least the database URL, user name and password. A default connection dictionary can be fetched from a file specified in the user's preferences.
| Field Summary | |
static java.lang.String |
DATABASE_ADAPTOR_KEY
|
protected static java.lang.String |
DICTIONARY_URL_KEY
|
static java.lang.String |
PASSWORD_KEY
|
static java.lang.String |
URL_KEY
|
static java.lang.String |
USER_KEY
|
| Fields inherited from class java.util.Properties |
defaults |
| Constructor Summary | |
ConnectionDictionary()
Constructor |
|
ConnectionDictionary(java.io.File file)
Constructor |
|
ConnectionDictionary(java.net.URL url)
Constructor |
|
| Method Summary | |
static ConnectionDictionary |
defaultDictionary()
Get the connection dictionary from the file specified in the user's preferences. |
DatabaseAdaptor |
getDatabaseAdaptor()
Get the database adaptor to use |
static java.net.URL |
getDefaultDictionaryURL()
Get the URL of the default connection dictionary properties file |
static java.lang.String |
getDefaultDictionaryURLSpec()
Get the URL Spec of the default connection dictionary's properties file |
protected static java.util.prefs.Preferences |
getDefaults()
Get the user preferences for this class |
java.lang.String |
getPassword()
Get the user password for connecting |
java.lang.String |
getURLSpec()
Get the connection URL |
java.lang.String |
getUser()
Get the user name for connecting |
void |
loadFrom(java.net.URL url)
Load the connection dictionary from the dictionary file. |
void |
saveTo(java.net.URL url)
Save the connection dictionary to the dictionary file. |
void |
setDatabaseAdaptorClass(java.lang.Class databaseAdaptorClass)
Set the database adaptor class |
void |
setDatabaseAdaptorClass(java.lang.String className)
Set the database adaptor class |
static void |
setDefaultDictionaryFile(java.io.File file)
Set the connection dictionary's default properties file. |
static void |
setDefaultDictionaryPath(java.lang.String filePath)
Set the file path of the connection dictionary's default properties file. |
static void |
setDefaultDictionaryURL(java.net.URL url)
Set the URL of the connection dictionary's default properties file. |
static void |
setDefaultDictionaryURLSpec(java.lang.String urlSpec)
Set the URL spec of the connection dictionary's default properties file. |
void |
setPassword(java.lang.String password)
Set the password |
void |
setURLSpec(java.lang.String urlSpec)
Set the URL spec |
void |
setUser(java.lang.String userID)
Set the user ID |
| Methods inherited from class java.util.Properties |
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store |
| Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String USER_KEY
public static final java.lang.String PASSWORD_KEY
public static final java.lang.String URL_KEY
public static final java.lang.String DATABASE_ADAPTOR_KEY
protected static final java.lang.String DICTIONARY_URL_KEY
| Constructor Detail |
public ConnectionDictionary()
public ConnectionDictionary(java.net.URL url)
throws java.io.IOException
url - The URL of the connection dictionary properties
java.io.IOException - if the properties file can't be loaded
public ConnectionDictionary(java.io.File file)
throws java.io.IOException,
java.net.MalformedURLException
file - The file of the connection dictionary properties
java.io.IOException - if the properties file can't be loaded
java.net.MalformedURLException - if the file cannot be converted to a URL| Method Detail |
public static ConnectionDictionary defaultDictionary()
public java.lang.String getUser()
public void setUser(java.lang.String userID)
userID - The user IDpublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
password - the passwordpublic java.lang.String getURLSpec()
public void setURLSpec(java.lang.String urlSpec)
urlSpec - The URL specpublic DatabaseAdaptor getDatabaseAdaptor()
public void setDatabaseAdaptorClass(java.lang.Class databaseAdaptorClass)
databaseAdaptorClass - the database adaptor class to usepublic void setDatabaseAdaptorClass(java.lang.String className)
className - the database adaptor class name to use
public void saveTo(java.net.URL url)
throws java.io.IOException
url - The url of the dictionary properties file.
java.io.IOException - if the connection dictionary cannot be saved to its properties file
public void loadFrom(java.net.URL url)
throws java.io.IOException
url - The url of the dictionary properties file.
java.io.IOException - if the connection dictionary cannot be loaded from its properties fileprotected static java.util.prefs.Preferences getDefaults()
public static java.net.URL getDefaultDictionaryURL()
throws java.net.MalformedURLException
java.net.MalformedURLException - if the default URL spec cannot form a valid URLpublic static java.lang.String getDefaultDictionaryURLSpec()
public static void setDefaultDictionaryPath(java.lang.String filePath)
throws java.net.MalformedURLException,
java.util.prefs.BackingStoreException
filePath - The file path of the connection dictionary properties file.
java.net.MalformedURLException - if the file path cannot form a valid URL
java.util.prefs.BackingStoreException - if the path failed to be saved as a default
public static void setDefaultDictionaryFile(java.io.File file)
throws java.net.MalformedURLException,
java.util.prefs.BackingStoreException
file - The connection dictionary properties file.
java.net.MalformedURLException - if the file cannot form a valid URL
java.util.prefs.BackingStoreException - if the file failed to be saved as a default
public static void setDefaultDictionaryURL(java.net.URL url)
throws java.util.prefs.BackingStoreException
url - The URL of the connection dictionary properties file.
java.util.prefs.BackingStoreException - if the url failed to be saved as a default
public static void setDefaultDictionaryURLSpec(java.lang.String urlSpec)
throws java.util.prefs.BackingStoreException
urlSpec - The URL spec of the connection dictionary properties file.
java.util.prefs.BackingStoreException - if the url spec failed to be saved as a default
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||