Package xal.tools.database
Class DBConfiguration
java.lang.Object
xal.tools.database.DBConfiguration
load a database configuration
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
key for getting the URL from the preferences -
Method Summary
Modifier and TypeMethodDescriptionavailableConnectionDictionary
(boolean useDefaultIfNeeded, String... accounts) Get the available connection dictionary which is the most preferredavailableConnectionDictionary
(String... accounts) Get the available connection dictionary which is the most preferred and use the default one if there are no matchesgenerate a new connection dictionary from the default database server configuration and default accountget an alpha-numerically ordered list of account namesget the default account nameGet the default database adaptorprotected static Preferences
Get the user preferences for this classget the default server namestatic URL
Get the URL of the default configurationstatic String
Get the URL Spec of the default connection dictionary's properties filestatic DBConfiguration
load the configuration from the default configuration URLstatic DBConfiguration
getInstance
(URL configURL) load a configuration from the specified URLstatic DBConfiguration
getInstance
(DataAdaptor documentAdaptor, URL baseURL) load a configuration from the specified configuration document adaptorgetSchemaURL
(String name) Returns url location of a file with database schema descriptionget an alpha-numerically ordered list of server namesboolean
hasAccount
(String accountName) determine whether this configuration has the named accountstatic boolean
determine whether a default configuration has been specifiedboolean
determine whether this configuration has the named servernewConnectionDictionary
(String accountName) generate a new connection dictionary for the specified account name and the default database servernewConnectionDictionary
(String accountName, String serverName) Generate a new connection dictionary for the specified account name and server configuration namestatic void
setDefaultURL
(URL url) Set the URL of the default configuration.static void
setDefaultURLSpec
(String urlSpec) Set the URL spec of the default configuration.
-
Field Details
-
PREFERENCES_URL_KEY
key for getting the URL from the preferences- See Also:
-
-
Method Details
-
getDefaultServerName
get the default server name -
getDefaultAccountName
get the default account name -
hasAccount
determine whether this configuration has the named account -
hasServer
determine whether this configuration has the named server -
getAccountNames
get an alpha-numerically ordered list of account names -
getServerNames
get an alpha-numerically ordered list of server names -
newConnectionDictionary
Generate a new connection dictionary for the specified account name and server configuration name- Parameters:
accountName
- name of the account for which to initialize 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)- Returns:
- a new connection dictionary from the database configuration
-
newConnectionDictionary
generate a new connection dictionary for the specified account name and the default database server -
availableConnectionDictionary
public ConnectionDictionary availableConnectionDictionary(boolean useDefaultIfNeeded, String... accounts) Get the available connection dictionary which is the most preferred- Parameters:
useDefaultIfNeeded
- use the default account if none of the listed accounts is availableaccounts
- ordered (most preferred is first) accounts to search among
-
availableConnectionDictionary
Get the available connection dictionary which is the most preferred and use the default one if there are no matches- Parameters:
accounts
- ordered (most preferred is first) accounts to search among
-
defaultConnectionDictionary
generate a new connection dictionary from the default database server configuration and default account -
getInstance
load the configuration from the default configuration URL -
getInstance
load a configuration from the specified URL -
getInstance
load a configuration from the specified configuration document adaptor -
hasDefaultConfiguration
public static boolean hasDefaultConfiguration()determine whether a default configuration has been specified -
getDefaults
Get the user preferences for this class- Returns:
- the user preferences for this class
-
getDefaultURLSpec
Get the URL Spec of the default connection dictionary's properties file- Returns:
- the URL Spec of the configuration
-
setDefaultURLSpec
Set the URL spec of the default configuration.- Parameters:
urlSpec
- URL spec of the configuration- Throws:
BackingStoreException
- if the url spec failed to be saved as a default
-
getDefaultURL
Get the URL of the default configuration- Returns:
- the URL of the default configuration
- Throws:
MalformedURLException
- if the default URL spec cannot form a valid URL
-
setDefaultURL
Set the URL of the default configuration.- Parameters:
url
- URL of the configuration.- Throws:
BackingStoreException
- if the url failed to be saved as a default
-
getDefaultDatabaseAdaptor
Get the default database adaptor- Returns:
- the database adaptor
-
getSchemaURL
Returns url location of a file with database schema description- Parameters:
name
- schema- Returns:
- url pointing to a file
-