jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r650539 - in /jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ query/ query/lucene/
Date Tue, 22 Apr 2008 15:03:34 GMT
Author: jukka
Date: Tue Apr 22 08:03:24 2008
New Revision: 650539

URL: http://svn.apache.org/viewvc?rev=650539&view=rev
Log:
1.4: Merged revisions 648691 and 648707 (JCR-1492)

Added:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
      - copied, changed from r648691, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=650539&r1=650538&r2=650539&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Tue Apr 22 08:03:24 2008
@@ -624,7 +624,7 @@
                 SystemSession defSysSession = getSystemSession(wspName);
                 systemSearchMgr = new SearchManager(repConfig.getSearchConfig(),
                         nsReg, ntReg, defSysSession.getItemStateManager(),
-                        SYSTEM_ROOT_NODE_ID, null, null);
+                        vMgr.getPersistenceManager(), SYSTEM_ROOT_NODE_ID, null, null);
                 ObservationManager obsMgr = defSysSession.getWorkspace().getObservationManager();
                 obsMgr.addEventListener(systemSearchMgr, Event.NODE_ADDED
                         | Event.NODE_REMOVED | Event.PROPERTY_ADDED
@@ -1614,6 +1614,7 @@
                             nsReg,
                             ntReg,
                             itemStateMgr,
+                            persistMgr,
                             rootNodeId,
                             getSystemSearchManager(getName()),
                             SYSTEM_ROOT_NODE_ID);

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=650539&r1=650538&r2=650539&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
Tue Apr 22 08:03:24 2008
@@ -35,6 +35,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.NodeStateIterator;
+import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
 import org.apache.jackrabbit.spi.Path;
 import org.slf4j.Logger;
@@ -128,6 +129,11 @@
     private final ItemStateManager itemMgr;
 
     /**
+     * The underlying persistence manager.
+     */
+    private final PersistenceManager pm;
+
+    /**
      * Storage for search index
      */
     private final FileSystem fs;
@@ -180,22 +186,24 @@
     /**
      * Creates a new <code>SearchManager</code>.
      *
-     * @param config the search configuration.
-     * @param nsReg            the namespace registry.
-     * @param ntReg the node type registry.
-     * @param itemMgr the shared item state manager.
+     * @param config         the search configuration.
+     * @param nsReg          the namespace registry.
+     * @param ntReg          the node type registry.
+     * @param itemMgr        the shared item state manager.
+     * @param pm             the underlying persistence manager.
      * @param rootNodeId     the id of the root node.
-     * @param parentMgr        the parent search manager or <code>null</code>
if
-     *                         there is no parent search manager.
+     * @param parentMgr      the parent search manager or <code>null</code> if
+     *                       there is no parent search manager.
      * @param excludedNodeId id of the node that should be excluded from
-     *                         indexing. Any descendant of that node will also
-     *                         be excluded from indexing.
+     *                       indexing. Any descendant of that node will also be
+     *                       excluded from indexing.
      * @throws RepositoryException if the search manager cannot be initialized
      */
     public SearchManager(SearchConfig config,
                          final NamespaceRegistryImpl nsReg,
                          NodeTypeRegistry ntReg,
                          ItemStateManager itemMgr,
+                         PersistenceManager pm,
                          NodeId rootNodeId,
                          SearchManager parentMgr,
                          NodeId excludedNodeId) throws RepositoryException {
@@ -208,6 +216,7 @@
         this.ntReg = ntReg;
         this.nsReg = nsReg;
         this.itemMgr = itemMgr;
+        this.pm = pm;
         this.rootNodeId = rootNodeId;
         this.parentHandler = (parentMgr != null) ? parentMgr.handler : null;
         this.excludedNodeId = excludedNodeId;
@@ -568,7 +577,7 @@
         try {
             handler = (QueryHandler) config.newInstance();
             QueryHandlerContext context
-                    = new QueryHandlerContext(fs, itemMgr, rootNodeId,
+                    = new QueryHandlerContext(fs, itemMgr, pm, rootNodeId,
                             ntReg, nsReg, parentHandler, excludedNodeId);
             handler.init(context);
         } catch (Exception e) {

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java?rev=650539&r1=650538&r2=650539&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
Tue Apr 22 08:03:24 2008
@@ -38,6 +38,11 @@
     private QueryHandlerContext context;
 
     /**
+     * The {@link OnWorkspaceInconsistency} handler. Defaults to 'fail'.
+     */
+    private OnWorkspaceInconsistency owi = OnWorkspaceInconsistency.FAIL;
+
+    /**
      * Initializes this query handler by setting all properties in this class
      * with appropriate parameter values.
      *
@@ -65,7 +70,7 @@
     }
 
     /**
-     * This default implementation calls the individual {@link #deleteNode(NodeId)}
+     * This default implementation calls the individual {@link #deleteNode(org.apache.jackrabbit.core.NodeId)}
      * and {@link #addNode(org.apache.jackrabbit.core.state.NodeState)} methods
      * for each entry in the iterators. First the nodes to remove are processed
      * then the nodes to add.
@@ -97,4 +102,34 @@
         throw new UnsupportedOperationException(
                 "This query handler does not support prepared queries");
     }
+
+    /**
+     * @return the {@link OnWorkspaceInconsistency} handler.
+     */
+    public OnWorkspaceInconsistency getOnWorkspaceInconsistencyHandler() {
+        return owi;
+    }
+
+    //--------------------------< properties >----------------------------------
+
+    /**
+     * Sets the {@link OnWorkspaceInconsistency} handler with the given name.
+     * Currently the only valid name is:
+     * <ul>
+     * <li><code>fail</code></li>
+     * </ul>
+     *
+     * @param name the name of a {@link OnWorkspaceInconsistency} handler.
+     */
+    public void setOnWorkspaceInconsistency(String name) {
+        owi = OnWorkspaceInconsistency.fromString(name);
+    }
+
+    /**
+     * @return the name of the currently set {@link OnWorkspaceInconsistency}.
+     */
+    public String getOnWorkspaceInconsistency() {
+        return owi.getName();
+    }
+
 }

Copied: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
(from r648691, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java)
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java?p2=jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java&p1=jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java&r1=648691&r2=650539&rev=650539&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
Tue Apr 22 08:03:24 2008
@@ -77,9 +77,9 @@
     private final String name;
 
     /**
-     * Private constructor.
+     * Protected constructor.
      */
-    private OnWorkspaceInconsistency(String name) {
+    protected OnWorkspaceInconsistency(String name) {
         this.name = name;
     }
 

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java?rev=650539&r1=650538&r2=650539&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
Tue Apr 22 08:03:24 2008
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NamespaceRegistryImpl;
+import org.apache.jackrabbit.core.persistence.PersistenceManager;
 
 /**
  * Acts as an argument for the {@link QueryHandler} to keep the interface
@@ -40,6 +41,11 @@
     private final ItemStateManager stateMgr;
 
     /**
+     * The underlying persistence manager.
+     */
+    private final PersistenceManager pm;
+
+    /**
      * The node type registry of the repository
      */
     private final NodeTypeRegistry ntRegistry;
@@ -77,6 +83,7 @@
      *                         <code>FileSystem</code> has been configured
      *                         <code>fs</code> is <code>null</code>.
      * @param stateMgr         provides persistent item states.
+     * @param pm               the underlying persistence manager.
      * @param rootId           the id of the root node.
      * @param ntRegistry       the node type registry.
      * @param nsRegistry       the namespace registry.
@@ -88,6 +95,7 @@
      */
     public QueryHandlerContext(FileSystem fs,
                                ItemStateManager stateMgr,
+                               PersistenceManager pm,
                                NodeId rootId,
                                NodeTypeRegistry ntRegistry,
                                NamespaceRegistryImpl nsRegistry,
@@ -95,6 +103,7 @@
                                NodeId excludedNodeId) {
         this.fs = fs;
         this.stateMgr = stateMgr;
+        this.pm = pm;
         this.rootId = rootId;
         this.ntRegistry = ntRegistry;
         this.nsRegistry = nsRegistry;
@@ -113,6 +122,13 @@
      */
     public ItemStateManager getItemStateManager() {
         return stateMgr;
+    }
+
+    /**
+     * @return the underlying persistence manager.
+     */
+    public PersistenceManager getPersistenceManager() {
+        return pm;
     }
 
     /**

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=650539&r1=650538&r2=650539&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
Tue Apr 22 08:03:24 2008
@@ -29,8 +29,6 @@
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.lucene.document.Document;
@@ -1043,20 +1041,12 @@
             NodeState.ChildNodeEntry child = (NodeState.ChildNodeEntry) it.next();
             Path childPath = PATH_FACTORY.create(path, child.getName(),
                     child.getIndex(), false);
-            NodeState childState;
+            NodeState childState = null;
             try {
                 childState = (NodeState) stateMgr.getItemState(child.getId());
             } catch (NoSuchItemStateException e) {
-                NamePathResolver resolver = new DefaultNamePathResolver(
-                        handler.getContext().getNamespaceRegistry());
-                log.error("Node {} ({}) has missing child '{}' ({})",
-                        new Object[]{
-                            resolver.getJCRPath(path),
-                            node.getNodeId().getUUID().toString(),
-                            resolver.getJCRName(child.getName()),
-                            child.getId().getUUID().toString()
-                        });
-                throw e;
+                handler.getOnWorkspaceInconsistencyHandler().handleMissingChildNode(
+                        e, handler, path, node, child);
             }
             if (childState != null) {
                 createIndex(childState, childPath, stateMgr);



Mime
View raw message