jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r632739 - in /jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: RepositoryImpl.java state/SharedItemStateManager.java
Date Sun, 02 Mar 2008 11:18:05 GMT
Author: jukka
Date: Sun Mar  2 03:18:02 2008
New Revision: 632739

URL: http://svn.apache.org/viewvc?rev=632739&view=rev
Log:
1.3: Merged revision 632738 (JCR-954)

Modified:
    jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java

Modified: jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=632739&r1=632738&r2=632739&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Sun Mar  2 03:18:02 2008
@@ -746,6 +746,24 @@
         return getWorkspaceInfo(workspaceName).getItemStateProvider();
     }
 
+    /**
+     * Enables or disables referential integrity checking for given workspace.
+     * Disabling referential integrity checks can result in a corrupted
+     * workspace, and thus this feature is only available to customized
+     * implementations that subclass RepositoryImpl.
+     *
+     * @see https://issues.apache.org/jira/browse/JCR-954
+     * @param workspace name of the workspace
+     * @param enabled <code>true</code> to enable integrity checking (default),
+     *                <code>false</code> to disable it
+     * @throws RepositoryException if an error occurs
+     */
+    protected void setReferentialIntegrityChecking(
+            String workspace, boolean enabled) throws RepositoryException {
+        SharedItemStateManager manager = getWorkspaceStateManager(workspace);
+        manager.setCheckReferences(enabled);
+    }
+
     ObservationDispatcher getObservationDispatcher(String workspaceName)
             throws NoSuchWorkspaceException {
         // check sanity of this instance

Modified: jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=632739&r1=632738&r2=632739&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Sun Mar  2 03:18:02 2008
@@ -145,6 +145,16 @@
     private final boolean usesReferences;
 
     /**
+     * Flag indicating whether this item state manager is checking referential
+     * integrity when storing modifications. The default is to to check
+     * for referential integrity.
+     * Should be changed very carefully by experienced developers only.
+     *
+     * @see https://issues.apache.org/jira/browse/JCR-954
+     */
+    private boolean checkReferences = true;
+
+    /**
      * id of root node
      */
     private final NodeId rootNodeId;
@@ -213,6 +223,17 @@
     }
 
     /**
+     * Enables or disables the referential integrity checking, this
+     * should be used very carefully by experienced developers only.
+     *
+     * @see https://issues.apache.org/jira/browse/JCR-954
+     * @param checkReferences whether to do referential integrity checks
+     */
+    public void setCheckReferences(boolean checkReferences) {
+        this.checkReferences = checkReferences;
+    }
+
+    /**
      * enables or disables the write-lock hack. this should only be called by
      * the {@link XAVersionManager}.
      *
@@ -550,10 +571,11 @@
                     updateReferences(local, virtualProvider);
                 }
 
-                /**
-                 * Check whether reference targets exist/were not removed
-                 */
-                checkReferentialIntegrity(local);
+                // If enabled, check whether reference targets
+                // exist/were not removed
+                if (checkReferences) {
+                    checkReferentialIntegrity(local);
+                }
 
                 /**
                  * prepare the events. this needs to be after the referential



Mime
View raw message