jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1304622 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Date Fri, 23 Mar 2012 21:45:52 GMT
Author: mduerig
Date: Fri Mar 23 21:45:51 2012
New Revision: 1304622

URL: http://svn.apache.org/viewvc?rev=1304622&view=rev
Log:
OAK-15: Clean up oak-jcr
refactor getAccessibleWorkspaceNames

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1304622&r1=1304621&r2=1304622&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Fri Mar 23 21:45:51 2012
@@ -17,8 +17,8 @@
 package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.json.JsopReader;
-import org.apache.jackrabbit.mk.json.JsopTokenizer;
+import org.apache.jackrabbit.mk.model.ChildNodeEntry;
+import org.apache.jackrabbit.oak.kernel.KernelNodeState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -165,26 +165,12 @@ public class WorkspaceImpl implements Wo
 
         MicroKernel microKernel = sessionContext.getMicrokernel();
         String revision = sessionContext.getRevision();
-        String json = microKernel.getNodes("/", revision, 0, 0, -1, null);
-
-        JsopReader reader = new JsopTokenizer(json);
-        reader.read('{');
+        KernelNodeState rootState = new KernelNodeState(microKernel, "/", revision);
         List<String> workspaces = new ArrayList<String>();
-        do {
-            String name = reader.readString();
-            reader.read(':');
-            if (name.startsWith(":")) {
-                reader.read();
-            } else if (reader.matches('{')) {
-                reader.read('}');
-                workspaces.add(name);
-            } else {
-                throw new IllegalArgumentException("Unexpected token: " + reader.getToken());
-            }
-        } while (reader.matches(','));
-        reader.read('}');
-        reader.read(JsopTokenizer.END);
-        
+        for (ChildNodeEntry entry : rootState.getChildNodeEntries(0, -1)) {
+            workspaces.add(entry.getName());
+        }
+
         return workspaces.toArray(new String[workspaces.size()]);
     }
 



Mime
View raw message