You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:24:57 UTC

[sling-org-apache-sling-resource-inventory] branch master created (now fc2965f)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git.


      at fc2965f  SLING-7167 Adjust READMEs

This branch includes the following new commits:

     new b09eb34  SLING-3018 :  Add an inventory printer which dumps a resource tree into json
     new ee19f92  Add metatype info
     new 93aff10  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0
     new 90d865d  [maven-release-plugin] rollback the release of org.apache.sling.resource.inventory-0.5.0
     new 382ed4a  Correct scm info
     new 1fdcc94  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0
     new 4c405b9  [maven-release-plugin] prepare for next development iteration
     new fbfd922  SLING-3197 : ClassCastException when serializing arrays of scalar types
     new 55da492  SLING-3198 : JSON Tree Rendering should do tree depth first tree traversal
     new 9479996  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.0
     new 84c3c2b  [maven-release-plugin] prepare for next development iteration
     new 4512071  SLING-3507 : Potential NPE in JSON dump from JMX
     new b41cabe  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.2
     new 137efbb  [maven-release-plugin] prepare for next development iteration
     new 0df1e57  SLING-4625 : No resource inventory if mbean attribute value is a double
     new beb3170  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.4
     new f21eed3  [maven-release-plugin] prepare for next development iteration
     new 9647064  Use latest parent pom
     new 448f5d1  Update contrib modules to Parent 23
     new 4b434fa  set parent version to 24 and add empty relativePath where missing
     new 9d289ec  Update the contrib reactor to parent 25
     new 73d632d  Switch to parent pom 26
     new c7a79f6  Switch to parent pom 29 and OSGi annotations
     new 1239ad9  SLING-6468 - Improve code coverage for Sling Inventory Printer
     new 47ae41b  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.6
     new 213bde1  [maven-release-plugin] prepare for next development iteration
     new f7c83ea  use Sling Parent 30
     new bc7d8ac  add missing Felix SCR annotations
     new 3e29a44  SLING-6898: Remove commons.json from Resource Inventory.
     new 2356393  Fix some javadoc
     new d1969df  [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.8
     new 1c4ad15  [maven-release-plugin] prepare for next development iteration
     new fc2965f  SLING-7167 Adjust READMEs

The 33 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-resource-inventory] 10/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 94799961fe33e7fb5e1994234978cdabbdce4346
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Mar 5 11:18:04 2014 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1574435 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index d2f9981..212c7a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>0.5.1-SNAPSHOT</version>
+    <version>1.0.0</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.0</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 24/33: SLING-6468 - Improve code coverage for Sling Inventory Printer

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 1239ad946231dbc5bb29a75d08ee6f4719db4850
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Mon Jan 16 13:51:21 2017 +0000

    SLING-6468 - Improve code coverage for Sling Inventory Printer
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1779030 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  19 +++
 .../inventory/impl/JsonObjectCreatorTest.java      | 131 +++++++++++++++++++++
 .../inventory/impl/ResourceTraversorTest.java      |  71 +++++++++++
 3 files changed, 221 insertions(+)

diff --git a/pom.xml b/pom.xml
index 8e046fe..9cd4bb1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,5 +94,24 @@
             <version>3.0</version>
             <scope>provided</scope>
         </dependency>
+        <!-- TESTING -->
+
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
+            <version>1.1.16</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.9.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java b/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
new file mode 100644
index 0000000..4b072b0
--- /dev/null
+++ b/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.resource.inventory.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.json.JSONArray;
+import org.apache.sling.commons.json.JSONObject;
+import org.apache.sling.testing.resourceresolver.MockHelper;
+import org.apache.sling.testing.resourceresolver.MockResource;
+import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class JsonObjectCreatorTest {
+
+    private ResourceResolver resolver;
+
+    @Before
+    public void setup() throws LoginException {
+        resolver = new MockResourceResolverFactory()
+                .getAdministrativeResourceResolver(null);
+    }
+
+    @Test
+    public void testCreate() throws Exception {
+
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put("byte", 0x0A);
+        properties.put("int", 10);
+        properties.put("long", 10L);
+        properties.put("float", 10.0f);
+        properties.put("double", 10.0d);
+        properties.put("string", "10");
+        properties.put("boolean", false);
+        properties.put("object", new Object(){
+            public String toString() {
+                return "object";
+            }
+        });
+        Resource resource = new MockResource("/some/path", properties, resolver);
+
+        JSONObject json = JsonObjectCreator.create(resource);
+
+        assertEquals(10, json.get("byte"));
+        assertEquals(10, json.get("int"));
+        assertEquals("10.0", json.get("float"));
+        assertEquals("10.0", json.get("double"));
+        assertEquals("10", json.get("string"));
+        assertEquals(false, json.get("boolean"));
+        assertEquals("object", json.get("object"));
+    }
+
+    @Test
+    public void testCreateArray() throws Exception {
+
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put("emptyArray", new Object[]{});
+        properties.put("stringArray", new String[]{"10","100"});
+        properties.put("intArray", new int[]{10, 100});
+        properties.put("doubleArray", new double[]{10d, 100d});
+        properties.put("byteArray", new byte[]{0x0A, 0x64});
+        properties.put("floatArray", new float[]{10.0f, 100.0f});
+        properties.put("shortArray", new short[]{10, 100});
+        properties.put("longArray", new long[]{10, 100});
+        properties.put("booleanArray", new boolean[]{true, false});
+        properties.put("charArray", new char[]{'a', 'b'});
+        Resource resource = new MockResource("/some/path", properties, resolver);
+
+        JSONObject json = JsonObjectCreator.create(resource);
+        assertEquals(0, json.getJSONArray("emptyArray").length());
+        JSONArray array;
+        array = json.getJSONArray("stringArray");
+        assertEquals("10", array.get(0));
+        array = json.getJSONArray("intArray");
+        assertEquals(10, array.get(0));
+        array = json.getJSONArray("doubleArray");
+        assertEquals("10.0", array.get(0));
+        array = json.getJSONArray("byteArray");
+        assertEquals("10", array.get(0));
+        array = json.getJSONArray("floatArray");
+        assertEquals("10.0", array.get(0));
+        array = json.getJSONArray("shortArray");
+        assertEquals("10", array.get(0));
+        array = json.getJSONArray("longArray");
+        assertEquals(10L, array.get(0));
+        array = json.getJSONArray("booleanArray");
+        assertEquals(true, array.get(0));
+        array = json.getJSONArray("charArray");
+        assertEquals("a", array.get(0));
+
+    }
+
+    @Test
+    public void testCreateDeep() throws Exception {
+
+        MockHelper.create(resolver)
+                .resource("/some")
+                .p("p1", "v1")
+                .resource("/some/path")
+                .p("p2", "v2")
+                .commit();
+        Resource resource = resolver.getResource("/some");
+
+        JSONObject json = JsonObjectCreator.create(resource);
+        assertEquals("v1", json.get("p1"));
+        JSONObject path = json.getJSONObject("path");
+        assertEquals("v2", path.get("p2"));
+
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java b/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
new file mode 100644
index 0000000..4a6a767
--- /dev/null
+++ b/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.resource.inventory.impl;
+
+import java.util.Collections;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.json.JSONObject;
+import org.apache.sling.testing.resourceresolver.MockHelper;
+import org.apache.sling.testing.resourceresolver.MockResource;
+import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class ResourceTraversorTest {
+
+    private ResourceResolver resolver;
+
+    @Before
+    public void setup() throws LoginException {
+        resolver = new MockResourceResolverFactory()
+                .getAdministrativeResourceResolver(null);
+    }
+
+    @Test
+    public void testCollectResources() throws Exception {
+        MockHelper.create(resolver)
+                .resource("/some")
+                .p("p1", "v1")
+                .resource("/some/path")
+                .p("p2", "v2")
+                .commit();
+        Resource resource = resolver.getResource("/some");
+        ResourceTraversor traversor = new ResourceTraversor(resource);
+        traversor.collectResources();
+        JSONObject json = traversor.getJSONObject();
+        assertEquals("v1", json.get("p1"));
+        JSONObject path = json.getJSONObject("path");
+        assertNotNull(path);
+        assertEquals("v2", path.get("p2"));
+
+    }
+
+    @Test
+    public void testGetJSONObject() throws Exception {
+        Resource resource = new MockResource("/some/path", Collections.<String, Object>singletonMap("p1", "v1"), resolver);
+        JSONObject json = new ResourceTraversor(resource).getJSONObject();
+        assertEquals("v1", json.get("p1"));
+
+    }
+
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 07/33: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 4c405b91306017b0919e2c96c9167e0488e17fe0
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 1 09:49:11 2013 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1528019 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index dea88df..d4e5b4d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>0.5.0</version>
+    <version>0.5.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-0.5.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 13/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit b41cabe487aa978f70e582ac57687573d29a8fc4
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Apr 22 10:46:07 2014 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1589080 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 67e4c51..91620fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>1.0.2</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.2</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 21/33: Update the contrib reactor to parent 25

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 9d289ecb835a86ba737e2b87fba30152b0fc5c57
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Oct 5 10:04:15 2015 +0000

    Update the contrib reactor to parent 25
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1706781 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 94c12c4..4b3590e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>24</version>
+        <version>25</version>
         <relativePath/>
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 14/33: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 137efbba24dc35aa05b3df4287895fc64b2cc544
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Apr 22 10:47:15 2014 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1589083 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 91620fe..f90f741 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.2</version>
+    <version>1.0.3-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.2</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.2</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.2</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 26/33: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 213bde194a7b60ed15723e19579913e2c6c26289
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 26 10:27:58 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1780354 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index a68a64e..c789244 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,15 +29,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.6</version>
+    <version>1.0.7-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.6</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 25/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.6

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 47ae41bf4add3acd2e921b488f36ede739e3a78d
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 26 10:27:41 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.6
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1780352 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9cd4bb1..a68a64e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,20 +24,20 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>29</version>
-        <relativePath/>
+        <relativePath />
     </parent>
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.5-SNAPSHOT</version>
+    <version>1.0.6</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.6</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.6</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 33/33: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit fc2965f62854522dbf4840de304f8dcc142fe121
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 09:29:57 2017 +0000

    SLING-7167 Adjust READMEs
    
    add missing README
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810742 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..44d8bc5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Apache Sling Inventory Printer Based on Resources
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 18/33: Use latest parent pom

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 9647064cc9dda952f3538cc4ba88dc697fd94c8d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 27 16:34:19 2015 +0000

    Use latest parent pom
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1676331 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index b9481a9..971fc6f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>17</version>
+        <version>22</version>
     </parent>
 
     <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 04/33: [maven-release-plugin] rollback the release of org.apache.sling.resource.inventory-0.5.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 90d865d1b1d2fc0cbdc4bae10c60b2698927305d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 1 09:47:51 2013 +0000

    [maven-release-plugin] rollback the release of org.apache.sling.resource.inventory-0.5.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1528015 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index dea88df..22cc664 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>0.5.0</version>
+    <version>0.0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-0.5.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resourceinventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 09/33: SLING-3198 : JSON Tree Rendering should do tree depth first tree traversal

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 55da4920bc35945a88dbef5c873fd3f38f0dce90
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 22 10:17:15 2013 +0000

    SLING-3198 : JSON Tree Rendering should do tree depth first tree traversal
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1534589 13f79535-47bb-0310-9956-ffa450edef68
---
 .../resource/inventory/impl/ResourceTraversor.java | 36 +++-------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
index b984cd6..ed2f161 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
@@ -18,7 +18,6 @@
 package org.apache.sling.resource.inventory.impl;
 
 import java.util.Iterator;
-import java.util.LinkedList;
 
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.commons.json.JSONException;
@@ -26,29 +25,13 @@ import org.apache.sling.commons.json.JSONObject;
 
 public class ResourceTraversor {
 
-    public static final class Entry {
-        public final Resource resource;
-        public final JSONObject json;
-
-        public Entry(final Resource r, final JSONObject o) {
-            this.resource = r;
-            this.json = o;
-        }
-    }
-
     private final JSONObject startObject;
 
-    private LinkedList<Entry> currentQueue;
-
-    private LinkedList<Entry> nextQueue;
-
     private final Resource startResource;
 
     public ResourceTraversor(final Resource resource)
     throws JSONException {
         this.startResource = resource;
-        this.currentQueue = new LinkedList<Entry>();
-        this.nextQueue = new LinkedList<Entry>();
         this.startObject = this.adapt(resource);
     }
 
@@ -58,7 +41,7 @@ public class ResourceTraversor {
      * @throws JSONException
      */
     public void collectResources() throws JSONException {
-        collectChildren(startResource, this.startObject, 0);
+        collectChildren(startResource, this.startObject);
     }
 
     /**
@@ -67,25 +50,14 @@ public class ResourceTraversor {
      * @throws JSONException
      */
     private void collectChildren(final Resource resource,
-            final JSONObject jsonObj,
-            int currentLevel)
+            final JSONObject jsonObj)
     throws JSONException {
 
         final Iterator<Resource> children = resource.listChildren();
         while (children.hasNext()) {
             final Resource res = children.next();
             final JSONObject json = collectResource(res, jsonObj);
-            nextQueue.addLast(new Entry(res, json));
-        }
-
-        while (!currentQueue.isEmpty() || !nextQueue.isEmpty()) {
-            if (currentQueue.isEmpty()) {
-                currentLevel++;
-                currentQueue = nextQueue;
-                nextQueue = new LinkedList<Entry>();
-            }
-            final Entry nextResource = currentQueue.removeFirst();
-            collectChildren(nextResource.resource, nextResource.json, currentLevel);
+            collectChildren(res, json);
         }
     }
 
@@ -96,7 +68,7 @@ public class ResourceTraversor {
      * @param level The level where this resource is located.
      * @throws JSONException
      */
-    private JSONObject collectResource(Resource resource, final JSONObject parent)
+    private JSONObject collectResource(final Resource resource, final JSONObject parent)
     throws JSONException {
         final JSONObject o = adapt(resource);
         parent.put(resource.getName(), o);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 03/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 93aff10cea92295c98f72b9424c64b9b3c53f4d7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 1 09:46:17 2013 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1528012 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 22cc664..dea88df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>0.5.0</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resourceinventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-0.5.0</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 32/33: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 1c4ad15b94587bd6ce25730ef6d5126853f6bacf
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Fri Jun 2 20:22:30 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797427 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 40f7759..843b3a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,15 +29,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.8</version>
+    <version>1.0.9-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.8</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.8</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.8</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 27/33: use Sling Parent 30

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit f7c83eaef94dac93848ce7455c46a09be8cec8df
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 10:22:30 2017 +0000

    use Sling Parent 30
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1785621 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index c789244..e959a19 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>29</version>
+        <version>30</version>
         <relativePath />
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 17/33: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit f21eed3b857211159b3c3fd71402d120d4afcb52
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 15 10:16:44 2015 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1673710 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index c452c40..b9481a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.4</version>
+    <version>1.0.5-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.4</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.4</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.4</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 16/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.4

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit beb3170ef22431e40298bda1718f108b91f30550
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 15 10:16:20 2015 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.4
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1673708 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index f90f741..c452c40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.3-SNAPSHOT</version>
+    <version>1.0.4</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.4</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.4</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.4</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 23/33: Switch to parent pom 29 and OSGi annotations

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit c7a79f6d1c326b8b1463a3c09956b1822acbe4b8
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Nov 15 14:50:11 2016 +0000

    Switch to parent pom 29 and OSGi annotations
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1769844 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 12 +----
 .../impl/ResourceInventoryPrinterFactory.java      | 54 +++++++++++++---------
 .../OSGI-INF/metatype/metatype.properties          | 36 ---------------
 3 files changed, 34 insertions(+), 68 deletions(-)

diff --git a/pom.xml b/pom.xml
index c942084..8e046fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>26</version>
+        <version>29</version>
         <relativePath/>
     </parent>
 
@@ -81,20 +81,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-        	<groupId>org.apache.felix</groupId>
-        	<artifactId>org.apache.felix.scr.annotations</artifactId>
-        </dependency>
-        <dependency>
         	<groupId>org.slf4j</groupId>
         	<artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
         	<groupId>javax.servlet</groupId>
-        	<artifactId>servlet-api</artifactId>
+        	<artifactId>javax.servlet-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
index 77148ad..a3618e4 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
@@ -19,50 +19,60 @@
 package org.apache.sling.resource.inventory.impl;
 
 import java.io.PrintWriter;
-import java.util.Map;
 
 import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.commons.json.JSONException;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.LoggerFactory;
 
-@Component(configurationFactory=true, policy=ConfigurationPolicy.REQUIRE, metatype=true)
-@Service(value=InventoryPrinter.class)
-@Properties({
-    @Property(name=InventoryPrinter.FORMAT, value="JSON", propertyPrivate=true),
-    @Property(name=InventoryPrinter.NAME),
-    @Property(name=InventoryPrinter.TITLE),
-    @Property(name=InventoryPrinter.WEBCONSOLE, boolValue=false, propertyPrivate=true)
-})
+@Component(service = InventoryPrinter.class,
+           configurationPolicy=ConfigurationPolicy.REQUIRE,
+           property = {
+                   InventoryPrinter.FORMAT + "=JSON",
+                   InventoryPrinter.WEBCONSOLE + ":Boolean=false"
+           })
+@Designate(ocd=ResourceInventoryPrinterFactory.Config.class, factory=true)
 public class ResourceInventoryPrinterFactory implements InventoryPrinter {
 
-    @Property(value = "")
-    private static final String PROP_PATH = "path";
+    @ObjectClassDefinition(name = "Apache Sling Resource Inventory Printer Factory",
+                           description = "This factory can be used to add " +
+                                         "resource trees to the inventory of the system.")
+    public @interface Config {
 
-    private String path;
+        @AttributeDefinition(name="Name", description="The unique name of the inventory printer.")
+        String felix_inventory_printer_name();
 
-    @Activate
-    protected void activate(final Map<String, Object> props) {
-        this.path = (String)props.get(PROP_PATH);
+        @AttributeDefinition(name="Title", description="The title of the inventory printer.")
+        String felix_inventory_printer_title();
+
+        @AttributeDefinition(name="Path", description="The resource path to include.")
+        String path() default "";
     }
+    private String path;
 
     @Reference
     private ResourceResolverFactory factory;
 
+    @Activate
+    protected void activate(final Config config) {
+        this.path = config.path();
+    }
+
     /**
      * @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
      */
+    @Override
     public void print(PrintWriter printWriter, Format format, boolean isZip) {
         if ( this.path == null || !format.equals(Format.JSON) ) {
             return;
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
deleted file mode 100644
index 7850046..0000000
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-
-#
-# This file contains localization strings for configuration labels and
-# descriptions as used in the metatype.xml descriptor generated by the
-# the SCR plugin
-
-org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.name=Apache Sling Resource Inventory Printer Factory
-org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.desription=This factory can be used to add \
- resource trees to the inventory of the system.
-
-felix.inventory.printer.name.name=Name
-felix.inventory.printer.name.description=The unique name of the inventory printer.
-
-felix.inventory.printer.title.name=Title
-felix.inventory.printer.title.description=The title of the inventory printer.
-
-path.name=Path
-path.description=The resource path to include.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 05/33: Correct scm info

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 382ed4a5e0c79b0b9b1f6f0a0a1cc29ef7b307be
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 1 09:48:20 2013 +0000

    Correct scm info
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1528016 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 22cc664..4b73bd2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,9 +34,9 @@
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resourceinventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 28/33: add missing Felix SCR annotations

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit bc7d8ac929b52d68be06bac6f59ddf4eafd93070
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 19:00:14 2017 +0000

    add missing Felix SCR annotations
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1785730 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pom.xml b/pom.xml
index e959a19..e7f09df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,11 @@
     
     <dependencies>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
     	    <groupId>org.apache.sling</groupId>
     	    <artifactId>org.apache.sling.api</artifactId>
     	    <version>2.4.0</version>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 31/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.8

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit d1969df7c9321c53069eca378a5cb014056be215
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Fri Jun 2 20:22:12 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-1.0.8
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797425 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 76f494e..40f7759 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,15 +29,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.7-SNAPSHOT</version>
+    <version>1.0.8</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.8</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.8</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.8</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 19/33: Update contrib modules to Parent 23

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 448f5d1fffc0dfdc84dbff5c6e28c2719ce47640
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:10:59 2015 +0000

    Update contrib modules to Parent 23
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1687503 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 971fc6f..8e186a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>22</version>
+        <version>23</version>
     </parent>
 
     <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 22/33: Switch to parent pom 26

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 73d632d58e8ed2f1dc0a231508e03efccae7a44d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jan 3 14:07:46 2016 +0000

    Switch to parent pom 26
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1722720 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 4b3590e..c942084 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>25</version>
+        <version>26</version>
         <relativePath/>
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 06/33: [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 1fdcc94020f938a4428e52b4dfc87827410240f7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 1 09:48:52 2013 +0000

    [maven-release-plugin] prepare release org.apache.sling.resource.inventory-0.5.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1528017 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4b73bd2..dea88df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>0.5.0</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-0.5.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-0.5.0</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 01/33: SLING-3018 : Add an inventory printer which dumps a resource tree into json

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit b09eb34aa12041f153f613e63742bf428861f041
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Aug 14 15:12:50 2013 +0000

    SLING-3018 :  Add an inventory printer which dumps a resource tree into json
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1513925 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  99 ++++++++++
 .../resource/inventory/impl/JsonObjectCreator.java | 211 +++++++++++++++++++++
 .../impl/ResourceInventoryPrinterFactory.java      |  90 +++++++++
 .../resource/inventory/impl/ResourceTraversor.java | 120 ++++++++++++
 4 files changed, 520 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..22cc664
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>17</version>
+    </parent>
+
+    <groupId>org.apache.sling</groupId>
+    <artifactId>org.apache.sling.resource.inventory</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Sling Inventory Printer Based on Resources</name>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourceinventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resourceinventory</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Private-Package>
+                            org.apache.sling.resource.inventory.impl
+                        </Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <dependency>
+    	    <groupId>org.apache.sling</groupId>
+    	    <artifactId>org.apache.sling.api</artifactId>
+    	    <version>2.4.0</version>
+    	    <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.json</artifactId>
+            <version>2.0.6</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.inventory</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.felix</groupId>
+        	<artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+        	<groupId>org.slf4j</groupId>
+        	<artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+        	<groupId>javax.servlet</groupId>
+        	<artifactId>servlet-api</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
new file mode 100644
index 0000000..25984e7
--- /dev/null
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.resource.inventory.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.commons.json.JSONArray;
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.JSONObject;
+
+/**
+ * Creates a JSONObject from a resource
+ *
+ */
+public abstract class JsonObjectCreator {
+
+    /** Dump given resource in JSON, optionally recursing into its objects */
+    public static JSONObject create(final Resource resource)
+    throws JSONException {
+        final ValueMap valueMap = resource.adaptTo(ValueMap.class);
+
+        @SuppressWarnings("unchecked")
+        final Map propertyMap = (valueMap != null)
+                ? valueMap
+                : resource.adaptTo(Map.class);
+
+        final JSONObject obj = new JSONObject();
+
+        if (propertyMap == null) {
+
+            // no map available, try string
+            final String value = resource.adaptTo(String.class);
+            if (value != null) {
+
+                // single value property or just plain String resource or...
+                obj.put(resource.getName(), value);
+
+            } else {
+
+                // Try multi-value "property"
+                final String[] values = resource.adaptTo(String[].class);
+                if (values != null) {
+                    obj.put(resource.getName(), new JSONArray(Arrays.asList(values)));
+                }
+
+            }
+            if ( resource.getResourceType() != null ) {
+                obj.put("sling:resourceType", resource.getResourceType());
+            }
+            if ( resource.getResourceSuperType() != null ) {
+                obj.put("sling:resourceSuperType", resource.getResourceSuperType());
+            }
+
+        } else {
+
+            @SuppressWarnings("unchecked")
+            final Iterator<Map.Entry> props = propertyMap.entrySet().iterator();
+
+            // the node's actual properties
+            while (props.hasNext()) {
+                @SuppressWarnings("unchecked")
+                final Map.Entry prop = props.next();
+
+                if ( prop.getValue() != null ) {
+                    createProperty(obj, valueMap, prop.getKey().toString(),
+                        prop.getValue());
+                }
+            }
+        }
+
+        // the child nodes
+        final Iterator<Resource> children = resource.listChildren();
+        while (children.hasNext()) {
+            final Resource n = children.next();
+            createSingleResource(n, obj);
+        }
+
+        return obj;
+    }
+
+    /** Used to format date values */
+    private static final String ECMA_DATE_FORMAT = "EEE MMM dd yyyy HH:mm:ss 'GMT'Z";
+
+    /** Used to format date values */
+    private static final Locale DATE_FORMAT_LOCALE = Locale.US;
+
+    private static final DateFormat CALENDAR_FORMAT = new SimpleDateFormat(ECMA_DATE_FORMAT, DATE_FORMAT_LOCALE);
+
+    private static synchronized String format(final Calendar date) {
+        return CALENDAR_FORMAT.format(date.getTime());
+    }
+
+    /** Dump only a value in the correct format */
+    private static Object getValue(final Object value) {
+        if ( value instanceof InputStream ) {
+            // input stream is already handled
+            return 0;
+        } else if ( value instanceof Calendar ) {
+            return format((Calendar)value);
+        } else if ( value instanceof Boolean ) {
+            return value;
+        } else if ( value instanceof Long ) {
+            return value;
+        } else if ( value instanceof Integer ) {
+            return value;
+        } else if ( value instanceof Double ) {
+            return value;
+        } else {
+            return value.toString();
+        }
+    }
+
+    /** Dump a single node */
+    private static void createSingleResource(final Resource n, final JSONObject parent)
+            throws JSONException {
+        parent.put(n.getName(), create(n));
+    }
+
+    /**
+     * Write a single property
+     */
+    private static void createProperty(final JSONObject obj,
+                                 final ValueMap valueMap,
+                                 final String key,
+                                 final Object value)
+    throws JSONException {
+        Object[] values = null;
+        if (value.getClass().isArray()) {
+            values = (Object[])value;
+            // write out empty array
+            if ( values.length == 0 ) {
+                obj.put(key, new JSONArray());
+                return;
+            }
+        }
+
+        // special handling for binaries: we dump the length and not the data!
+        if (value instanceof InputStream
+            || (values != null && values[0] instanceof InputStream)) {
+            // TODO for now we mark binary properties with an initial colon in
+            // their name
+            // (colon is not allowed as a JCR property name)
+            // in the name, and the value should be the size of the binary data
+            if (values == null) {
+                obj.put(":" + key, getLength(valueMap, -1, key, (InputStream)value));
+            } else {
+                final JSONArray result = new JSONArray();
+                for (int i = 0; i < values.length; i++) {
+                    result.put(getLength(valueMap, i, key, (InputStream)values[i]));
+                }
+                obj.put(":" + key, result);
+            }
+            return;
+        }
+
+        if (!value.getClass().isArray()) {
+            obj.put(key, getValue(value));
+        } else {
+            final JSONArray result = new JSONArray();
+            for (Object v : values) {
+                result.put(getValue(v));
+            }
+            obj.put(key, result);
+        }
+    }
+
+    private static long getLength(final ValueMap    valueMap,
+                           final int         index,
+                           final String      key,
+                           final InputStream stream) {
+        try {
+            stream.close();
+        } catch (IOException ignore) {}
+        long length = -1;
+        if ( valueMap != null ) {
+            if ( index == -1 ) {
+                length = valueMap.get(key, length);
+            } else {
+                Long[] lengths = valueMap.get(key, Long[].class);
+                if ( lengths != null && lengths.length > index ) {
+                    length = lengths[index];
+                }
+            }
+        }
+        return length;
+    }
+}
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
new file mode 100644
index 0000000..4591274
--- /dev/null
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.resource.inventory.impl;
+
+import java.io.PrintWriter;
+import java.util.Map;
+
+import org.apache.felix.inventory.Format;
+import org.apache.felix.inventory.InventoryPrinter;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.commons.json.JSONException;
+
+@Component(configurationFactory=true, policy=ConfigurationPolicy.REQUIRE, metatype=true)
+@Service(value=InventoryPrinter.class)
+@Properties({
+    @Property(name=InventoryPrinter.FORMAT, value="JSON", propertyPrivate=true),
+    @Property(name=InventoryPrinter.NAME),
+    @Property(name=InventoryPrinter.TITLE),
+    @Property(name=InventoryPrinter.WEBCONSOLE, boolValue=false, propertyPrivate=true)
+})
+public class ResourceInventoryPrinterFactory implements InventoryPrinter {
+
+    @Property(value = "")
+    private static final String PROP_PATH = "path";
+
+    private String path;
+
+    @Activate
+    protected void activate(final Map<String, Object> props) {
+        this.path = (String)props.get(PROP_PATH);
+    }
+
+    @Reference
+    private ResourceResolverFactory factory;
+
+    /**
+     * @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
+     */
+    public void print(PrintWriter printWriter, Format format, boolean isZip) {
+        if ( this.path == null || !format.equals(Format.JSON) ) {
+            return;
+        }
+        ResourceResolver resolver = null;
+        try {
+            resolver = factory.getAdministrativeResourceResolver(null);
+            final Resource rootResource = resolver.getResource(this.path);
+            if ( rootResource != null ) {
+                final ResourceTraversor rt = new ResourceTraversor(rootResource);
+                rt.collectResources();
+                printWriter.write(rt.getJSONObject().toString(2));
+
+            }
+        } catch (final LoginException e) {
+            // ignore
+        } catch (JSONException e) {
+            // ignore
+        } finally {
+            if ( resolver != null ) {
+                resolver.close();
+            }
+        }
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
new file mode 100644
index 0000000..b984cd6
--- /dev/null
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sling.resource.inventory.impl;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.JSONObject;
+
+public class ResourceTraversor {
+
+    public static final class Entry {
+        public final Resource resource;
+        public final JSONObject json;
+
+        public Entry(final Resource r, final JSONObject o) {
+            this.resource = r;
+            this.json = o;
+        }
+    }
+
+    private final JSONObject startObject;
+
+    private LinkedList<Entry> currentQueue;
+
+    private LinkedList<Entry> nextQueue;
+
+    private final Resource startResource;
+
+    public ResourceTraversor(final Resource resource)
+    throws JSONException {
+        this.startResource = resource;
+        this.currentQueue = new LinkedList<Entry>();
+        this.nextQueue = new LinkedList<Entry>();
+        this.startObject = this.adapt(resource);
+    }
+
+    /**
+     * Recursive descent from startResource, collecting JSONObjects into
+     * startObject.
+     * @throws JSONException
+     */
+    public void collectResources() throws JSONException {
+        collectChildren(startResource, this.startObject, 0);
+    }
+
+    /**
+     * @param resource
+     * @param currentLevel
+     * @throws JSONException
+     */
+    private void collectChildren(final Resource resource,
+            final JSONObject jsonObj,
+            int currentLevel)
+    throws JSONException {
+
+        final Iterator<Resource> children = resource.listChildren();
+        while (children.hasNext()) {
+            final Resource res = children.next();
+            final JSONObject json = collectResource(res, jsonObj);
+            nextQueue.addLast(new Entry(res, json));
+        }
+
+        while (!currentQueue.isEmpty() || !nextQueue.isEmpty()) {
+            if (currentQueue.isEmpty()) {
+                currentLevel++;
+                currentQueue = nextQueue;
+                nextQueue = new LinkedList<Entry>();
+            }
+            final Entry nextResource = currentQueue.removeFirst();
+            collectChildren(nextResource.resource, nextResource.json, currentLevel);
+        }
+    }
+
+    /**
+     * Adds a resource in the JSON tree.
+     *
+     * @param resource The resource to add
+     * @param level The level where this resource is located.
+     * @throws JSONException
+     */
+    private JSONObject collectResource(Resource resource, final JSONObject parent)
+    throws JSONException {
+        final JSONObject o = adapt(resource);
+        parent.put(resource.getName(), o);
+        return o;
+    }
+
+    /**
+     * Adapt a Resource to a JSON Object.
+     *
+     * @param resource The resource to adapt.
+     * @return The JSON representation of the Resource
+     * @throws JSONException
+     */
+    private JSONObject adapt(final Resource resource) throws JSONException {
+        return JsonObjectCreator.create(resource);
+    }
+
+    public JSONObject getJSONObject() {
+        return startObject;
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 29/33: SLING-6898: Remove commons.json from Resource Inventory.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 3e29a446fb2d1c3450c94ac03092349d3c6b26c8
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Wed May 31 12:51:16 2017 +0000

    SLING-6898: Remove commons.json from Resource Inventory.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797029 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  4 +-
 .../resource/inventory/impl/JsonObjectCreator.java | 79 +++++++++++-----------
 .../impl/ResourceInventoryPrinterFactory.java      | 13 ++--
 .../resource/inventory/impl/ResourceTraversor.java | 33 ++++-----
 .../inventory/impl/JsonObjectCreatorTest.java      | 71 +++++++++----------
 .../inventory/impl/ResourceTraversorTest.java      | 15 ++--
 6 files changed, 113 insertions(+), 102 deletions(-)

diff --git a/pom.xml b/pom.xml
index e7f09df..76f494e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,8 +75,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.json</artifactId>
-            <version>2.0.6</version>
+            <artifactId>org.apache.sling.commons.johnzon</artifactId>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
index 34d5d23..b08e418 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
@@ -20,18 +20,21 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonException;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonValue;
+
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -41,8 +44,7 @@ import org.slf4j.LoggerFactory;
 public abstract class JsonObjectCreator {
 
     /** Dump given resource in JSON, optionally recursing into its objects */
-    public static JSONObject create(final Resource resource)
-    throws JSONException {
+    public static JsonObjectBuilder create(final Resource resource) {
         final ValueMap valueMap = resource.adaptTo(ValueMap.class);
 
         @SuppressWarnings("unchecked")
@@ -50,7 +52,7 @@ public abstract class JsonObjectCreator {
                 ? valueMap
                 : resource.adaptTo(Map.class);
 
-        final JSONObject obj = new JSONObject();
+        final JsonObjectBuilder obj = Json.createObjectBuilder();
 
         if (propertyMap == null) {
 
@@ -59,22 +61,26 @@ public abstract class JsonObjectCreator {
             if (value != null) {
 
                 // single value property or just plain String resource or...
-                obj.put(resource.getName(), value);
+                obj.add(resource.getName(), value);
 
             } else {
 
                 // Try multi-value "property"
                 final String[] values = resource.adaptTo(String[].class);
                 if (values != null) {
-                    obj.put(resource.getName(), new JSONArray(Arrays.asList(values)));
+                    JsonArrayBuilder array = Json.createArrayBuilder();
+                    for (String v : values) {
+                        array.add(v);
+                    }
+                    obj.add(resource.getName(), array);
                 }
 
             }
             if ( resource.getResourceType() != null ) {
-                obj.put("sling:resourceType", resource.getResourceType());
+                obj.add("sling:resourceType", resource.getResourceType());
             }
             if ( resource.getResourceSuperType() != null ) {
-                obj.put("sling:resourceSuperType", resource.getResourceSuperType());
+                obj.add("sling:resourceSuperType", resource.getResourceSuperType());
             }
 
         } else {
@@ -117,35 +123,36 @@ public abstract class JsonObjectCreator {
     }
 
     /** Dump only a value in the correct format */
-    private static Object getValue(final Object value) {
+    private static JsonValue getValue(final Object value) {
+        JsonObjectBuilder builder = Json.createObjectBuilder();
         if ( value instanceof InputStream ) {
             // input stream is already handled
-            return 0;
+            builder.add("key", 0);
         } else if ( value instanceof Calendar ) {
-            return format((Calendar)value);
+            builder.add("key",format((Calendar)value));
         } else if ( value instanceof Boolean ) {
-            return value;
+            builder.add("key", (Boolean) value);
         } else if ( value instanceof Long ) {
-            return value;
+            builder.add("key", (Long) value);
         } else if ( value instanceof Integer ) {
-            return value;
+            builder.add("key", (Integer) value);
         } else if ( value != null ) {
-            return value.toString();
+            builder.add("key", value.toString());
         } else {
-            return ""; // assume empty string
+            builder.add("key", ""); // assume empty string
         }
+        return builder.build().get("key");
     }
 
     /** Dump a single node */
-    private static void createSingleResource(final Resource n, final JSONObject parent)
-            throws JSONException {
-        parent.put(n.getName(), create(n));
+    private static void createSingleResource(final Resource n, final JsonObjectBuilder parent) {
+        parent.add(n.getName(), create(n));
     }
 
     /**
      * Write a single property
      */
-    private static void createProperty(final JSONObject obj,
+    private static void createProperty(final JsonObjectBuilder obj,
                                  final ValueMap valueMap,
                                  final String key,
                                  final Object value) {
@@ -174,11 +181,7 @@ public abstract class JsonObjectCreator {
             }
             // write out empty array
             if ( values.length == 0 ) {
-                try {
-                    obj.put(key, new JSONArray());
-                } catch ( final JSONException ignore ) {
-                    // we ignore this
-                }
+                obj.add(key, Json.createArrayBuilder());
                 return;
             }
         }
@@ -192,15 +195,15 @@ public abstract class JsonObjectCreator {
             // in the name, and the value should be the size of the binary data
             try {
                 if (values == null) {
-                    obj.put(":" + key, getLength(valueMap, -1, key, (InputStream)value));
+                    obj.add(":" + key, getLength(valueMap, -1, key, (InputStream)value));
                 } else {
-                    final JSONArray result = new JSONArray();
+                    final JsonArrayBuilder result = Json.createArrayBuilder();
                     for (int i = 0; i < values.length; i++) {
-                        result.put(getLength(valueMap, i, key, (InputStream)values[i]));
+                        result.add(getLength(valueMap, i, key, (InputStream)values[i]));
                     }
-                    obj.put(":" + key, result);
+                    obj.add(":" + key, result);
                 }
-            } catch ( final JSONException ignore ) {
+            } catch ( final JsonException ignore ) {
                 // we ignore this
                 LoggerFactory.getLogger(JsonObjectCreator.class).warn("Unable to create JSON value", ignore);
             }
@@ -209,15 +212,15 @@ public abstract class JsonObjectCreator {
 
         try {
             if (!value.getClass().isArray()) {
-                obj.put(key, getValue(value));
+                obj.add(key, getValue(value));
             } else {
-                final JSONArray result = new JSONArray();
+                final JsonArrayBuilder result = Json.createArrayBuilder();
                 for (Object v : values) {
-                    result.put(getValue(v));
+                    result.add(getValue(v));
                 }
-                obj.put(key, result);
+                obj.add(key, result);
             }
-        } catch ( final JSONException ignore ) {
+        } catch ( final JsonException ignore ) {
             // we ignore this
             LoggerFactory.getLogger(JsonObjectCreator.class).warn("Unable to create JSON value", ignore);
         }
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
index a3618e4..347619e 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
@@ -19,6 +19,11 @@
 package org.apache.sling.resource.inventory.impl;
 
 import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.json.Json;
+import javax.json.JsonException;
+import javax.json.stream.JsonGenerator;
 
 import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.InventoryPrinter;
@@ -26,7 +31,6 @@ import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
-import org.apache.sling.commons.json.JSONException;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.ConfigurationPolicy;
@@ -84,12 +88,13 @@ public class ResourceInventoryPrinterFactory implements InventoryPrinter {
             if ( rootResource != null ) {
                 final ResourceTraversor rt = new ResourceTraversor(rootResource);
                 rt.collectResources();
-                printWriter.write(rt.getJSONObject().toString(2));
-
+                StringWriter writer = new StringWriter();
+                Json.createGenerator(writer).write(rt.getJsonObject()).close();
+                printWriter.write(writer.toString());
             }
         } catch (final LoginException e) {
             // ignore
-        } catch (final JSONException ignore) {
+        } catch (final JsonException ignore) {
             LoggerFactory.getLogger(this.getClass()).warn("Unable to create resource json", ignore);
         } finally {
             if ( resolver != null ) {
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
index ed2f161..0a8d960 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
@@ -19,18 +19,19 @@ package org.apache.sling.resource.inventory.impl;
 
 import java.util.Iterator;
 
+import javax.json.JsonException;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
 
 public class ResourceTraversor {
 
-    private final JSONObject startObject;
+    private final JsonObjectBuilder startObject;
 
     private final Resource startResource;
 
-    public ResourceTraversor(final Resource resource)
-    throws JSONException {
+    public ResourceTraversor(final Resource resource) {
         this.startResource = resource;
         this.startObject = this.adapt(resource);
     }
@@ -40,7 +41,7 @@ public class ResourceTraversor {
      * startObject.
      * @throws JSONException
      */
-    public void collectResources() throws JSONException {
+    public void collectResources() throws JsonException {
         collectChildren(startResource, this.startObject);
     }
 
@@ -50,13 +51,13 @@ public class ResourceTraversor {
      * @throws JSONException
      */
     private void collectChildren(final Resource resource,
-            final JSONObject jsonObj)
-    throws JSONException {
+            final JsonObjectBuilder jsonObj)
+    throws JsonException {
 
         final Iterator<Resource> children = resource.listChildren();
         while (children.hasNext()) {
             final Resource res = children.next();
-            final JSONObject json = collectResource(res, jsonObj);
+            final JsonObjectBuilder json = collectResource(res, jsonObj);
             collectChildren(res, json);
         }
     }
@@ -68,10 +69,10 @@ public class ResourceTraversor {
      * @param level The level where this resource is located.
      * @throws JSONException
      */
-    private JSONObject collectResource(final Resource resource, final JSONObject parent)
-    throws JSONException {
-        final JSONObject o = adapt(resource);
-        parent.put(resource.getName(), o);
+    private JsonObjectBuilder collectResource(final Resource resource, final JsonObjectBuilder parent)
+    throws JsonException {
+        final JsonObjectBuilder o = adapt(resource);
+        parent.add(resource.getName(), o);
         return o;
     }
 
@@ -82,11 +83,11 @@ public class ResourceTraversor {
      * @return The JSON representation of the Resource
      * @throws JSONException
      */
-    private JSONObject adapt(final Resource resource) throws JSONException {
+    private JsonObjectBuilder adapt(final Resource resource) throws JsonException {
         return JsonObjectCreator.create(resource);
     }
 
-    public JSONObject getJSONObject() {
-        return startObject;
+    public JsonObject getJsonObject() {
+        return startObject.build();
     }
 }
diff --git a/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java b/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
index 4b072b0..5468951 100644
--- a/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
+++ b/src/test/java/org/apache/sling/resource/inventory/impl/JsonObjectCreatorTest.java
@@ -19,11 +19,12 @@ package org.apache.sling.resource.inventory.impl;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONObject;
 import org.apache.sling.testing.resourceresolver.MockHelper;
 import org.apache.sling.testing.resourceresolver.MockResource;
 import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
@@ -60,15 +61,15 @@ public class JsonObjectCreatorTest {
         });
         Resource resource = new MockResource("/some/path", properties, resolver);
 
-        JSONObject json = JsonObjectCreator.create(resource);
+        JsonObject json = JsonObjectCreator.create(resource).build();
 
-        assertEquals(10, json.get("byte"));
-        assertEquals(10, json.get("int"));
-        assertEquals("10.0", json.get("float"));
-        assertEquals("10.0", json.get("double"));
-        assertEquals("10", json.get("string"));
-        assertEquals(false, json.get("boolean"));
-        assertEquals("object", json.get("object"));
+        assertEquals(10, json.getInt("byte"));
+        assertEquals(10, json.getInt("int"));
+        assertEquals("10.0", json.getString("float"));
+        assertEquals("10.0", json.getString("double"));
+        assertEquals("10", json.getString("string"));
+        assertEquals(false, json.getBoolean("boolean"));
+        assertEquals("object", json.getString("object"));
     }
 
     @Test
@@ -87,27 +88,27 @@ public class JsonObjectCreatorTest {
         properties.put("charArray", new char[]{'a', 'b'});
         Resource resource = new MockResource("/some/path", properties, resolver);
 
-        JSONObject json = JsonObjectCreator.create(resource);
-        assertEquals(0, json.getJSONArray("emptyArray").length());
-        JSONArray array;
-        array = json.getJSONArray("stringArray");
-        assertEquals("10", array.get(0));
-        array = json.getJSONArray("intArray");
-        assertEquals(10, array.get(0));
-        array = json.getJSONArray("doubleArray");
-        assertEquals("10.0", array.get(0));
-        array = json.getJSONArray("byteArray");
-        assertEquals("10", array.get(0));
-        array = json.getJSONArray("floatArray");
-        assertEquals("10.0", array.get(0));
-        array = json.getJSONArray("shortArray");
-        assertEquals("10", array.get(0));
-        array = json.getJSONArray("longArray");
-        assertEquals(10L, array.get(0));
-        array = json.getJSONArray("booleanArray");
-        assertEquals(true, array.get(0));
-        array = json.getJSONArray("charArray");
-        assertEquals("a", array.get(0));
+        JsonObject json = JsonObjectCreator.create(resource).build();
+        assertEquals(0, json.getJsonArray("emptyArray").size());
+        JsonArray array;
+        array = json.getJsonArray("stringArray");
+        assertEquals("10", array.getString(0));
+        array = json.getJsonArray("intArray");
+        assertEquals(10, array.getInt(0));
+        array = json.getJsonArray("doubleArray");
+        assertEquals("10.0", array.getString(0));
+        array = json.getJsonArray("byteArray");
+        assertEquals("10", array.getString(0));
+        array = json.getJsonArray("floatArray");
+        assertEquals("10.0", array.getString(0));
+        array = json.getJsonArray("shortArray");
+        assertEquals("10", array.getString(0));
+        array = json.getJsonArray("longArray");
+        assertEquals(10L, array.getJsonNumber(0).longValue());
+        array = json.getJsonArray("booleanArray");
+        assertEquals(true, array.getBoolean(0));
+        array = json.getJsonArray("charArray");
+        assertEquals("a", array.getString(0));
 
     }
 
@@ -122,10 +123,10 @@ public class JsonObjectCreatorTest {
                 .commit();
         Resource resource = resolver.getResource("/some");
 
-        JSONObject json = JsonObjectCreator.create(resource);
-        assertEquals("v1", json.get("p1"));
-        JSONObject path = json.getJSONObject("path");
-        assertEquals("v2", path.get("p2"));
+        JsonObject json = JsonObjectCreator.create(resource).build();
+        assertEquals("v1", json.getString("p1"));
+        JsonObject path = json.getJsonObject("path");
+        assertEquals("v2", path.getString("p2"));
 
     }
 }
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java b/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
index 4a6a767..098d112 100644
--- a/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
+++ b/src/test/java/org/apache/sling/resource/inventory/impl/ResourceTraversorTest.java
@@ -18,10 +18,11 @@ package org.apache.sling.resource.inventory.impl;
 
 import java.util.Collections;
 
+import javax.json.JsonObject;
+
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.commons.json.JSONObject;
 import org.apache.sling.testing.resourceresolver.MockHelper;
 import org.apache.sling.testing.resourceresolver.MockResource;
 import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
@@ -52,19 +53,19 @@ public class ResourceTraversorTest {
         Resource resource = resolver.getResource("/some");
         ResourceTraversor traversor = new ResourceTraversor(resource);
         traversor.collectResources();
-        JSONObject json = traversor.getJSONObject();
-        assertEquals("v1", json.get("p1"));
-        JSONObject path = json.getJSONObject("path");
+        JsonObject json = traversor.getJsonObject();
+        assertEquals("v1", json.getString("p1"));
+        JsonObject path = json.getJsonObject("path");
         assertNotNull(path);
-        assertEquals("v2", path.get("p2"));
+        assertEquals("v2", path.getString("p2"));
 
     }
 
     @Test
     public void testGetJSONObject() throws Exception {
         Resource resource = new MockResource("/some/path", Collections.<String, Object>singletonMap("p1", "v1"), resolver);
-        JSONObject json = new ResourceTraversor(resource).getJSONObject();
-        assertEquals("v1", json.get("p1"));
+        JsonObject json = new ResourceTraversor(resource).getJsonObject();
+        assertEquals("v1", json.getString("p1"));
 
     }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 12/33: SLING-3507 : Potential NPE in JSON dump from JMX

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 4512071bb10fd673c9ffe20535c4e3a315dbda68
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Apr 22 09:22:39 2014 +0000

    SLING-3507 : Potential NPE in JSON dump from JMX
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1589049 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/resource/inventory/impl/JsonObjectCreator.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
index bbe022b..2516edc 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
@@ -130,8 +130,10 @@ public abstract class JsonObjectCreator {
             return value;
         } else if ( value instanceof Double ) {
             return value;
-        } else {
+        } else if ( value != null ) {
             return value.toString();
+        } else {
+            return ""; // assume empty string
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 20/33: set parent version to 24 and add empty relativePath where missing

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 4b434fa8afe56816377b7341d7eaa44162aca813
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 7 07:36:29 2015 +0000

    set parent version to 24 and add empty relativePath where missing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1689588 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 8e186a4..94c12c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,8 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>23</version>
+        <version>24</version>
+        <relativePath/>
     </parent>
 
     <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 11/33: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 84c3c2b2cf55e474cbf34d8e15a083f27385ebb9
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Mar 5 11:18:28 2014 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1574437 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 212c7a0..67e4c51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,15 +28,15 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.resource.inventory</artifactId>
-    <version>1.0.0</version>
+    <version>1.0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Inventory Printer Based on Resources</name>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.resource.inventory-1.0.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.resource.inventory-1.0.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resource-inventory</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resource-inventory</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 08/33: SLING-3197 : ClassCastException when serializing arrays of scalar types

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit fbfd92255668d3cea25c94269d3d8cf38d604202
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 22 09:51:08 2013 +0000

    SLING-3197 : ClassCastException when serializing arrays of scalar types
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1534576 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  6 ++++++
 .../resource/inventory/impl/JsonObjectCreator.java | 23 +++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d4e5b4d..d2f9981 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,5 +95,11 @@
         	<groupId>javax.servlet</groupId>
         	<artifactId>servlet-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.0</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
index 25984e7..bbe022b 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.commons.json.JSONArray;
@@ -150,7 +151,27 @@ public abstract class JsonObjectCreator {
     throws JSONException {
         Object[] values = null;
         if (value.getClass().isArray()) {
-            values = (Object[])value;
+            if (value instanceof long[]) {
+                values = ArrayUtils.toObject((long[])value);
+            } else if (value instanceof int[]) {
+                values = ArrayUtils.toObject((int[])value);
+            } else if (value instanceof double[]) {
+                values = ArrayUtils.toObject((double[])value);
+            } else if (value instanceof byte[]) {
+                values = ArrayUtils.toObject((byte[])value);
+            } else if (value instanceof float[]) {
+                values = ArrayUtils.toObject((float[])value);
+            } else if (value instanceof short[]) {
+                values = ArrayUtils.toObject((short[])value);
+            } else if (value instanceof long[]) {
+                values = ArrayUtils.toObject((long[])value);
+            } else if (value instanceof boolean[]) {
+                values = ArrayUtils.toObject((boolean[])value);
+            } else if (value instanceof char[]) {
+                values = ArrayUtils.toObject((char[])value);
+            } else {
+                values = (Object[]) value;
+            }
             // write out empty array
             if ( values.length == 0 ) {
                 obj.put(key, new JSONArray());

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 02/33: Add metatype info

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit ee19f92114231f0f0141c4abce59cc3f46b83c0d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Aug 20 10:12:21 2013 +0000

    Add metatype info
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1515758 13f79535-47bb-0310-9956-ffa450edef68
---
 .../OSGI-INF/metatype/metatype.properties          | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
new file mode 100644
index 0000000..7850046
--- /dev/null
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -0,0 +1,36 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+#
+# This file contains localization strings for configuration labels and
+# descriptions as used in the metatype.xml descriptor generated by the
+# the SCR plugin
+
+org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.name=Apache Sling Resource Inventory Printer Factory
+org.apache.sling.resource.inventory.impl.ResourceInventoryPrinterFactory.desription=This factory can be used to add \
+ resource trees to the inventory of the system.
+
+felix.inventory.printer.name.name=Name
+felix.inventory.printer.name.description=The unique name of the inventory printer.
+
+felix.inventory.printer.title.name=Title
+felix.inventory.printer.title.description=The title of the inventory printer.
+
+path.name=Path
+path.description=The resource path to include.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 30/33: Fix some javadoc

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 235639315af0bc3b1c23eb69eb02fc1e99a41ed6
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Fri Jun 2 20:21:29 2017 +0000

    Fix some javadoc
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797424 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/resource/inventory/impl/ResourceTraversor.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
index 0a8d960..c68060d 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceTraversor.java
@@ -39,7 +39,7 @@ public class ResourceTraversor {
     /**
      * Recursive descent from startResource, collecting JSONObjects into
      * startObject.
-     * @throws JSONException
+     * @throws JsonException
      */
     public void collectResources() throws JsonException {
         collectChildren(startResource, this.startObject);
@@ -48,7 +48,7 @@ public class ResourceTraversor {
     /**
      * @param resource
      * @param currentLevel
-     * @throws JSONException
+     * @throws JsonException
      */
     private void collectChildren(final Resource resource,
             final JsonObjectBuilder jsonObj)

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-resource-inventory] 15/33: SLING-4625 : No resource inventory if mbean attribute value is a double

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-inventory.git

commit 0df1e5792efc04306804e914175c2f61ab0e6757
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 15 10:09:31 2015 +0000

    SLING-4625 : No resource inventory if mbean attribute value is a double
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1673706 13f79535-47bb-0310-9956-ffa450edef68
---
 .../resource/inventory/impl/JsonObjectCreator.java | 50 ++++++++++++++--------
 .../impl/ResourceInventoryPrinterFactory.java      |  5 ++-
 2 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
index 2516edc..34d5d23 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/JsonObjectCreator.java
@@ -32,6 +32,7 @@ import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.commons.json.JSONArray;
 import org.apache.sling.commons.json.JSONException;
 import org.apache.sling.commons.json.JSONObject;
+import org.slf4j.LoggerFactory;
 
 /**
  * Creates a JSONObject from a resource
@@ -128,8 +129,6 @@ public abstract class JsonObjectCreator {
             return value;
         } else if ( value instanceof Integer ) {
             return value;
-        } else if ( value instanceof Double ) {
-            return value;
         } else if ( value != null ) {
             return value.toString();
         } else {
@@ -149,8 +148,7 @@ public abstract class JsonObjectCreator {
     private static void createProperty(final JSONObject obj,
                                  final ValueMap valueMap,
                                  final String key,
-                                 final Object value)
-    throws JSONException {
+                                 final Object value) {
         Object[] values = null;
         if (value.getClass().isArray()) {
             if (value instanceof long[]) {
@@ -176,7 +174,11 @@ public abstract class JsonObjectCreator {
             }
             // write out empty array
             if ( values.length == 0 ) {
-                obj.put(key, new JSONArray());
+                try {
+                    obj.put(key, new JSONArray());
+                } catch ( final JSONException ignore ) {
+                    // we ignore this
+                }
                 return;
             }
         }
@@ -188,26 +190,36 @@ public abstract class JsonObjectCreator {
             // their name
             // (colon is not allowed as a JCR property name)
             // in the name, and the value should be the size of the binary data
-            if (values == null) {
-                obj.put(":" + key, getLength(valueMap, -1, key, (InputStream)value));
-            } else {
-                final JSONArray result = new JSONArray();
-                for (int i = 0; i < values.length; i++) {
-                    result.put(getLength(valueMap, i, key, (InputStream)values[i]));
+            try {
+                if (values == null) {
+                    obj.put(":" + key, getLength(valueMap, -1, key, (InputStream)value));
+                } else {
+                    final JSONArray result = new JSONArray();
+                    for (int i = 0; i < values.length; i++) {
+                        result.put(getLength(valueMap, i, key, (InputStream)values[i]));
+                    }
+                    obj.put(":" + key, result);
                 }
-                obj.put(":" + key, result);
+            } catch ( final JSONException ignore ) {
+                // we ignore this
+                LoggerFactory.getLogger(JsonObjectCreator.class).warn("Unable to create JSON value", ignore);
             }
             return;
         }
 
-        if (!value.getClass().isArray()) {
-            obj.put(key, getValue(value));
-        } else {
-            final JSONArray result = new JSONArray();
-            for (Object v : values) {
-                result.put(getValue(v));
+        try {
+            if (!value.getClass().isArray()) {
+                obj.put(key, getValue(value));
+            } else {
+                final JSONArray result = new JSONArray();
+                for (Object v : values) {
+                    result.put(getValue(v));
+                }
+                obj.put(key, result);
             }
-            obj.put(key, result);
+        } catch ( final JSONException ignore ) {
+            // we ignore this
+            LoggerFactory.getLogger(JsonObjectCreator.class).warn("Unable to create JSON value", ignore);
         }
     }
 
diff --git a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
index 4591274..77148ad 100644
--- a/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
+++ b/src/main/java/org/apache/sling/resource/inventory/impl/ResourceInventoryPrinterFactory.java
@@ -35,6 +35,7 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.commons.json.JSONException;
+import org.slf4j.LoggerFactory;
 
 @Component(configurationFactory=true, policy=ConfigurationPolicy.REQUIRE, metatype=true)
 @Service(value=InventoryPrinter.class)
@@ -78,8 +79,8 @@ public class ResourceInventoryPrinterFactory implements InventoryPrinter {
             }
         } catch (final LoginException e) {
             // ignore
-        } catch (JSONException e) {
-            // ignore
+        } catch (final JSONException ignore) {
+            LoggerFactory.getLogger(this.getClass()).warn("Unable to create resource json", ignore);
         } finally {
             if ( resolver != null ) {
                 resolver.close();

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.