jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1157041 - in /jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel: RepositoryServiceImpl.java util/Paths.java
Date Fri, 12 Aug 2011 10:47:37 GMT
Author: mduerig
Date: Fri Aug 12 10:47:37 2011
New Revision: 1157041

URL: http://svn.apache.org/viewvc?rev=1157041&view=rev
Log:
spi2microkernel (WIP)
- resolve id based NodeIds

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1157041&r1=1157040&r2=1157041&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Fri Aug 12 10:47:37 2011
@@ -48,6 +48,7 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.spi.commons.SessionInfoImpl;
 import org.apache.jackrabbit.spi.commons.batch.ConsolidatingChangeLog;
 import org.apache.jackrabbit.spi.commons.iterator.Iterators;
+import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 import org.apache.jackrabbit.spi2microkernel.util.Function1;
 import org.apache.jackrabbit.spi2microkernel.util.JsonHandlerBase;
 import org.apache.jackrabbit.spi2microkernel.util.Paths;
@@ -60,7 +61,6 @@ import org.slf4j.LoggerFactory;
 
 import javax.jcr.Credentials;
 import javax.jcr.GuestCredentials;
-import javax.jcr.ItemNotFoundException;
 import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
@@ -81,10 +81,28 @@ import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 
-import static javax.jcr.Repository.*;
-import static org.apache.jackrabbit.spi.commons.name.NameConstants.*;
+import static javax.jcr.Repository.IDENTIFIER_STABILITY;
+import static javax.jcr.Repository.IDENTIFIER_STABILITY_METHOD_DURATION;
+import static javax.jcr.Repository.LEVEL_2_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED;
+import static javax.jcr.Repository.OPTION_OBSERVATION_SUPPORTED;
+import static javax.jcr.Repository.OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED;
+import static javax.jcr.Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED;
+import static javax.jcr.Repository.SPEC_NAME_DESC;
+import static javax.jcr.Repository.WRITE_SUPPORTED;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_CREATED;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_CREATEDBY;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_UUID;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.MIX_CREATED;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.MIX_REFERENCEABLE;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.REP_ROOT;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.ROOT;
 import static org.apache.jackrabbit.spi2microkernel.util.Arrays.contains;
-import static org.apache.jackrabbit.spi2microkernel.util.ItemInfos.*;
+import static org.apache.jackrabbit.spi2microkernel.util.ItemInfos.buildItemInfos;
+import static org.apache.jackrabbit.spi2microkernel.util.ItemInfos.buildNodeInfo;
+import static org.apache.jackrabbit.spi2microkernel.util.ItemInfos.buildPropertyInfo;
 import static org.apache.jackrabbit.spi2microkernel.util.Maps.getOrElse;
 import static org.apache.jackrabbit.spi2microkernel.util.Predicates.containsElement;
 import static org.apache.jackrabbit.spi2microkernel.util.Predicates.exists;
@@ -313,7 +331,7 @@ public class RepositoryServiceImpl exten
     public PropertyInfo getPropertyInfo(SessionInfo sessionInfo, PropertyId propertyId) throws
RepositoryException {
         try {
             String wspName = sessionInfo.getWorkspaceName();
-            Path path = propertyId.getPath();
+            Path path = getPath(propertyId);
             String mkPath = Paths.pathToString(wspName, path.getAncestor(1));
             String rev = microKernel.getHeadRevision();
 
@@ -453,13 +471,19 @@ public class RepositoryServiceImpl exten
 
     //------------------------------------------< private >---
 
-    private static Path getPath(NodeId nodeId) throws ItemNotFoundException {
-        Path path = nodeId.getPath();
+    private static Path getPath(ItemId itemId) throws RepositoryException {
+        String uid = itemId.getUniqueID();
+        Path path = itemId.getPath();
+
+        if (uid == null) {
+            return path;
+        }
+
         if (path == null) {
-            path = Paths.parseQPath(nodeId.getUniqueID());
+            return Paths.parseQPath(itemId.getUniqueID());
         }
-        
-        return path;
+
+        return PathFactoryImpl.getInstance().create(Paths.parseQPath(itemId.getUniqueID()),
path, true);
     }
 
     private static SubscriptionImpl subscription(Subscription subscription) throws RepositoryException
{

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java?rev=1157041&r1=1157040&r2=1157041&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
Fri Aug 12 10:47:37 2011
@@ -129,6 +129,10 @@ public final class Paths {
     }
 
     private static String translateQPath(Path path) throws RepositoryException {
+        if (!path.isAbsolute()) {
+            throw new IllegalArgumentException("Path is not absolute: " + path);
+        }
+
         return path.denotesRoot()
             ? "/"
             : PathUtils.concat(translateQPath(path.getAncestor(1)), nameToString(path.getName()));



Mime
View raw message