[exo-jcr-commits] exo-jcr SVN: r5269 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Dec 6 04:36:08 EST 2011
Author: tolusha
Date: 2011-12-06 04:36:07 -0500 (Tue, 06 Dec 2011)
New Revision: 5269
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/db-cleaner-service.xml
Log:
EXOJCR-1603: Docbook updated
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/db-cleaner-service.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/db-cleaner-service.xml 2011-12-06 09:35:46 UTC (rev 5268)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/db-cleaner-service.xml 2011-12-06 09:36:07 UTC (rev 5269)
@@ -7,16 +7,18 @@
<title>DBCleanService</title>
<section>
- <title>API</title>
+ <title>Description</title>
- <para>It is special service for removing data from database.</para>
+ <para>It is special service for data removal from database. The article
+ shortly describes the principles of work DBCleaner under all
+ databases</para>
<note>
<para>Code that invokes methods of DBCleanService must have
JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION permission;</para>
</note>
- <para>There are three methods of DBCleanerService:</para>
+ <para>There are several methods of DBCleanerService:</para>
<table>
<title>API</title>
@@ -27,28 +29,201 @@
<entry>public static void cleanWorkspaceData(WorkspaceEntry
wsEntry)</entry>
- <entry>Clean workspace data from database. Tables will be removed
- in case of multiDB, and only records will be removed in case of
- singleDB.</entry>
+ <entry>Clean workspace data from database</entry>
</row>
<row>
<entry>public static void cleanRepositoryData(RepositoryEntry
repoEntry)</entry>
- <entry>Cleanup repository data from database.</entry>
+ <entry>Cleanup repository data from database</entry>
</row>
<row>
- <entry>public static getDBCleaner(Connection jdbcConn,
- WorkspaceEntry wsEntry)</entry>
+ <entry>public static DBCleaner getWorkspaceDBCleaner(Connection
+ jdbcConn, WorkspaceEntry wsEntry)</entry>
- <entry>Returns DBClean object with defined connection that allow
- to manual invoke clean method on it. Note: DBClean doesn't perform
- commit or close connection. It should be done manually.</entry>
+ <entry>Returns database cleaner of workspace.</entry>
</row>
+
+ <row>
+ <entry>public static DBCleaner getRepositoryDBCleaner(Connection
+ jdbcConn, RepositoryEntry repoEntry)</entry>
+
+ <entry>Returns database cleaner of repository. Returns null in
+ case of multi-db configuration.</entry>
+ </row>
</tbody>
</tgroup>
</table>
+
+ <para>The cleaning is a part of restoring from backup and it is used in
+ the following restore phases: </para>
+
+ <table>
+ <title>Relations between restore phases and what is called on
+ DBCleaner</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>clean</entry>
+
+ <entry><programlisting language="java">dbCleaner.executeCleanScripts();</programlisting></entry>
+ </row>
+
+ <row>
+ <entry>restore</entry>
+
+ <entry>does nothing with DBCleaner</entry>
+ </row>
+
+ <row>
+ <entry>commit</entry>
+
+ <entry><programlisting language="java">dbCleaner.executeCommitScripts();
+connection.commit();</programlisting></entry>
+ </row>
+
+ <row>
+ <entry>rollback</entry>
+
+ <entry><programlisting language="java">connection.rollback();
+
+dbCleaner.executeRollbackScripts();
+connection.commit();</programlisting></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>Different approaches are used for database cleaning depending on
+ database and JCR configuration.</para>
</section>
+
+ <section>
+ <title>Need to clean only single workspace</title>
+
+ <para>Simple cleaning records from JCR table is used in case of single-db
+ configuration. </para>
+
+ <table>
+ <title>PostgreSQL, DB2 and MSSQL </title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>executeCleanScripts()</entry>
+
+ <entry>removing all records from the database. Foreign key of
+ JCR_SITEM table is also removed</entry>
+ </row>
+
+ <row>
+ <entry>executeCommitScripts()</entry>
+
+ <entry>adding foreign key</entry>
+ </row>
+
+ <row>
+ <entry>executeRollbackScripts()</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Oracle, Sybase, HSQLDB, MySQL</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>executeCleanScripts()</entry>
+
+ <entry>removing all records from the database. Foreign key of
+ JCR_SITEM table is also removed</entry>
+ </row>
+
+ <row>
+ <entry>executeCommitScripts()</entry>
+
+ <entry>adding foreign key</entry>
+ </row>
+
+ <row>
+ <entry>executeRollbackScripts()</entry>
+
+ <entry>adding foreign key</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>Either removing or renaming JCR tables are used in case of mult-db
+ configuration.</para>
+
+ <table>
+ <title>PostgreSQL, DB2 and MSSQL</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>executeCleanScripts()</entry>
+
+ <entry>removing tables JCR_MVALUE, JCR_MREF, JCR_MITEM,
+ initializing new tables without foreign key of JCR_MITEM table,
+ adding root</entry>
+ </row>
+
+ <row>
+ <entry>executeCommitScripts()</entry>
+
+ <entry>adding foreign key</entry>
+ </row>
+
+ <row>
+ <entry>executeRollbackScripts()</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Oracle, Sybase, HSQLDB, MySQL</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>executeCleanScripts()</entry>
+
+ <entry>renaming current tables, initializing new tables without
+ foreign key of JCR_MITEM table, adding root node, removing indexes
+ for some databases</entry>
+ </row>
+
+ <row>
+ <entry>executeCommitScripts()</entry>
+
+ <entry>renaming tables, adding indexes</entry>
+ </row>
+
+ <row>
+ <entry>executeRollbackScripts()</entry>
+
+ <entry>removing previously renamed tables, adding indexes, adding
+ foreign key</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>Need to clean the whole repository</title>
+
+ <para>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.</para>
+ </section>
</chapter>
More information about the exo-jcr-commits
mailing list