public class DBConfiguration
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
PREFERENCES_URL_KEY
key for getting the URL from the preferences
|
Modifier and Type | Method and Description |
---|---|
ConnectionDictionary |
availableConnectionDictionary(boolean useDefaultIfNeeded,
java.lang.String... accounts)
Get the available connection dictionary which is the most preferred
|
ConnectionDictionary |
availableConnectionDictionary(java.lang.String... accounts)
Get the available connection dictionary which is the most preferred and use the default one if there are no matches
|
ConnectionDictionary |
defaultConnectionDictionary()
generate a new connection dictionary from the default database server configuration and default account
|
java.util.List<java.lang.String> |
getAccountNames()
get an alpha-numerically ordered list of account names
|
java.lang.String |
getDefaultAccountName()
get the default account name
|
DatabaseAdaptor |
getDefaultDatabaseAdaptor()
Get the default database adaptor
|
protected static java.util.prefs.Preferences |
getDefaults()
Get the user preferences for this class
|
java.lang.String |
getDefaultServerName()
get the default server name
|
static java.net.URL |
getDefaultURL()
Get the URL of the default configuration
|
static java.lang.String |
getDefaultURLSpec()
Get the URL Spec of the default connection dictionary's properties file
|
static DBConfiguration |
getInstance()
load the configuration from the default configuration URL
|
static DBConfiguration |
getInstance(DataAdaptor documentAdaptor)
load a configuration from the specified configuration document adaptor
|
static DBConfiguration |
getInstance(java.net.URL configURL)
load a configuration from the specified URL
|
java.util.List<java.lang.String> |
getServerNames()
get an alpha-numerically ordered list of server names
|
boolean |
hasAccount(java.lang.String accountName)
determine whether this configuration has the named account
|
static boolean |
hasDefaultConfiguration()
determine whether a defualt configuraiton has been specified
|
boolean |
hasServer(java.lang.String serverName)
determine whether this configuration has the named server
|
ConnectionDictionary |
newConnectionDictionary(java.lang.String accountName)
generate a new connection dictionary for the specified account name and the default database server
|
ConnectionDictionary |
newConnectionDictionary(java.lang.String accountName,
java.lang.String serverName)
Generate a new connection dictionary for the specified account name and server configuration name
|
static void |
setDefaultURL(java.net.URL url)
Set the URL of the default configuration.
|
static void |
setDefaultURLSpec(java.lang.String urlSpec)
Set the URL spec of the default configuration.
|
protected static final java.lang.String PREFERENCES_URL_KEY
public java.lang.String getDefaultServerName()
public java.lang.String getDefaultAccountName()
public boolean hasAccount(java.lang.String accountName)
public boolean hasServer(java.lang.String serverName)
public java.util.List<java.lang.String> getAccountNames()
public java.util.List<java.lang.String> getServerNames()
public ConnectionDictionary newConnectionDictionary(java.lang.String accountName, java.lang.String serverName)
accountName
- name of the account for which to initializae the connection dictionary (or null to use the default account if any)serverName
- name of the database server for which to initialize the connection dictionary (or null to use the default server if any)public ConnectionDictionary newConnectionDictionary(java.lang.String accountName)
public ConnectionDictionary availableConnectionDictionary(boolean useDefaultIfNeeded, java.lang.String... accounts)
useDefaultIfNeeded
- use the default account if none of the listed accounts is availableaccounts
- ordered (most preferred is first) accounts to search amongpublic ConnectionDictionary availableConnectionDictionary(java.lang.String... accounts)
accounts
- ordered (most preferred is first) accounts to search amongpublic ConnectionDictionary defaultConnectionDictionary()
public static DBConfiguration getInstance()
public static DBConfiguration getInstance(java.net.URL configURL)
public static DBConfiguration getInstance(DataAdaptor documentAdaptor)
public static boolean hasDefaultConfiguration()
protected static java.util.prefs.Preferences getDefaults()
public static java.lang.String getDefaultURLSpec()
public static void setDefaultURLSpec(java.lang.String urlSpec) throws java.util.prefs.BackingStoreException
urlSpec
- URL spec of the configurationjava.util.prefs.BackingStoreException
- if the url spec failed to be saved as a defaultpublic static java.net.URL getDefaultURL() throws java.net.MalformedURLException
java.net.MalformedURLException
- if the default URL spec cannot form a valid URLpublic static void setDefaultURL(java.net.URL url) throws java.util.prefs.BackingStoreException
url
- URL of the configuration.java.util.prefs.BackingStoreException
- if the url failed to be saved as a defaultpublic DatabaseAdaptor getDefaultDatabaseAdaptor()