incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r592447 - in /incubator/sling/trunk/microsling/microsling-core: pom.xml src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java src/main/java/org/apache/sling/microsling/slingservlets/renderers/JsonRendererServlet.java
Date Tue, 06 Nov 2007 15:03:08 GMT
Author: fmeschbe
Date: Tue Nov  6 07:03:08 2007
New Revision: 592447

URL: http://svn.apache.org/viewvc?rev=592447&view=rev
Log:
SLING-83 Fix references to modified Sling API an Commons JSON libraries

Modified:
    incubator/sling/trunk/microsling/microsling-core/pom.xml
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/renderers/JsonRendererServlet.java

Modified: incubator/sling/trunk/microsling/microsling-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/pom.xml?rev=592447&r1=592446&r2=592447&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/pom.xml (original)
+++ incubator/sling/trunk/microsling/microsling-core/pom.xml Tue Nov  6 07:03:08 2007
@@ -62,12 +62,12 @@
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
-      <artifactId>sling-api</artifactId>
+      <artifactId>api</artifactId>
       <version>2.0.0-incubator-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
-      <artifactId>sling-json</artifactId>
+      <artifactId>commons.json</artifactId>
       <version>2.0.0-incubator-SNAPSHOT</version>
     </dependency>
     <dependency>

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java?rev=592447&r1=592446&r2=592447&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java
Tue Nov  6 07:03:08 2007
@@ -31,8 +31,8 @@
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 
-import org.apache.sling.json.JSONException;
-import org.apache.sling.json.io.JSONWriter;
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.io.JSONWriter;
 
 /** Dumps JCR Items as JSON data. The dump methods
  *  are threadsafe.
@@ -42,15 +42,15 @@
 
     /** Create a JsonItemWriter
      *  @param propertyNamesToIgnore if not null, a property having a name from this
-     *  set of values is ignored. 
+     *  set of values is ignored.
      *  TODO we should use a filtering interface to make the selection of which Nodes
      *  and Properties to dump more flexible.
-     */ 
+     */
     public JsonItemWriter(Set<String> propertyNamesToIgnore) {
         this.propertyNamesToIgnore = propertyNamesToIgnore;
     }
 
-    /** Dump all Nodes of given NodeIterator in JSON 
+    /** Dump all Nodes of given NodeIterator in JSON
      * @throws JSONException */
     public void dump(NodeIterator it, Writer out) throws RepositoryException, JSONException
{
         final JSONWriter w = new JSONWriter(out);
@@ -61,15 +61,15 @@
         w.endArray();
     }
 
-    /** Dump given node in JSON, optionally recursing into its child nodes */ 
+    /** Dump given node in JSON, optionally recursing into its child nodes */
     public void dump(Node node, Writer w, int maxRecursionLevels) throws RepositoryException,
JSONException {
         dump(node, new JSONWriter(w), 0, maxRecursionLevels);
     }
-    
-    /** Dump given node in JSON, optionally recursing into its child nodes */ 
-    protected void dump(Node node, JSONWriter w, int currentRecursionLevel, int maxRecursionLevels)

+
+    /** Dump given node in JSON, optionally recursing into its child nodes */
+    protected void dump(Node node, JSONWriter w, int currentRecursionLevel, int maxRecursionLevels)
     throws RepositoryException, JSONException {
-        
+
         w.object();
         PropertyIterator props = node.getProperties();
 
@@ -91,14 +91,14 @@
                 w.endArray();
             }
         }
-        
+
         // the child nodes
         final NodeIterator children = node.getNodes();
         while(children.hasNext()) {
             final Node n = children.nextNode();
             dumpSingleNode(n, w, currentRecursionLevel, maxRecursionLevels);
         }
-        
+
         w.endObject();
     }
 
@@ -114,31 +114,31 @@
     /**
      * Write a single property
      */
-    protected void writeProperty(JSONWriter w, int indent, Property p) 
+    protected void writeProperty(JSONWriter w, int indent, Property p)
     throws ValueFormatException, RepositoryException, JSONException {
         if(p.getType() == PropertyType.BINARY) {
             // TODO for now we mark binary properties with an initial star in their name
             // (star is not allowed as a JCR property name)
             // in the name, and the value should be the size of the binary data
             w.key("*" + p.getName());
-            
+
         } else {
             w.key(p.getName());
         }
-        
+
         w.value(convertValue(p.getValue()));
     }
-    
-    /** Convert a Value for JSON output */ 
+
+    /** Convert a Value for JSON output */
     protected Object convertValue(Value v) throws ValueFormatException, IllegalStateException,
RepositoryException {
         if(v.getType() == PropertyType.BINARY) {
             // TODO return the binary size
             return new Integer(0);
-            
+
         } else if(v.getType() == PropertyType.DATE) {
             final DateFormat fmt = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'Z",
Locale.US);
             return fmt.format(v.getDate().getTime());
-            
+
         } else {
             return v.getString();
         }

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/renderers/JsonRendererServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/renderers/JsonRendererServlet.java?rev=592447&r1=592446&r2=592447&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/renderers/JsonRendererServlet.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/renderers/JsonRendererServlet.java
Tue Nov  6 07:03:08 2007
@@ -28,7 +28,7 @@
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.apache.sling.json.JSONException;
+import org.apache.sling.commons.json.JSONException;
 import org.apache.sling.microsling.helpers.json.JsonItemWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,12 +39,12 @@
 public class JsonRendererServlet extends SlingSafeMethodsServlet {
 
     private static final Logger log = LoggerFactory.getLogger(JsonRendererServlet.class);
-    
+
     private static final long serialVersionUID = 5577121546674133317L;
     private final String responseContentType;
     private final JsonItemWriter itemWriter;
-    
-    /** This optional request parameter sets the recursion level 
+
+    /** This optional request parameter sets the recursion level
      *  (into chldren) when dumping a node */
     public static final String PARAM_RECURSION_LEVEL = "slingItemDumpRecursionLevel";
 
@@ -52,10 +52,10 @@
         this.responseContentType = responseContentTypeHeaderValue;
         itemWriter = new JsonItemWriter(null);
     }
-    
+
     @Override
-    protected void doGet(SlingHttpServletRequest req,SlingHttpServletResponse resp) 
-    throws ServletException,IOException 
+    protected void doGet(SlingHttpServletRequest req,SlingHttpServletResponse resp)
+    throws ServletException,IOException
     {
         // Access and check our data
         final Resource  r = req.getResource();
@@ -65,12 +65,12 @@
         }
         if(!(data instanceof Node)) {
             throw new HttpStatusCodeException(
-                    HttpServletResponse.SC_NOT_IMPLEMENTED, 
+                    HttpServletResponse.SC_NOT_IMPLEMENTED,
                     "Don't know how to dump a " + data.getClass().getName()
             );
         }
         final Node n = (Node)data;
-        
+
         // how many levels deep?
         int maxRecursionLevels = 0;
         final String depth = req.getParameter(PARAM_RECURSION_LEVEL);
@@ -78,7 +78,7 @@
           try {
             maxRecursionLevels = Integer.parseInt(depth);
           } catch(Exception e) {
-            throw new HttpStatusCodeException(HttpServletResponse.SC_BAD_REQUEST, 
+            throw new HttpStatusCodeException(HttpServletResponse.SC_BAD_REQUEST,
                     "Invalid value '" + depth + "' for request parameter '" + PARAM_RECURSION_LEVEL
+ "'"
             );
           }
@@ -94,7 +94,7 @@
             reportException(re);
         }
     }
-    
+
     private void reportException(Exception e) throws HttpStatusCodeException {
         log.warn("Error in JsonRendererServlet: " + e.toString(),e);
         throw new HttpStatusCodeException(



Mime
View raw message