jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1304537 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Date Fri, 23 Mar 2012 18:15:10 GMT
Author: mduerig
Date: Fri Mar 23 18:15:10 2012
New Revision: 1304537

URL: http://svn.apache.org/viewvc?rev=1304537&view=rev
Log:
OAK-15: Clean up oak-jcr
Use JsopTokenizer instead of FullJsonParser

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=1304537&r1=1304536&r2=1304537&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 18:15:10 2012
@@ -17,10 +17,8 @@
 package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.jcr.json.FullJsonParser;
-import org.apache.jackrabbit.oak.jcr.json.JsonValue;
-import org.apache.jackrabbit.oak.jcr.json.JsonValue.JsonObject;
-import org.apache.jackrabbit.oak.jcr.json.UnescapingJsonTokenizer;
+import org.apache.jackrabbit.mk.json.JsopReader;
+import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -41,7 +39,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map.Entry;
 
 /**
  * {@code WorkspaceImpl}...
@@ -169,15 +166,25 @@ public class WorkspaceImpl implements Wo
         MicroKernel microKernel = sessionContext.getMicrokernel();
         String revision = sessionContext.getRevision();
         String json = microKernel.getNodes("/", revision, 0, 0, -1, null);
-        JsonObject jsonObject = FullJsonParser.parseObject(new UnescapingJsonTokenizer(json));
 
+        JsopReader reader = new JsopTokenizer(json);
+        reader.read('{');
         List<String> workspaces = new ArrayList<String>();
-        for (Entry<String, JsonValue> entry : jsonObject.value().entrySet()) {
-            if (entry.getValue().isObject()) {
-                workspaces.add(entry.getKey());
+        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);
+        
         return workspaces.toArray(new String[workspaces.size()]);
     }
 



Mime
View raw message