cmu.survey.data
Interface DatabaseStorage

All Known Implementing Classes:
DatabaseStorageMySQL

public interface DatabaseStorage


Nested Class Summary
static class DatabaseStorage.UserDatabase
          Info about a connection to the database that a user has.
 
Field Summary
static java.lang.String READ
           
static java.lang.String WRITE
           
 
Method Summary
 void close()
           
 void connect()
          Connect to the database.
 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)
           
 java.util.Vector getAccessibleDatabases()
           
 java.util.List<DatabaseStorage.UserDatabase> getCurrentUsers()
          Get the current users connected to databases.
 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)
           
 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)
           
 boolean grantDatabasePrivs(java.lang.String dbname, java.lang.String userName, java.lang.String priv)
           
 void renameDatabaseUser(java.lang.String username, java.lang.String newUsername)
           
 boolean revokeDatabasePrivs(java.lang.String dbname, java.lang.String userName, java.lang.String priv)
           
 void updateDatabaseUser(java.lang.String username, java.lang.String password)
           
 

Field Detail

READ

static final java.lang.String READ
See Also:
Constant Field Values

WRITE

static final java.lang.String WRITE
See Also:
Constant Field Values
Method Detail

connect

void connect()
             throws java.lang.Throwable
Connect to the database. It is required that you call this before using it. This can be called multiple times -- if it is called after it's already connected, it will do nothing new.

Throws:
java.lang.Throwable

getDatabaseStringForDatabase

java.lang.String getDatabaseStringForDatabase(java.lang.String hostName,
                                              java.lang.String databaseName,
                                              java.lang.String userID,
                                              java.lang.String password)

getDatabaseKeyValuesForDatabase

HasKeyValues getDatabaseKeyValuesForDatabase(java.lang.String hostName,
                                             java.lang.String databaseName,
                                             java.lang.String userID,
                                             java.lang.String password)

getAccessibleDatabases

java.util.Vector getAccessibleDatabases()

createDatabase

boolean createDatabase(java.lang.String databaseName)

deleteDatabase

boolean deleteDatabase(java.lang.String databaseName)

doesDatabaseExist

boolean doesDatabaseExist(java.lang.String databaseName)

getCurrentUsers

java.util.List<DatabaseStorage.UserDatabase> getCurrentUsers()
Get the current users connected to databases. This is not required to be implemented -- if it's not implemented, it should return null.

Returns:
array of UserDatabase[number of connections]

close

void close()

getDatabaseName

java.lang.String getDatabaseName()
Optionally, return a database name for the user to se.

Returns:

getDatabaseHelpURL

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.

Returns:

revokeDatabasePrivs

boolean revokeDatabasePrivs(java.lang.String dbname,
                            java.lang.String userName,
                            java.lang.String priv)

grantDatabasePrivs

boolean grantDatabasePrivs(java.lang.String dbname,
                           java.lang.String userName,
                           java.lang.String priv)

createDatabaseUser

void createDatabaseUser(java.lang.String username,
                        java.lang.String password)

updateDatabaseUser

void updateDatabaseUser(java.lang.String username,
                        java.lang.String password)

renameDatabaseUser

void renameDatabaseUser(java.lang.String username,
                        java.lang.String newUsername)

deleteDatabaseUser

void deleteDatabaseUser(java.lang.String username)