jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r953585 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query: AbstractQueryHandler.java OnWorkspaceInconsistency.java
Date Fri, 11 Jun 2010 07:08:17 GMT
Author: ckoell
Date: Fri Jun 11 07:08:17 2010
New Revision: 953585

URL: http://svn.apache.org/viewvc?rev=953585&view=rev
Log:
JCR-2651 Add a OnWorkspaceInconsistency with logging only

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java?rev=953585&r1=953584&r2=953585&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
Fri Jun 11 07:08:17 2010
@@ -140,9 +140,10 @@ public abstract class AbstractQueryHandl
 
     /**
      * Sets the {@link OnWorkspaceInconsistency} handler with the given name.
-     * Currently the only valid name is:
+     * Currently the valid names are:
      * <ul>
      * <li><code>fail</code></li>
+     * <li><code>log</code></li>
      * </ul>
      *
      * @param name the name of a {@link OnWorkspaceInconsistency} handler.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java?rev=953585&r1=953584&r2=953585&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
Fri Jun 11 07:08:17 2010
@@ -66,11 +66,36 @@ public abstract class OnWorkspaceInconsi
         }
     };
 
+    /**
+     * An handler that simply logs the path of the parent node and the name
+     * of the missing child node
+     */
+    public static final OnWorkspaceInconsistency LOG = new OnWorkspaceInconsistency("log")
{
+
+        public void handleMissingChildNode(NoSuchItemStateException exception,
+                                           QueryHandler handler,
+                                           Path path,
+                                           NodeState node,
+                                           ChildNodeEntry child)
+                throws RepositoryException, ItemStateException {
+            NamePathResolver resolver = new DefaultNamePathResolver(
+                    handler.getContext().getNamespaceRegistry());
+            log.error("Node {} ({}) has missing child '{}' ({})",
+                    new Object[]{
+                        resolver.getJCRPath(path),
+                        node.getNodeId(),
+                        resolver.getJCRName(child.getName()),
+                        child.getId()
+                    } + ". Please run a consistency check on this workspace!");
+        }
+    };
+
     protected static final Map<String, OnWorkspaceInconsistency> INSTANCES
             = new HashMap<String, OnWorkspaceInconsistency>();
 
     static {
         INSTANCES.put(FAIL.name, FAIL);
+        INSTANCES.put(LOG.name, LOG);
     }
 
     /**



Mime
View raw message