cmu.survey.data
Class DatabaseStorageFactory
java.lang.Object
cmu.survey.data.DatabaseStorageFactory
public class DatabaseStorageFactory
- extends java.lang.Object
Method Summary |
static boolean |
copyPropertiesTo(HasKeyValues copyFromProperties,
KeyValuesModifiable copyToProperties)
|
static java.util.Vector<DatabaseStorageFactory.ConnectionType> |
getAvailableConnectionTypes()
|
static java.lang.String |
getDatabaseConnectionStringFor(java.lang.String databaseType,
java.lang.String hostName,
java.lang.String databaseName,
java.lang.String databaseUser,
java.lang.String databasePassword)
|
static java.lang.String |
getDatabaseConnectionStringFrom(HasKeyValues properties,
Dialogs dialogs)
This is a GUI method of doing the same thing -- it will interact with any GUI and ask for any missing information (like password)
(In a way, this doesn't belong here, because this class is not supposed to be GUI -- but this is a very useful method that'll be used in many places, so it's easiest to put it here) |
static java.lang.String |
getDatabaseConnectionStringFrom(HasKeyValues properties,
java.lang.String username,
java.lang.String password)
Get a database connection string from an arbitrary properties. |
static HasKeyValues |
getDatabaseKeyValuesForDatabase(java.lang.String databaseType,
java.lang.String hostName,
java.lang.String databaseName,
java.lang.String userID,
java.lang.String password)
|
static DatabaseStorage |
getInstance(java.lang.String databaseConnectionString)
Returns the connection if the connection succeeds, returns null otherwise. |
static DatabaseStorage |
getInstanceEvenIfErrors(java.lang.String databaseConnectionString)
Returns the connection, whether or not it succeeds. |
static java.lang.String |
getPassword(HasKeyValues properties)
|
static boolean |
getTypeHasUsernamePassword(HasKeyValues properties)
|
static boolean |
getTypeHasUsernamePassword(java.lang.String databaseType)
|
static java.lang.String |
getUsername(HasKeyValues properties)
|
static boolean |
isPossibleDataSource(HasKeyValues propA)
Ignores requriment of userid/password, because those can be asked for. |
static boolean |
isPropertiesSameDataSource(HasKeyValues propA,
HasKeyValues propB)
|
static boolean |
propertiesAreEqual(HasKeyValues propA,
HasKeyValues propB)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseName_Key
public static final java.lang.String DatabaseName_Key
- See Also:
- Constant Field Values
DatabaseType_Key
public static final java.lang.String DatabaseType_Key
- See Also:
- Constant Field Values
Hostname_Key
public static final java.lang.String Hostname_Key
- See Also:
- Constant Field Values
WhichDatabase_Key
public static final java.lang.String WhichDatabase_Key
- See Also:
- Constant Field Values
Username_Key
public static final java.lang.String Username_Key
- See Also:
- Constant Field Values
Password_Key
public static final java.lang.String Password_Key
- See Also:
- Constant Field Values
DatabaseStorageFactory
public DatabaseStorageFactory()
getInstance
public static DatabaseStorage getInstance(java.lang.String databaseConnectionString)
- Returns the connection if the connection succeeds, returns null otherwise.
- Parameters:
databaseConnectionString
-
- Returns:
getInstanceEvenIfErrors
public static DatabaseStorage getInstanceEvenIfErrors(java.lang.String databaseConnectionString)
- Returns the connection, whether or not it succeeds.
- Parameters:
databaseConnectionString
-
- Returns:
getDatabaseConnectionStringFor
public static java.lang.String getDatabaseConnectionStringFor(java.lang.String databaseType,
java.lang.String hostName,
java.lang.String databaseName,
java.lang.String databaseUser,
java.lang.String databasePassword)
getTypeHasUsernamePassword
public static boolean getTypeHasUsernamePassword(java.lang.String databaseType)
getTypeHasUsernamePassword
public static boolean getTypeHasUsernamePassword(HasKeyValues properties)
getUsername
public static java.lang.String getUsername(HasKeyValues properties)
getPassword
public static java.lang.String getPassword(HasKeyValues properties)
getDatabaseConnectionStringFrom
public static java.lang.String getDatabaseConnectionStringFrom(HasKeyValues properties,
java.lang.String username,
java.lang.String password)
- Get a database connection string from an arbitrary properties.
- Parameters:
properties
- prefix
- dialogs
- userid
- -- optional, required only if the type requires a useridpassword
- -- optional, required only if the type requires a password
- Returns:
getDatabaseConnectionStringFrom
public static java.lang.String getDatabaseConnectionStringFrom(HasKeyValues properties,
Dialogs dialogs)
- This is a GUI method of doing the same thing -- it will interact with any GUI and ask for any missing information (like password)
(In a way, this doesn't belong here, because this class is not supposed to be GUI -- but this is a very useful method that'll be used in many places, so it's easiest to put it here)
- Parameters:
properties
- dialogs
-
- Returns:
getDatabaseKeyValuesForDatabase
public static HasKeyValues getDatabaseKeyValuesForDatabase(java.lang.String databaseType,
java.lang.String hostName,
java.lang.String databaseName,
java.lang.String userID,
java.lang.String password)
copyPropertiesTo
public static boolean copyPropertiesTo(HasKeyValues copyFromProperties,
KeyValuesModifiable copyToProperties)
propertiesAreEqual
public static boolean propertiesAreEqual(HasKeyValues propA,
HasKeyValues propB)
isPropertiesSameDataSource
public static boolean isPropertiesSameDataSource(HasKeyValues propA,
HasKeyValues propB)
isPossibleDataSource
public static boolean isPossibleDataSource(HasKeyValues propA)
- Ignores requriment of userid/password, because those can be asked for.
- Parameters:
propA
-
- Returns:
getAvailableConnectionTypes
public static java.util.Vector<DatabaseStorageFactory.ConnectionType> getAvailableConnectionTypes()