org.opennms.netmgt.dao.db
Class InstallerDb
java.lang.Object
org.opennms.netmgt.dao.db.InstallerDb
public class InstallerDb
- extends Object
|
Method Summary |
void |
addColumnReplacement(String tableColumn,
ColumnChangeReplacement replacement)
|
void |
addColumnReplacements()
|
void |
addIndexesForTable(String table)
|
void |
addStoredProcedures()
|
void |
addTriggersForTable(String table)
|
void |
changeTable(String table,
Table oldTable,
Table newTable)
|
void |
checkConstraint(Constraint constraint)
|
void |
checkConstraints()
|
void |
checkIndexUniqueness()
|
void |
checkOldTables()
|
void |
checkUnicode()
|
static String |
cleanText(List<String> list)
|
void |
closeAdminConnection()
|
void |
closeColumnReplacements()
|
void |
closeConnection()
|
void |
createSequences()
|
void |
createTables()
|
void |
databaseAddDB()
|
void |
databaseAddUser()
|
void |
databaseCheckLanguage()
|
void |
databaseCheckVersion()
|
boolean |
databaseDBExists()
|
void |
databaseRemoveDB()
|
boolean |
databaseUserExists()
|
void |
disconnect()
Close all connections to the database. |
Column |
findColumn(List<Column> columns,
String column)
|
String |
fixConstraint(Constraint constraint,
boolean removeRows)
|
void |
fixConstraint(String constraintName,
boolean removeRows)
|
void |
fixData()
|
boolean |
functionExists(String function,
int[] columnTypes,
int retType)
|
boolean |
functionExists(String function,
String columns,
String returnType)
|
DataSource |
getAdminDataSource()
|
List<Column> |
getColumnsFromDB(String tableName)
|
List<Constraint> |
getConstraintsFromDB(String tableName)
|
String |
getCreateSqlLocation()
|
String |
getDatabaseName()
|
DataSource |
getDataSource()
|
boolean |
getDebug()
|
boolean |
getForce()
|
String |
getForeignConstraintWhere(String table,
List<String> columns,
String ftable,
List<String> fcolumns)
|
List<Constraint> |
getForeignKeyConstraints()
|
String |
getFunctionFromSQL(String function)
|
IndexDao |
getIndexDao()
|
String |
getIndexFromSQL(String index)
|
Map<String,List<InstallerDb.Insert>> |
getInserts()
|
String |
getLanguageFromSQL(String language)
|
String |
getPgIpLikeLocation()
|
String |
getPostgresOpennmsPassword()
|
String |
getPostgresOpennmsUser()
|
String[] |
getSequenceMapping(String sequence)
|
List<String> |
getSequenceNames()
|
String |
getSql()
|
String |
getStoredProcedureDirectory()
|
List<Column> |
getTableColumnsFromDB(String tableName)
|
List<Column> |
getTableColumnsFromSQL(String tableName)
|
String |
getTableCreateFromSQL(String table)
|
Table |
getTableFromDB(String tableName)
|
Table |
getTableFromSQL(String tableName)
|
List<String> |
getTableNames()
|
TriggerDao |
getTriggerDao()
|
Map<String,Integer> |
getTypesFromDB()
|
String |
getXFromSQL(String item,
String regex,
int itemGroup,
int returnGroup,
String description)
|
void |
grantAccessToObject(String object,
int indent)
|
boolean |
hasTableChanged(String table)
|
void |
insertData()
|
boolean |
isIpLikeUsable()
|
String |
notNullWhereClause(String table,
List<String> columns)
|
void |
readTables()
|
void |
readTables(Reader reader)
|
void |
setAdminDataSource(DataSource dataSource)
|
void |
setCreateSqlLocation(String createSqlLocation)
|
void |
setDatabaseName(String name)
|
void |
setDataSource(DataSource dataSource)
|
void |
setDebug(boolean debug)
|
void |
setForce(boolean force)
|
void |
setIgnoreNotNull(boolean ignoreNotNull)
|
void |
setNoRevert(boolean noRevert)
|
void |
setOutputStream(PrintStream out)
|
void |
setPostgresIpLikeLocation(String location)
|
void |
setPostgresOpennmsPassword(String password)
|
void |
setPostgresOpennmsUser(String user)
|
void |
setStoredProcedureDirectory(String directory)
|
void |
setupPlPgsqlIplike()
|
void |
tableChanged(String table)
|
boolean |
tableColumnExists(String table,
String column)
|
List<String> |
tableColumnList(String table,
List<String> columns)
|
boolean |
tableExists(String table)
|
void |
transformData(String table,
String oldTable,
TreeMap<String,ColumnChange> columnChanges,
String[] oldColumnNames)
|
void |
updateIplike()
|
void |
updatePlPgsql()
|
void |
vacuumDatabase(boolean full)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
POSTGRES_MIN_VERSION
public static final float POSTGRES_MIN_VERSION
- See Also:
- Constant Field Values
POSTGRES_MAX_VERSION_PLUS_ONE
public static final float POSTGRES_MAX_VERSION_PLUS_ONE
- See Also:
- Constant Field Values
InstallerDb
public InstallerDb()
readTables
public void readTables()
throws Exception
- Throws:
Exception
readTables
public void readTables(Reader reader)
throws Exception
- Throws:
Exception
cleanText
public static String cleanText(List<String> list)
createSequences
public void createSequences()
throws Exception
- Throws:
Exception
updatePlPgsql
public void updatePlPgsql()
throws Exception
- Throws:
Exception
isIpLikeUsable
public boolean isIpLikeUsable()
updateIplike
public void updateIplike()
throws Exception
- Throws:
Exception
setupPlPgsqlIplike
public void setupPlPgsqlIplike()
throws Exception
- Throws:
Exception
addStoredProcedures
public void addStoredProcedures()
throws Exception
- Throws:
Exception
functionExists
public boolean functionExists(String function,
String columns,
String returnType)
throws Exception
- Throws:
Exception
functionExists
public boolean functionExists(String function,
int[] columnTypes,
int retType)
throws Exception
- Throws:
Exception
getTypesFromDB
public Map<String,Integer> getTypesFromDB()
throws SQLException
- Throws:
SQLException
addTriggersForTable
public void addTriggersForTable(String table)
throws SQLException
- Throws:
SQLException
createTables
public void createTables()
throws Exception
- Throws:
Exception
getTableFromSQL
public Table getTableFromSQL(String tableName)
throws Exception
- Throws:
Exception
getXFromSQL
public String getXFromSQL(String item,
String regex,
int itemGroup,
int returnGroup,
String description)
throws Exception
- Throws:
Exception
findColumn
public Column findColumn(List<Column> columns,
String column)
tableColumnExists
public boolean tableColumnExists(String table,
String column)
throws Exception
- Throws:
Exception
getTableColumnsFromDB
public List<Column> getTableColumnsFromDB(String tableName)
throws Exception
- Throws:
Exception
getTableFromDB
public Table getTableFromDB(String tableName)
throws Exception
- Throws:
Exception
tableExists
public boolean tableExists(String table)
throws SQLException
- Throws:
SQLException
getColumnsFromDB
public List<Column> getColumnsFromDB(String tableName)
throws Exception
- Throws:
Exception
getConstraintsFromDB
public List<Constraint> getConstraintsFromDB(String tableName)
throws SQLException,
Exception
- Throws:
SQLException
Exception
changeTable
public void changeTable(String table,
Table oldTable,
Table newTable)
throws Exception
- Throws:
Exception
transformData
public void transformData(String table,
String oldTable,
TreeMap<String,ColumnChange> columnChanges,
String[] oldColumnNames)
throws SQLException,
ParseException,
Exception
- Throws:
SQLException
ParseException
Exception
databaseCheckVersion
public void databaseCheckVersion()
throws Exception
- Throws:
Exception
databaseCheckLanguage
public void databaseCheckLanguage()
throws Exception
- Throws:
Exception
checkOldTables
public void checkOldTables()
throws SQLException,
BackupTablesFoundException
- Throws:
SQLException
BackupTablesFoundException
getForeignKeyConstraints
public List<Constraint> getForeignKeyConstraints()
throws Exception
- Throws:
Exception
checkConstraints
public void checkConstraints()
throws Exception
- Throws:
Exception
checkConstraint
public void checkConstraint(Constraint constraint)
throws Exception
- Throws:
Exception
getForeignConstraintWhere
public String getForeignConstraintWhere(String table,
List<String> columns,
String ftable,
List<String> fcolumns)
throws Exception
- Throws:
Exception
notNullWhereClause
public String notNullWhereClause(String table,
List<String> columns)
tableColumnList
public List<String> tableColumnList(String table,
List<String> columns)
fixConstraint
public void fixConstraint(String constraintName,
boolean removeRows)
throws Exception
- Throws:
Exception
fixConstraint
public String fixConstraint(Constraint constraint,
boolean removeRows)
throws Exception
- Throws:
Exception
databaseUserExists
public boolean databaseUserExists()
throws SQLException
- Throws:
SQLException
databaseAddUser
public void databaseAddUser()
throws SQLException
- Throws:
SQLException
databaseDBExists
public boolean databaseDBExists()
throws SQLException
- Throws:
SQLException
databaseAddDB
public void databaseAddDB()
throws Exception
- Throws:
Exception
databaseRemoveDB
public void databaseRemoveDB()
throws SQLException
- Throws:
SQLException
addIndexesForTable
public void addIndexesForTable(String table)
throws SQLException
- Throws:
SQLException
grantAccessToObject
public void grantAccessToObject(String object,
int indent)
throws SQLException
- Throws:
SQLException
fixData
public void fixData()
throws Exception
- Throws:
Exception
insertData
public void insertData()
throws Exception
- Throws:
Exception
checkUnicode
public void checkUnicode()
throws Exception
- Throws:
Exception
checkIndexUniqueness
public void checkIndexUniqueness()
throws Exception
- Throws:
Exception
getTableColumnsFromSQL
public List<Column> getTableColumnsFromSQL(String tableName)
throws Exception
- Throws:
Exception
getTableCreateFromSQL
public String getTableCreateFromSQL(String table)
throws Exception
- Throws:
Exception
getIndexFromSQL
public String getIndexFromSQL(String index)
throws Exception
- Throws:
Exception
getFunctionFromSQL
public String getFunctionFromSQL(String function)
throws Exception
- Throws:
Exception
getLanguageFromSQL
public String getLanguageFromSQL(String language)
throws Exception
- Throws:
Exception
closeConnection
public void closeConnection()
throws SQLException
- Throws:
SQLException
closeAdminConnection
public void closeAdminConnection()
throws SQLException
- Throws:
SQLException
disconnect
public void disconnect()
throws SQLException
- Close all connections to the database.
- Throws:
SQLException
setCreateSqlLocation
public void setCreateSqlLocation(String createSqlLocation)
getCreateSqlLocation
public String getCreateSqlLocation()
getTableNames
public List<String> getTableNames()
getSequenceNames
public List<String> getSequenceNames()
getSequenceMapping
public String[] getSequenceMapping(String sequence)
getIndexDao
public IndexDao getIndexDao()
getInserts
public Map<String,List<InstallerDb.Insert>> getInserts()
getSql
public String getSql()
hasTableChanged
public boolean hasTableChanged(String table)
tableChanged
public void tableChanged(String table)
setOutputStream
public void setOutputStream(PrintStream out)
getTriggerDao
public TriggerDao getTriggerDao()
setStoredProcedureDirectory
public void setStoredProcedureDirectory(String directory)
getStoredProcedureDirectory
public String getStoredProcedureDirectory()
setDataSource
public void setDataSource(DataSource dataSource)
getDataSource
public DataSource getDataSource()
setAdminDataSource
public void setAdminDataSource(DataSource dataSource)
getAdminDataSource
public DataSource getAdminDataSource()
setForce
public void setForce(boolean force)
getForce
public boolean getForce()
setDebug
public void setDebug(boolean debug)
getDebug
public boolean getDebug()
addColumnReplacement
public void addColumnReplacement(String tableColumn,
ColumnChangeReplacement replacement)
setIgnoreNotNull
public void setIgnoreNotNull(boolean ignoreNotNull)
getDatabaseName
public String getDatabaseName()
setDatabaseName
public void setDatabaseName(String name)
setNoRevert
public void setNoRevert(boolean noRevert)
setPostgresOpennmsUser
public void setPostgresOpennmsUser(String user)
getPostgresOpennmsUser
public String getPostgresOpennmsUser()
setPostgresOpennmsPassword
public void setPostgresOpennmsPassword(String password)
getPostgresOpennmsPassword
public String getPostgresOpennmsPassword()
setPostgresIpLikeLocation
public void setPostgresIpLikeLocation(String location)
getPgIpLikeLocation
public String getPgIpLikeLocation()
addColumnReplacements
public void addColumnReplacements()
throws SQLException
- Throws:
SQLException
closeColumnReplacements
public void closeColumnReplacements()
throws SQLException
- Throws:
SQLException
vacuumDatabase
public void vacuumDatabase(boolean full)
throws SQLException
- Throws:
SQLException
Copyright © 2009. All Rights Reserved.