|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cmu.survey.data.mysql.DatabaseStorageMySQL
public class DatabaseStorageMySQL
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface cmu.survey.data.DatabaseStorage |
---|
DatabaseStorage.UserDatabase |
Field Summary | |
---|---|
static java.lang.String |
MySQL_ALTER_PRIV
|
static java.lang.String |
MySQL_CREATE_PRIV
|
static java.lang.String |
MySQL_DELETE_PRIV
|
static java.lang.String |
MySQL_DROP_PRIV
|
static java.lang.String |
MySQL_INSERT_PRIV
|
static java.lang.String |
MySQL_LOCK_TABLES_PRIV
|
static java.lang.String |
MySQL_SELECT_PRIV
MySQL privs granted to admins for survey databases. |
static java.lang.String |
MySQL_UPDATE_PRIV
|
Fields inherited from interface cmu.survey.data.DatabaseStorage |
---|
READ, WRITE |
Constructor Summary | |
---|---|
DatabaseStorageMySQL(java.lang.String connectionString)
|
Method Summary | |
---|---|
void |
close()
|
void |
connect()
Connect to the database. |
static boolean |
copyPropertiesTo(HasKeyValues copyFromProperties,
KeyValuesModifiable copyToProperties)
|
boolean |
createDatabase(java.lang.String databaseName)
|
void |
createDatabaseUser(java.lang.String userName,
java.lang.String password)
|
boolean |
deleteDatabase(java.lang.String databaseName)
|
void |
deleteDatabaseUser(java.lang.String username)
|
boolean |
doesDatabaseExist(java.lang.String databaseName)
|
void |
finalize()
|
java.util.Vector<java.lang.String> |
getAccessibleDatabases()
|
java.util.List<DatabaseStorage.UserDatabase> |
getCurrentUsers()
Get the current users connected to databases. |
static java.lang.String |
getDatabaseConnectionStringFrom(HasKeyValues properties,
Dialogs dialogs)
|
static java.lang.String |
getDatabaseConnectionStringFrom(HasKeyValues properties,
java.lang.String databaseUser,
java.lang.String password)
|
java.lang.String |
getDatabaseHelpURL()
Optionally, return a URL as a string that the user can go to for help installing and running this database, especially when it doesn't work, etc. |
HasKeyValues |
getDatabaseKeyValuesForDatabase(java.lang.String hostName,
java.lang.String databaseName,
java.lang.String userID,
java.lang.String password)
|
static HasKeyValues |
getDatabaseKeyValuesForDatabaseStatic(java.lang.String hostName,
java.lang.String databaseName,
java.lang.String userID,
java.lang.String password)
|
java.lang.String |
getDatabaseName()
Optionally, return a database name for the user to se. |
java.lang.String |
getDatabaseStringForDatabase(java.lang.String hostName,
java.lang.String databaseName,
java.lang.String userID,
java.lang.String password)
|
static java.lang.String |
getDatabaseStringForDatabaseStatic(java.lang.String hostName,
java.lang.String databaseName,
java.lang.String userID,
java.lang.String password)
|
static java.lang.String |
getPassword(HasKeyValues properties)
|
static java.lang.String |
getUser(HasKeyValues properties)
|
boolean |
grantDatabasePrivs(java.lang.String dbname,
java.lang.String userName,
java.lang.String priv)
Attempts to grant the given privilege for a given user on a given database. |
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)
|
void |
renameDatabaseUser(java.lang.String username,
java.lang.String newUsername)
|
boolean |
revokeDatabasePrivs(java.lang.String dbname,
java.lang.String userName,
java.lang.String priv)
Attempts to revoke the given privilege for a given user on a given database. |
void |
updateDatabaseUser(java.lang.String username,
java.lang.String password)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MySQL_SELECT_PRIV
public static final java.lang.String MySQL_INSERT_PRIV
public static final java.lang.String MySQL_DELETE_PRIV
public static final java.lang.String MySQL_LOCK_TABLES_PRIV
public static final java.lang.String MySQL_UPDATE_PRIV
public static final java.lang.String MySQL_ALTER_PRIV
public static final java.lang.String MySQL_CREATE_PRIV
public static final java.lang.String MySQL_DROP_PRIV
Constructor Detail |
---|
public DatabaseStorageMySQL(java.lang.String connectionString) throws java.lang.Throwable
java.lang.Throwable
Method Detail |
---|
public void connect() throws java.lang.Throwable
DatabaseStorage
connect
in interface DatabaseStorage
java.lang.Throwable
public static java.lang.String getDatabaseConnectionStringFrom(HasKeyValues properties, java.lang.String databaseUser, java.lang.String password)
public static final java.lang.String getDatabaseStringForDatabaseStatic(java.lang.String hostName, java.lang.String databaseName, java.lang.String userID, java.lang.String password)
public static final HasKeyValues getDatabaseKeyValuesForDatabaseStatic(java.lang.String hostName, java.lang.String databaseName, java.lang.String userID, java.lang.String password)
public static java.lang.String getDatabaseConnectionStringFrom(HasKeyValues properties, Dialogs dialogs)
public java.lang.String getDatabaseStringForDatabase(java.lang.String hostName, java.lang.String databaseName, java.lang.String userID, java.lang.String password)
getDatabaseStringForDatabase
in interface DatabaseStorage
public HasKeyValues getDatabaseKeyValuesForDatabase(java.lang.String hostName, java.lang.String databaseName, java.lang.String userID, java.lang.String password)
getDatabaseKeyValuesForDatabase
in interface DatabaseStorage
public static final java.lang.String getUser(HasKeyValues properties)
public static final java.lang.String getPassword(HasKeyValues properties)
public static boolean copyPropertiesTo(HasKeyValues copyFromProperties, KeyValuesModifiable copyToProperties)
public static boolean propertiesAreEqual(HasKeyValues propA, HasKeyValues propB)
public static boolean isPropertiesSameDataSource(HasKeyValues propA, HasKeyValues propB)
public static boolean isPossibleDataSource(HasKeyValues propA)
propA
-
public java.util.Vector<java.lang.String> getAccessibleDatabases()
getAccessibleDatabases
in interface DatabaseStorage
public boolean doesDatabaseExist(java.lang.String databaseName)
doesDatabaseExist
in interface DatabaseStorage
public boolean createDatabase(java.lang.String databaseName)
createDatabase
in interface DatabaseStorage
public boolean deleteDatabase(java.lang.String databaseName)
deleteDatabase
in interface DatabaseStorage
public void close()
close
in interface DatabaseStorage
public void finalize()
finalize
in class java.lang.Object
public boolean revokeDatabasePrivs(java.lang.String dbname, java.lang.String userName, java.lang.String priv)
revokeDatabasePrivs
in interface DatabaseStorage
dbname
- The database to operate on.userName
- The user to operate on.priv
- The privledge to operate on. Should be one of the constants defined in DatabaseStorageMySQL.grant
- Whether to grant or revoke this privilege.
public boolean grantDatabasePrivs(java.lang.String dbname, java.lang.String userName, java.lang.String priv)
grantDatabasePrivs
in interface DatabaseStorage
dbname
- The database to operate on.userName
- The user to operate on.userPassword
- The password of the user to operate on.priv
- The privledge to operate on. Should be one of the constants defined in DatabaseStorageMySQL.grant
- Whether to grant or revoke this privilege.
public void createDatabaseUser(java.lang.String userName, java.lang.String password)
createDatabaseUser
in interface DatabaseStorage
public void updateDatabaseUser(java.lang.String username, java.lang.String password)
updateDatabaseUser
in interface DatabaseStorage
public void renameDatabaseUser(java.lang.String username, java.lang.String newUsername)
renameDatabaseUser
in interface DatabaseStorage
public void deleteDatabaseUser(java.lang.String username)
deleteDatabaseUser
in interface DatabaseStorage
public java.util.List<DatabaseStorage.UserDatabase> getCurrentUsers()
DatabaseStorage
getCurrentUsers
in interface DatabaseStorage
public java.lang.String getDatabaseName()
DatabaseStorage
getDatabaseName
in interface DatabaseStorage
public java.lang.String getDatabaseHelpURL()
DatabaseStorage
getDatabaseHelpURL
in interface DatabaseStorage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |