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