You are looking at documentation for an older release. Not what you want? See the current release documentation.
It is a special service for data removal from database. The section shortly describes the working principles of DBCleanerTool under all databases.
Code that invokes the methods of DBCleanService must have the JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION permission.
There are several methods of DBCleanService:
public static void cleanWorkspaceData(WorkspaceEntry wsEntry) throws DBCleanException | Cleans up workspace data from database. |
public static void cleanRepositoryData(RepositoryEntry rEntry) throws DBCleanException | Cleans up repository data from database. |
public static DBCleanerTool getWorkspaceDBCleaner(Connection jdbcConn, WorkspaceEntry wsEntry) throws DBCleanException | Returns database cleaner of workspace. |
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) | Returns database cleaner of repository. The "null" value is returned in case of the multi-db configuration. |
The cleaning is a part of restoring from backup and it is used in the following restore phases:
clean | DBCleanerTool.clean(); |
restore | Does nothing with DBCleanerTool. |
commit | DBCleanerTool.commit(); |
rollback | DBCleanerTool.rollback(); |
Different approaches are used for database cleaning depending on database and JCR configuration.
Need to clean only single workspace
Simple cleaning records from JCR table is used in case of single-db configuration.
PostgreSQL/PostgrePlus, DB2 and MSSQL
clean() | Removes all records from the database. Foreign key of JCR_SITEM table is also removed. |
commit() | Adds the foreign key. |
rollback() |
Oracle, Sybase, HSQLDB, MySQL
clean() | Removes all records from the database. The foreign key of JCR_SITEM table is also removed. |
commit() | Adds the foreign key. |
rollback() | Adds the foreign key. |
Either removing or renaming JCR tables are used in case of the mult-db configuration.
PostgreSQL/PostgrePlus, DB2 and MSSQL
clean() | Removes tables JCR_MVALUE, JCR_MREF, JCR_MITEM, initializes new tables without the foreign key of the JCR_MITEM table, adds root. |
commit() | Adds the foreign key. |
rollback() |
Oracle, Sybase, HSQLDB, MySQL
clean() | Renames the current tables, initializes new tables without the foreign key of the JCR_MITEM table, adds root node, and removes indexes for some databases. |
commit() | Renames tables, and adds indexes. |
rollback() | Removes the previously renamed tables, adds indexes, and adds the foreign key. |
Need to clean the whole repository
In case of single-db, all workspaces will be processed simultaneously as in case of single workspace multi-db configuration. For multi-db, every workspace will be processed separately as in case of single workspace multi-db configuration.