|
||||||||||
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 Map<String,Set<String>> |
materializedViewsToPreserve
Names of materialized views that should not be dropped per schema. |
static String |
PROPKEY_PRESERVE_MATERIALIZED_VIEWS
The key of the property that specifies which materialized views should not be dropped |
static String |
PROPKEY_PRESERVE_SCHEMAS
The key of the property that specifies of which schemas nothing should be dropped |
static String |
PROPKEY_PRESERVE_SEQUENCES
The key of the property that specifies which sequences should not be dropped |
static String |
PROPKEY_PRESERVE_SYNONYMS
The key of the property that specifies which synonyms should not be dropped |
static String |
PROPKEY_PRESERVE_TABLES
The key of the property that specifies which tables should not be dropped |
static String |
PROPKEY_PRESERVE_TRIGGERS
The key of the property that specifies which triggers should not be dropped |
static String |
PROPKEY_PRESERVE_TYPES
The key of the property that specifies which types should not be dropped |
static String |
PROPKEY_PRESERVE_VIEWS
The key of the property that specifies which views should not be dropped |
static 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 Set<String> |
schemasToPreserve
Names of schemas that should left untouched. |
protected Map<String,Set<String>> |
sequencesToPreserve
Names of sequences that should not be dropped per schema. |
protected Map<String,Set<String>> |
synonymsToPreserve
Names of synonyms that should not be dropped per schema. |
protected Map<String,Set<String>> |
tablesToPreserve
Names of tables that should not be dropped per schema. |
protected Map<String,Set<String>> |
triggersToPreserve
Names of triggers that should not be dropped per schema. |
protected Map<String,Set<String>> |
typesToPreserve
Names of types that should not be dropped per schema. |
protected Map<String,Set<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(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 Map<String,Set<String>> |
getItemsToPreserve(String propertyName)
Gets the list of items to preserve per schema. |
protected Map<String,Set<String>> |
getMaterializedViewsToPreserve()
Gets the list of all materialized views to preserve per schema. |
protected Set<String> |
getSchemasToPreserve(Properties configuration)
Gets the list of all schemas to preserve. |
protected Map<String,Set<String>> |
getSequencesToPreserve()
Gets the list of all sequences to preserve per schema. |
protected Map<String,Set<String>> |
getSynonymsToPreserve()
Gets the list of all synonym to preserve per schema. |
protected Map<String,Set<String>> |
getTablesToPreserve()
Gets the list of all tables to preserve per schema. |
protected Map<String,Set<String>> |
getTriggersToPreserve()
Gets the list of all triggers to preserve per schema. |
protected Map<String,Set<String>> |
getTypesToPreserve()
Gets the list of all types to preserve per schema. |
protected Map<String,Set<String>> |
getViewsToPreserve()
Gets the list of all views to preserve per schema. |
protected boolean |
isItemToPreserve(String item,
Set<String> itemsToPreserve)
Checks whether the given item is one of the items to preserve. |
protected boolean |
itemToPreserveExists(String itemToPreserve,
Set<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 String PROPKEY_PRESERVE_SCHEMAS
public static final String PROPKEY_PRESERVE_TABLES
public static final String PROPKEY_PRESERVE_VIEWS
public static final String PROPKEY_PRESERVE_MATERIALIZED_VIEWS
public static final String PROPKEY_PRESERVE_SYNONYMS
public static final String PROPKEY_PRESERVE_SEQUENCES
public static final String PROPKEY_PRESERVE_TRIGGERS
public static final String PROPKEY_PRESERVE_TYPES
public static final String PROPKEY_VERSION_TABLE_NAME
protected Set<String> schemasToPreserve
protected Map<String,Set<String>> tablesToPreserve
protected Map<String,Set<String>> viewsToPreserve
protected Map<String,Set<String>> materializedViewsToPreserve
protected Map<String,Set<String>> synonymsToPreserve
protected Map<String,Set<String>> sequencesToPreserve
protected Map<String,Set<String>> triggersToPreserve
protected Map<String,Set<String>> typesToPreserve
Constructor Detail |
---|
public DefaultDBClearer()
Method Detail |
---|
protected void doInit(Properties configuration)
Configuration
object.
doInit
in class BaseDatabaseAccessor
configuration
- the config, not nullpublic void clearSchemas()
clearSchemas
in interface DBClearer
protected 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 Set<String> getSchemasToPreserve(Properties configuration)
configuration
- The unitils configuration, not null
protected Map<String,Set<String>> getTablesToPreserve()
protected Map<String,Set<String>> getViewsToPreserve()
protected Map<String,Set<String>> getMaterializedViewsToPreserve()
protected Map<String,Set<String>> getSequencesToPreserve()
protected Map<String,Set<String>> getSynonymsToPreserve()
protected Map<String,Set<String>> getTriggersToPreserve()
protected Map<String,Set<String>> getTypesToPreserve()
protected boolean isItemToPreserve(String item, Set<String> itemsToPreserve)
item
- The item, not nullitemsToPreserve
- The items to preserve
protected boolean itemToPreserveExists(String itemToPreserve, Set<String> items)
itemToPreserve
- The item to preserve, not nullitems
- The items, not null
protected Map<String,Set<String>> getItemsToPreserve(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 |