jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1183276 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ state/
Date Fri, 14 Oct 2011 10:21:29 GMT
Author: mduerig
Date: Fri Oct 14 10:21:29 2011
New Revision: 1183276

URL: http://svn.apache.org/viewvc?rev=1183276&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
correct exception handling for node references

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?rev=1183276&r1=1183275&r2=1183276&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
Fri Oct 14 10:21:29 2011
@@ -236,8 +236,8 @@ public abstract class ItemImpl<STATE_TYP
         }
 
         switch (state.getStatus()) {
-            //   Notify listeners about an update (status was MODIFIED before)
-            //   or a simple refresh without modification (status was INVALIDATED).
+            // Notify listeners about an update (status was MODIFIED before)
+            // or a simple refresh without modification (status was INVALIDATED).
             case EXISTING:
                 if (previousStatus == Status.INVALIDATED || previousStatus == Status.MODIFIED)
{
                     notifyUpdated(previousStatus == Status.MODIFIED);

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=1183276&r1=1183275&r2=1183276&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
Fri Oct 14 10:21:29 2011
@@ -35,10 +35,6 @@ import java.util.Collection;
  * {@code ItemState} represents the state of an {@code Item}.
  */
 public abstract class ItemState<ENTRY_TYPE extends HierarchyEntry<?>> {
-
-    /**
-     * Logger instance
-     */
     private static final Logger log = LoggerFactory.getLogger(ItemState.class);
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java?rev=1183276&r1=1183275&r2=1183276&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
Fri Oct 14 10:21:29 2011
@@ -119,7 +119,7 @@ public interface ItemStateFactory {
      * returned or not.
      * @return reference property identifiers
      */
-    Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName,
boolean weak);
+    Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName,
boolean weak) throws RepositoryException;
 
     /**
      * Adds the given {@code ItemStateCreationListener}.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=1183276&r1=1183275&r2=1183276&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Fri Oct 14 10:21:29 2011
@@ -297,7 +297,7 @@ public class NodeState extends ItemState
      * returned or not.
      * @return reference property identifiers
      */
-    public Iterator<PropertyId> getNodeReferences(Name propertyName, boolean weak)
{
+    public Iterator<PropertyId> getNodeReferences(Name propertyName, boolean weak)
throws RepositoryException {
         return isf.getNodeReferences(this, propertyName, weak);
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java?rev=1183276&r1=1183275&r2=1183276&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
Fri Oct 14 10:21:29 2011
@@ -26,13 +26,12 @@ import org.apache.jackrabbit.spi.Propert
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.commons.util.Iterators;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
-import java.util.Collections;
 import java.util.Iterator;
-import java.util.Set;
 
 /**
  * {@code TransientISFactory}...
@@ -110,12 +109,15 @@ public final class TransientISFactory ex
     }
 
     @Override
-    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName,
boolean weak) {
+    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName,
boolean weak)
+            throws RepositoryException {
+        
         if (nodeState.getStatus() == Status.NEW) {
-            Set<PropertyId> t = Collections.emptySet();
-            return t.iterator();
+            return Iterators.empty();
+        }
+        else {
+            return workspaceStateFactory.getNodeReferences(nodeState, propertyName, weak);
         }
-        return workspaceStateFactory.getNodeReferences(nodeState, propertyName, weak);
     }
 
     //------------------------------------------< ItemStateCreationListener >---

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=1183276&r1=1183275&r2=1183276&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
Fri Oct 14 10:21:29 2011
@@ -34,6 +34,7 @@ import org.apache.jackrabbit.spi.Propert
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.util.Iterators;
 import org.apache.jackrabbit.spi.commons.util.Unchecked;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,10 +43,8 @@ import javax.jcr.ItemNotFoundException;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 /**
  * {@code WorkspaceItemStateFactory}...
@@ -162,24 +161,19 @@ public class WorkspaceItemStateFactory e
     }
 
     @Override
-    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName,
boolean weak) {
+    public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName,
boolean weak)
+            throws RepositoryException {
+        
         NodeEntry entry = nodeState.getHierarchyEntry();
 
         // Shortcut
         if (entry.getUniqueID() == null || !entry.hasPropertyEntry(NameConstants.JCR_UUID))
{
             // for sure not referenceable
-            Set<PropertyId> t = Collections.emptySet();
-            return t.iterator();
+            return Iterators.empty();
         }
 
         // Has a unique ID and is potentially mix:referenceable. Try to retrieve references
-        try {
-            return service.getReferences(sessionInfo, entry.getWorkspaceId(), propertyName,
weak);
-        } catch (RepositoryException e) {
-            log.debug("Unable to determine references to {}", nodeState);
-            Set<PropertyId> t = Collections.emptySet();
-            return t.iterator();
-        }
+        return service.getReferences(sessionInfo, entry.getWorkspaceId(), propertyName, weak);
     }
 
     //------------------------------------------------------------< private >---



Mime
View raw message