|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.unitils.dbmaintainer.util.BaseDatabaseAccessor
org.unitils.dbmaintainer.clean.impl.DefaultDBClearer
public class DefaultDBClearer
Implementation of DBClearer. This implementation individually drops every table, view, constraint, trigger
and sequence in the database. A list of tables, views, ... that should be preserverd can be specified using the
property PROPKEY_PRESERVE_TABLES.
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
materializedViewsToPreserve
Names of materialized views that should not be dropped per schema. |
static java.lang.String |
PROPKEY_PRESERVE_MATERIALIZED_VIEWS
The key of the property that specifies which materialized views should not be dropped |
static java.lang.String |
PROPKEY_PRESERVE_SCHEMAS
The key of the property that specifies of which schemas nothing should be dropped |
static java.lang.String |
PROPKEY_PRESERVE_SEQUENCES
The key of the property that specifies which sequences should not be dropped |
static java.lang.String |
PROPKEY_PRESERVE_SYNONYMS
The key of the property that specifies which synonyms should not be dropped |
static java.lang.String |
PROPKEY_PRESERVE_TABLES
The key of the property that specifies which tables should not be dropped |
static java.lang.String |
PROPKEY_PRESERVE_TRIGGERS
The key of the property that specifies which triggers should not be dropped |
static java.lang.String |
PROPKEY_PRESERVE_TYPES
The key of the property that specifies which types should not be dropped |
static java.lang.String |
PROPKEY_PRESERVE_VIEWS
The key of the property that specifies which views should not be dropped |
static java.lang.String |
PROPKEY_VERSION_TABLE_NAME
The key of the property that specifies the name of the datase table in which the DB version is stored. |
protected java.util.Set<java.lang.String> |
schemasToPreserve
Names of schemas that should left untouched. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
sequencesToPreserve
Names of sequences that should not be dropped per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
synonymsToPreserve
Names of synonyms that should not be dropped per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
tablesToPreserve
Names of tables that should not be dropped per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
triggersToPreserve
Names of triggers that should not be dropped per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
typesToPreserve
Names of types that should not be dropped per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
viewsToPreserve
Names of views that should not be dropped per schema. |
| Fields inherited from class org.unitils.dbmaintainer.util.BaseDatabaseAccessor |
|---|
configuration, dbSupports, defaultDbSupport, sqlHandler |
| Constructor Summary | |
|---|---|
DefaultDBClearer()
|
|
| Method Summary | |
|---|---|
void |
clearSchemas()
Clears the database schemas. |
protected void |
doInit(java.util.Properties configuration)
Initializes the the DBClearer. |
protected void |
dropMaterializedViews(DbSupport dbSupport)
Drops all materialized views. |
protected void |
dropSequences(DbSupport dbSupport)
Drops all sequences |
protected void |
dropSynonyms(DbSupport dbSupport)
Drops all synonyms |
protected void |
dropTables(DbSupport dbSupport)
Drops all tables. |
protected void |
dropTriggers(DbSupport dbSupport)
Drops all triggers |
protected void |
dropTypes(DbSupport dbSupport)
Drops all types. |
protected void |
dropViews(DbSupport dbSupport)
Drops all views. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getItemsToPreserve(java.lang.String propertyName)
Gets the list of items to preserve per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getMaterializedViewsToPreserve()
Gets the list of all materialized views to preserve per schema. |
protected java.util.Set<java.lang.String> |
getSchemasToPreserve(java.util.Properties configuration)
Gets the list of all schemas to preserve. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getSequencesToPreserve()
Gets the list of all sequences to preserve per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getSynonymsToPreserve()
Gets the list of all synonym to preserve per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getTablesToPreserve()
Gets the list of all tables to preserve per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getTriggersToPreserve()
Gets the list of all triggers to preserve per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getTypesToPreserve()
Gets the list of all types to preserve per schema. |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getViewsToPreserve()
Gets the list of all views to preserve per schema. |
protected boolean |
isItemToPreserve(java.lang.String item,
java.util.Set<java.lang.String> itemsToPreserve)
Checks whether the given item is one of the items to preserve. |
protected boolean |
itemToPreserveExists(java.lang.String itemToPreserve,
java.util.Set<java.lang.String> items)
Checks whether the given item to preserve is one of the items. |
| Methods inherited from class org.unitils.dbmaintainer.util.BaseDatabaseAccessor |
|---|
getDbSupport, init |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.unitils.dbmaintainer.util.DatabaseAccessing |
|---|
init |
| Field Detail |
|---|
public static final java.lang.String PROPKEY_PRESERVE_SCHEMAS
public static final java.lang.String PROPKEY_PRESERVE_TABLES
public static final java.lang.String PROPKEY_PRESERVE_VIEWS
public static final java.lang.String PROPKEY_PRESERVE_MATERIALIZED_VIEWS
public static final java.lang.String PROPKEY_PRESERVE_SYNONYMS
public static final java.lang.String PROPKEY_PRESERVE_SEQUENCES
public static final java.lang.String PROPKEY_PRESERVE_TRIGGERS
public static final java.lang.String PROPKEY_PRESERVE_TYPES
public static final java.lang.String PROPKEY_VERSION_TABLE_NAME
protected java.util.Set<java.lang.String> schemasToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tablesToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> viewsToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> materializedViewsToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> synonymsToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> sequencesToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> triggersToPreserve
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> typesToPreserve
| Constructor Detail |
|---|
public DefaultDBClearer()
| Method Detail |
|---|
protected void doInit(java.util.Properties configuration)
Configuration object.
doInit in class BaseDatabaseAccessorconfiguration - the config, not nullpublic void clearSchemas()
clearSchemas in interface DBClearerprotected void dropTables(DbSupport dbSupport)
dbSupport - The database support, not nullprotected void dropViews(DbSupport dbSupport)
dbSupport - The database support, not nullprotected void dropMaterializedViews(DbSupport dbSupport)
dbSupport - The database support, not nullprotected void dropSynonyms(DbSupport dbSupport)
dbSupport - The database support, not nullprotected void dropSequences(DbSupport dbSupport)
dbSupport - The database support, not nullprotected void dropTriggers(DbSupport dbSupport)
dbSupport - The database support, not nullprotected void dropTypes(DbSupport dbSupport)
dbSupport - The database support, not nullprotected java.util.Set<java.lang.String> getSchemasToPreserve(java.util.Properties configuration)
configuration - The unitils configuration, not null
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getTablesToPreserve()
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getViewsToPreserve()
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getMaterializedViewsToPreserve()
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getSequencesToPreserve()
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getSynonymsToPreserve()
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getTriggersToPreserve()
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getTypesToPreserve()
protected boolean isItemToPreserve(java.lang.String item,
java.util.Set<java.lang.String> itemsToPreserve)
item - The item, not nullitemsToPreserve - The items to preserve
protected boolean itemToPreserveExists(java.lang.String itemToPreserve,
java.util.Set<java.lang.String> items)
itemToPreserve - The item to preserve, not nullitems - The items, not null
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getItemsToPreserve(java.lang.String propertyName)
propertyName - The name of the property that defines the items, not null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||