public class DBAdmin extends MetacatAdmin
| Modifier and Type | Field and Description |
|---|---|
static int |
DB_DOES_NOT_EXIST |
static int |
TABLES_DO_NOT_EXIST |
static int |
TABLES_EXIST |
static int |
VERSION_ACTIVE |
static int |
VERSION_INACTIVE |
| Modifier and Type | Method and Description |
|---|---|
void |
configureDatabase(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle configuration of the database the first time that Metacat starts
or when it is explicitly called.
|
int |
getDBStatus()
Performs a status check on the database.
|
DBVersion |
getDBVersion()
Get the version of the database as a string
|
static DBAdmin |
getInstance()
Get the single instance of DBAdmin.
|
DBVersion |
getUnRegisteredDBVersion()
Finds the version of the database for a database that does not have a
dbVersion table yet.
|
java.util.Vector<java.lang.String> |
getUpdateClasses() |
java.util.Vector<java.lang.String> |
getUpdateScripts()
Creates a list of database update script names by looking at the database
version and the metacat version and then getting any script that is
inbetween the two (inclusive of metacat version).
|
java.util.Vector<java.lang.String> |
loadSQLFromFile(java.lang.String sqlFileName)
Very basic utility to read sql from a file and return a vector of the
individual sql statements.
|
void |
runSQLFile(java.lang.String sqlFileName)
Runs the commands in a sql script.
|
void |
updateDBVersion()
Updates the version of the database.
|
void |
upgradeDatabase()
Iterates through the list of scripts that need to be run to upgrade
the database and calls runSQLFile on each.
|
java.lang.String |
validateDBConnectivity(java.lang.String dbDriver,
java.lang.String connection,
java.lang.String user,
java.lang.String password)
Validate connectivity to the database.
|
protected java.util.Vector<java.lang.String> |
validateOptions(javax.servlet.http.HttpServletRequest request)
Validate the most important configuration options submitted by the user.
|
public static final int DB_DOES_NOT_EXIST
public static final int TABLES_DO_NOT_EXIST
public static final int TABLES_EXIST
public static final int VERSION_INACTIVE
public static final int VERSION_ACTIVE
public static DBAdmin getInstance() throws AdminException
AdminExceptionpublic void configureDatabase(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws AdminException
request - the http request informationresponse - the http response to be sent back to the clientAdminExceptionpublic int getDBStatus()
throws java.sql.SQLException,
edu.ucsb.nceas.utilities.PropertyNotFoundException
java.sql.SQLExceptionedu.ucsb.nceas.utilities.PropertyNotFoundExceptionpublic DBVersion getDBVersion() throws AdminException
AdminExceptionpublic DBVersion getUnRegisteredDBVersion() throws AdminException, java.sql.SQLException
AdminExceptionjava.sql.SQLExceptionpublic void updateDBVersion()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String validateDBConnectivity(java.lang.String dbDriver,
java.lang.String connection,
java.lang.String user,
java.lang.String password)
dbDriver - the database driverconnection - the jdbc connection stringuser - the user namepassword - the login passwordpublic java.util.Vector<java.lang.String> getUpdateScripts()
throws AdminException
AdminExceptionpublic java.util.Vector<java.lang.String> getUpdateClasses()
throws AdminException
AdminExceptionpublic void upgradeDatabase()
throws AdminException
AdminExceptionpublic void runSQLFile(java.lang.String sqlFileName)
throws AdminException,
java.sql.SQLException
sqlFileName - the name of the file holding the sql statements that need to
get run.AdminExceptionjava.sql.SQLExceptionpublic java.util.Vector<java.lang.String> loadSQLFromFile(java.lang.String sqlFileName)
throws java.io.IOException
sqlFileName - the name of the file to read.java.io.IOExceptionprotected java.util.Vector<java.lang.String> validateOptions(javax.servlet.http.HttpServletRequest request)
validateOptions in class MetacatAdminCopyright © 2020 Regents of the University of California. All Rights Reserved.