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:26:06 UTC

[sling-org-apache-sling-nosql-couchbase-resourceprovider] branch master created (now e51e4f3)

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-nosql-couchbase-resourceprovider.git.


      at e51e4f3  SLING-7167 Adjust READMEs

This branch includes the following new commits:

     new c8267e8  SLING-4381 couchbase resource provider
     new 1f41a52  SLING-4381 simplify couchbase client reference
     new 18947f5  SLING-4381 fix problem with deleted resources; define profile for integration tests
     new 2a32cd7  SLING-4381 add READMEs, make factory configuration
     new 400f1d0  SLING-4381 update README
     new acd7217  SLING-4381 update README
     new 5c36c3e  SLING-4381 update README
     new 87bfc44  SLING-4381 add webconsole hint
     new a088554  SLING-4381 add special handling for root resource
     new b7a2b8a  SLING-4381 allow null map when creating a resource
     new 8fa7709  SLING-4381 enable metrics logging for nosql adapter and disable event distribution
     new 4645bd2  SLING-4381 introduce AbstractNoSqlAdapter
     new b9e8668  update to released mock versions
     new a013107  SLING-4381 make classes public but final
     new fd9383c  SLING-4381 make classes public but final
     new df23bdc  SLING-4381 instantiate metrics adapter only once
     new 53826f8  Update contrib modules to Parent 23
     new 4716dab  add missing license headers
     new 3fdd9e3  set parent version to 24 and add empty relativePath where missing
     new c77bfa7  SLING-5024 Sling NoSQL Resource Provider for MongoDB (based on nosql.generic)
     new 27c0b65  SLING-4381 switch to Couchbase 4.0 with N1QL to get rid of couchbase views
     new 80352d7  SLING-4381/SLING-5024 fix root node child listing
     new 97ea402  SLING-4381/SLING-5024 for query efficiency on listChildren store parentPath as separate attribute
     new bcf0327  update dependencies
     new 8d650f9  update dependencies
     new 2a1f9b8  [maven-release-plugin] prepare release org.apache.sling.nosql.couchbase-resourceprovider-1.0.0
     new f53efb0  [maven-release-plugin] prepare for next development iteration
     new 93c7727  update to next snapshot version until releases are available in maven central
     new 02673dc  switch back to released versions
     new 2eb10c4  SLING-5077 NoSQL Couchbase Resource Provider: Make index creation compatible with Couchbase 4.0 RC0
     new 8811fd1  Update the contrib reactor to parent 25
     new 47c9493  Switch to parent pom 26
     new 0e85925  SLING-5437 add connection check for couchbase resource provider define separate NoSqlAdapter methods for creating index definitions, to ensure they are only executed after connection test succeeds set versions to 1.1.0
     new bd02716  SLING-5558 Update to Couchbase Client 2.2.4
     new cea4f18  exclude README.md in rat report
     new 38234ca  update dependencies
     new 5054622  update dependencies
     new cda58d6  [maven-release-plugin] prepare release org.apache.sling.nosql.couchbase-resourceprovider-1.1.0
     new c378959  [maven-release-plugin] prepare for next development iteration
     new 304bd6b  update version to next development snapshot until releases available on maven central
     new 3c759d5  update to release versions
     new e51e4f3  SLING-7167 Adjust READMEs

The 42 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-nosql-couchbase-resourceprovider] 03/42: SLING-4381 fix problem with deleted resources; define profile for integration tests

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-nosql-couchbase-resourceprovider.git

commit 18947f5061c4d93fd1dce0225419059cb13e56cb
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 15:46:51 2015 +0000

    SLING-4381 fix problem with deleted resources; define profile for integration tests
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680609 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 53 ++++++++++++++++++++++
 .../impl/CouchbaseNoSqlAdapter.java                |  2 +-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 8df9d96..5345940 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,7 +113,60 @@
               <artifactId>maven-scr-plugin</artifactId>
           </plugin>
     
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <configuration>
+                  <testFailureIgnore>false</testFailureIgnore>
+                  <includes>
+                      <include>**/*Test.java</include>
+                  </includes>
+                  <excludes>
+                      <exclude>**/*IT.java</exclude>
+                  </excludes>
+              </configuration>
+          </plugin>
+    
         </plugins>
     </build>
+    
+    <profiles>
+    
+      <!-- 
+          Profile for Integration tests with a real couchbase server running.
+          You have to set JVM parameters for couchbase host and bucket name, e.g.
+          mvn -Pcouchbase-integration-test -DcouchbaseHosts=localhost:8091 -DbucketName=test integration-test
+      -->
+      <profile>
+        <id>couchbase-integration-test</id>
+        <build>
+          <plugins>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <includes>
+                        <include>**/*IT.java</include>
+                    </includes>
+                    <excludes>
+                        <exclude>**/*Test.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+    
+          </plugins>
+        </build>
+      </profile>
+
+    </profiles>
   
 </project>
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 14f4e72..6d85b4f 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -52,7 +52,7 @@ class CouchbaseNoSqlAdapter implements NoSqlAdapter {
 
     @Override
     public boolean validPath(String path) {
-        return (couchbaseClient != null);
+        return (couchbaseClient != null && couchbaseClient.isEnabled());
     }
 
     @Override

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 02/42: SLING-4381 simplify couchbase client reference

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-nosql-couchbase-resourceprovider.git

commit 1f41a5259816bd70a57fd3bf5f04c78ca59df117
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 15:13:31 2015 +0000

    SLING-4381 simplify couchbase client reference
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680597 13f79535-47bb-0310-9956-ffa450edef68
---
 .../CouchbaseNoSqlResourceProviderFactory.java     | 52 ++++------------------
 .../CouchbaseNoSqlResourceProviderIT.java          |  2 +-
 ...chbaseNoSqlResourceProviderTransactionalIT.java |  2 +-
 3 files changed, 10 insertions(+), 46 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
index 3f20e6c..84ffbf3 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -22,7 +22,6 @@ import java.util.Map;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
@@ -32,13 +31,8 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.generic.adapter.NoSqlAdapter;
 import org.apache.sling.nosql.generic.resource.AbstractNoSqlResourceProviderFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.event.EventAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * {@link ResourceProviderFactory} implementation that uses couchbase as
@@ -48,10 +42,11 @@ import org.slf4j.LoggerFactory;
 @Service(value = ResourceProviderFactory.class)
 public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
 
-    @Property(label = "Couchbase Client ID", description = "ID referencing the matching couchbase client configuration and bucket for caching.", value = CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID_DEFAULT)
-    static final String COUCHBASE_CLIENT_ID_PROPERTY = "couchbaseClientID";
-    private static final String COUCHBASE_CLIENT_ID_DEFAULT = "caravan-resourceprovider-couchbase";
-
+    /**
+     * Couchbase Client ID for Couchbase Resource Provier
+     */
+    public static final String COUCHBASE_CLIENT_ID = "sling-resourceprovider-couchbase";
+    
     @Property(label = "Cache Key Prefix", description = "Prefix for caching keys.", value = CouchbaseNoSqlResourceProviderFactory.CACHE_KEY_PREFIX_DEFAULT)
     static final String CACHE_KEY_PREFIX_PROPERTY = "cacheKeyPrefix";
     private static final String CACHE_KEY_PREFIX_DEFAULT = "sling-resource:";
@@ -59,52 +54,21 @@ public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResource
     @Property(label = "Root paths", description = "Root paths for resource provider.", cardinality = Integer.MAX_VALUE)
     static final String PROVIDER_ROOTS_PROPERTY = ResourceProvider.ROOTS;
 
+    @Reference(target = "(" + CouchbaseClient.CLIENT_ID_PROPERTY + "=" + COUCHBASE_CLIENT_ID + ")")
+    private CouchbaseClient couchbaseClient;
+
     @Reference
     private EventAdmin eventAdmin;
 
-    private String couchbaseClientId;
-    private ServiceReference couchbaseClientServiceReference;
     private NoSqlAdapter noSqlAdapter;
 
-    private static final Logger log = LoggerFactory.getLogger(CouchbaseNoSqlResourceProviderFactory.class);
-
     @Activate
     private void activate(ComponentContext componentContext, Map<String, Object> config) {
-        CouchbaseClient couchbaseClient = null;
-        try {
-            couchbaseClientId = PropertiesUtil.toString(config.get(COUCHBASE_CLIENT_ID_PROPERTY),
-                    COUCHBASE_CLIENT_ID_DEFAULT);
-            BundleContext bundleContext = componentContext.getBundleContext();
-            ServiceReference[] serviceReferences = bundleContext.getServiceReferences(
-                    CouchbaseClient.class.getName(), "(" + CouchbaseClient.CLIENT_ID_PROPERTY + "=" + couchbaseClientId + ")");
-            if (serviceReferences.length == 1) {
-                couchbaseClientServiceReference = serviceReferences[0];
-                couchbaseClient = (CouchbaseClient)bundleContext.getService(couchbaseClientServiceReference);
-            }
-            else if (serviceReferences.length > 1) {
-                log.error("Multiple couchbase clients registered for client id '{}', caching is disabled.",
-                        couchbaseClientId);
-            }
-            else {
-                log.error("No couchbase clients registered for client id '{}', caching is disabled.", couchbaseClientId);
-            }
-        }
-        catch (InvalidSyntaxException ex) {
-            log.error("Invalid service filter, couchbase caching is disabled.", ex);
-        }
-
         String cacheKeyPrefix = PropertiesUtil
                 .toString(config.get(CACHE_KEY_PREFIX_PROPERTY), CACHE_KEY_PREFIX_DEFAULT);
         noSqlAdapter = new CouchbaseNoSqlAdapter(couchbaseClient, cacheKeyPrefix);
     }
 
-    @Deactivate
-    private void deactivate(ComponentContext componentContext) {
-        if (couchbaseClientServiceReference != null) {
-            componentContext.getBundleContext().ungetService(couchbaseClientServiceReference);
-        }
-    }
-
     @Override
     protected NoSqlAdapter getNoSqlAdapter() {
         return noSqlAdapter;
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
index ed64041..cacf7f8 100644
--- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
@@ -43,7 +43,7 @@ public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProvi
         context.registerInjectActivateService(
                 new CouchbaseClientImpl(),
                 ImmutableMap.<String, Object> builder()
-                        .put(CouchbaseClient.CLIENT_ID_PROPERTY, "caravan-resourceprovider-couchbase")
+                        .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID)
                         .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
                         .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
 
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
index 3c62e9d..76f87a5 100644
--- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
@@ -43,7 +43,7 @@ public class CouchbaseNoSqlResourceProviderTransactionalIT extends AbstractNoSql
         context.registerInjectActivateService(
                 new CouchbaseClientImpl(),
                 ImmutableMap.<String, Object> builder()
-                        .put(CouchbaseClient.CLIENT_ID_PROPERTY, "caravan-resourceprovider-couchbase")
+                        .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID)
                         .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
                         .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
 

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 05/42: SLING-4381 update README

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-nosql-couchbase-resourceprovider.git

commit 400f1d07bcab2f461882e31ff29d003816859696
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 16:13:18 2015 +0000

    SLING-4381 update README
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680623 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/README.md b/README.md
index 10277bd..53be13a 100644
--- a/README.md
+++ b/README.md
@@ -11,3 +11,13 @@ Configuration on deployment
 
 * To use the resource provider you have to to create a factory configuration for "Apache Sling NoSQL Couchbase Client" with clientId = ´sling-resourceprovider-couchbase´ and propert couchbase host and bucket configuration.
 * Additionally a factory configuration for "Apache Sling NoSQL Couchbase Resource Provider Factory" defines the root of the resource tree that should be stored in Couchbase
+
+
+Run integration tests
+---------------------
+
+To run the integration tests you have to set up a real couchbase server and run the tests with this command line (inserting the correct parameters for couchbase host and bucket):
+
+```
+mvn -Pcouchbase-integration-test -DcouchbaseHosts=localhost:8091 -DbucketName=test integration-test
+```

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 29/42: switch back to released versions

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-nosql-couchbase-resourceprovider.git

commit 02673dc73adda562fa436d7f58b849e09f3e31ef
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Sep 29 20:52:02 2015 +0000

    switch back to released versions
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1705925 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2dc6240..4556c58 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,14 +49,14 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
     
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
     
@@ -91,7 +91,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 31/42: 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-nosql-couchbase-resourceprovider.git

commit 8811fd1f5055f471829d0227b3062059752fbcf2
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 4556c58..7aa7fe9 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-nosql-couchbase-resourceprovider] 41/42: update to release versions

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-nosql-couchbase-resourceprovider.git

commit 3c759d589a9c44984e61754587194aca2cebe8a3
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Sat Feb 27 14:00:41 2016 +0000

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

diff --git a/pom.xml b/pom.xml
index b19007b..33bc9d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,14 +49,14 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>1.0.3-SNAPSHOT</version>
+            <version>1.0.2</version>
             <scope>provided</scope>
         </dependency>
     
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>1.1.1-SNAPSHOT</version>
+            <version>1.1.0</version>
             <scope>provided</scope>
         </dependency>
     
@@ -91,7 +91,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>1.1.1-SNAPSHOT</version>
+            <version>1.1.0</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 08/42: SLING-4381 add webconsole hint

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-nosql-couchbase-resourceprovider.git

commit 87bfc44776310b8a92f6b8588b633c76f6982414
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 20:33:04 2015 +0000

    SLING-4381 add webconsole hint
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680670 13f79535-47bb-0310-9956-ffa450edef68
---
 .../resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java    | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
index ec14f21..3c63704 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -45,6 +45,8 @@ import org.osgi.service.event.EventAdmin;
     description = "Defines a resource provider factory with Couchbase persistence.", 
     configurationFactory = true, policy = ConfigurationPolicy.REQUIRE)
 @Service(value = ResourceProviderFactory.class)
+@Property(name = "webconsole.configurationFactory.nameHint", 
+    value = "Root paths: {" + CouchbaseNoSqlResourceProviderFactory.PROVIDER_ROOTS_PROPERTY + "}")
 public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
 
     /**

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 10/42: SLING-4381 allow null map when creating a resource

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-nosql-couchbase-resourceprovider.git

commit b7a2b8a9176f6cc2ed9a8f55a0e1f3130bb17527
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 21 08:54:21 2015 +0000

    SLING-4381 allow null map when creating a resource
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680767 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 5345940..2e70d51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,13 @@
             <version>1.2.1-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
-  
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.logging-mock</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 32/42: 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-nosql-couchbase-resourceprovider.git

commit 47c9493c49c1b69286a8b1cac154ec7b339cd15b
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 7aa7fe9..0355b76 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-nosql-couchbase-resourceprovider] 25/42: update dependencies

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-nosql-couchbase-resourceprovider.git

commit 8d650f9c5ef6a4659d259a3a8d876b96a909f252
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 17 21:35:51 2015 +0000

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

diff --git a/pom.xml b/pom.xml
index 5d9384c..4872bfd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,7 +50,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>0.5.0-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
     

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 33/42: SLING-5437 add connection check for couchbase resource provider define separate NoSqlAdapter methods for creating index definitions, to ensure they are only executed after connection test succeeds set versions to 1.1.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-nosql-couchbase-resourceprovider.git

commit 0e85925feee2725657be395e9b7a628ff59bf328
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Jan 19 17:47:07 2016 +0000

    SLING-5437 add connection check for couchbase resource provider
    define separate NoSqlAdapter methods for creating index definitions, to ensure they are only executed after connection test succeeds
    set versions to 1.1.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1725576 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  4 +--
 .../impl/CouchbaseNoSqlAdapter.java                | 36 +++++++++++++++++++---
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0355b76..e8e074f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>org.apache.sling.nosql.couchbase-resourceprovider</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>1.1.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
   
     <name>Apache Sling NoSQL Couchbase Resource Provider</name>
@@ -56,7 +56,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>1.0.0</version>
+            <version>1.1.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 12302fa..2b0dd6c 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -26,12 +26,15 @@ import java.util.Iterator;
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.couchbase.client.CouchbaseKey;
 import org.apache.sling.nosql.generic.adapter.AbstractNoSqlAdapter;
 import org.apache.sling.nosql.generic.adapter.MultiValueMode;
 import org.apache.sling.nosql.generic.adapter.NoSqlData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.couchbase.client.java.Bucket;
 import com.couchbase.client.java.document.JsonDocument;
@@ -57,14 +60,11 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
     
     private static final N1qlParams N1QL_PARAMS = N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS);
 
+    private static final Logger log = LoggerFactory.getLogger(CouchbaseNoSqlAdapter.class);
+
     public CouchbaseNoSqlAdapter(CouchbaseClient couchbaseClient, String cacheKeyPrefix) {
         this.couchbaseClient = couchbaseClient;
         this.cacheKeyPrefix = cacheKeyPrefix;
-        
-        // make sure primary index and index on parentPath is present - ignore error if it is already present
-        Bucket bucket = couchbaseClient.getBucket();
-        bucket.query(N1qlQuery.simple("CREATE PRIMARY INDEX ON `" + couchbaseClient.getBucketName() + "`"));
-        bucket.query(N1qlQuery.simple("CREATE INDEX " + PN_PARENT_PATH + " ON `" + couchbaseClient.getBucketName() + "`(" + PN_PARENT_PATH + ")"));
     }
 
     @Override
@@ -183,4 +183,30 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
         }
     }
 
+    @Override
+    public void checkConnection() throws LoginException {
+        // try to access root element to check connection
+        try {
+            Bucket bucket = couchbaseClient.getBucket();
+            String cacheKey = CouchbaseKey.build("/", cacheKeyPrefix);
+            bucket.exists(cacheKey);
+        }
+        catch (Throwable ex) {
+            throw new LoginException(ex);
+        }
+    }
+
+    @Override
+    public void createIndexDefinitions() {
+        // make sure primary index and index on parentPath is present - ignore error if it is already present
+        try {
+            Bucket bucket = couchbaseClient.getBucket();
+            bucket.query(N1qlQuery.simple("CREATE PRIMARY INDEX ON `" + couchbaseClient.getBucketName() + "`"));
+            bucket.query(N1qlQuery.simple("CREATE INDEX " + PN_PARENT_PATH + " ON `" + couchbaseClient.getBucketName() + "`(" + PN_PARENT_PATH + ")"));
+        }
+        catch (Throwable ex) {
+            log.debug("Unable to create/validate couchbase index definitions: " + ex.getMessage(), ex);
+        }
+    }
+
 }

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 35/42: exclude README.md in rat report

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-nosql-couchbase-resourceprovider.git

commit cea4f1876dbf64f48cb2aa9bb8efc55302d0588d
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 12:02:10 2016 +0000

    exclude README.md in rat report
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732095 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/pom.xml b/pom.xml
index 8c19cab..2ce12c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,6 +133,20 @@
           </plugin>
     
         </plugins>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <!-- Extend RAT configuration from parent pom -->
+                    <groupId>org.apache.rat</groupId>
+                    <artifactId>apache-rat-plugin</artifactId>
+                    <configuration>
+                        <excludes combine.children="append">
+                            <exclude>README.md</exclude>
+                        </excludes>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
     </build>
     
     <profiles>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 04/42: SLING-4381 add READMEs, make factory configuration

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-nosql-couchbase-resourceprovider.git

commit 2a32cd79d0b16b3537ed71e4c409642703e16450
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 16:11:14 2015 +0000

    SLING-4381 add READMEs, make factory configuration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680622 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md                                                   | 13 +++++++++++++
 .../impl/CouchbaseNoSqlResourceProviderFactory.java         |  7 ++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..10277bd
--- /dev/null
+++ b/README.md
@@ -0,0 +1,13 @@
+Apache Sling NoSQL Couchbase Resource Provider
+==============================================
+
+Sling ResourceProvider implementation that uses [Couchbase](http://www.couchbase.com/) NoSQL database as persistence.
+
+Based on the "Apache Sling NoSQL Generic Resource Provider" and "Apache Sling NoSQL Couchbase Client".
+
+
+Configuration on deployment
+---------------------------
+
+* To use the resource provider you have to to create a factory configuration for "Apache Sling NoSQL Couchbase Client" with clientId = ´sling-resourceprovider-couchbase´ and propert couchbase host and bucket configuration.
+* Additionally a factory configuration for "Apache Sling NoSQL Couchbase Resource Provider Factory" defines the root of the resource tree that should be stored in Couchbase
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
index 84ffbf3..ec14f21 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -22,6 +22,7 @@ import java.util.Map;
 
 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.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
@@ -38,7 +39,11 @@ import org.osgi.service.event.EventAdmin;
  * {@link ResourceProviderFactory} implementation that uses couchbase as
  * persistence.
  */
-@Component(immediate = true)
+@Component(immediate = true, metatype = true,
+    name="org.apache.sling.nosql.couchbase.resourceprovider.CouchbaseNoSqlResourceProviderFactory.factory.config",
+    label = "Apache Sling NoSQL Couchbase Resource Provider Factory", 
+    description = "Defines a resource provider factory with Couchbase persistence.", 
+    configurationFactory = true, policy = ConfigurationPolicy.REQUIRE)
 @Service(value = ResourceProviderFactory.class)
 public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
 

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 13/42: update to released mock versions

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-nosql-couchbase-resourceprovider.git

commit b9e8668be818a80f0cecc0edfb07698449c9bdd4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Sat May 30 10:00:03 2015 +0000

    update to released mock versions
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1682593 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2e70d51..c8e3774 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,13 +78,13 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-            <version>1.2.1-SNAPSHOT</version>
+            <version>1.3.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.logging-mock</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>test</scope>
         </dependency>
 

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 20/42: SLING-5024 Sling NoSQL Resource Provider for MongoDB (based on nosql.generic)

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-nosql-couchbase-resourceprovider.git

commit c77bfa7d28324e3f92ceedfa1bd10f93532988ee
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 14 21:19:29 2015 +0000

    SLING-5024 Sling NoSQL Resource Provider for MongoDB (based on nosql.generic)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703061 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 11 +--
 .../impl/CouchbaseNoSqlAdapter.java                |  7 +-
 .../resourceprovider/impl/MapConverter.java        | 87 ----------------------
 .../resourceprovider/impl/MapConverterTest.java    | 79 --------------------
 4 files changed, 6 insertions(+), 178 deletions(-)

diff --git a/pom.xml b/pom.xml
index e8e00f8..07c509d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,18 +67,11 @@
             <version>2.2.2</version>
             <scope>provided</scope>
         </dependency>
-  
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.3.2</version>
-            <scope>provided</scope>
-        </dependency>
-        
+          
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-            <version>1.3.0</version>
+            <version>1.5.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 9fe9931..5ebcc6f 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -23,6 +23,7 @@ import java.util.Iterator;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.couchbase.client.CouchbaseKey;
 import org.apache.sling.nosql.generic.adapter.AbstractNoSqlAdapter;
+import org.apache.sling.nosql.generic.adapter.MultiValueMode;
 import org.apache.sling.nosql.generic.adapter.NoSqlData;
 
 import com.couchbase.client.java.Bucket;
@@ -79,7 +80,7 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
                 return null;
             }
             else {
-                return new NoSqlData(path, MapConverter.mapListToArray(data.toMap()));
+                return new NoSqlData(path, data.toMap(), MultiValueMode.LISTS);
             }
         }
     }
@@ -102,7 +103,7 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
                 JsonObject envelope = doc.content();
                 String path = envelope.getString(PN_PATH);
                 JsonObject data = envelope.getObject(PN_DATA);
-                return new NoSqlData(path, MapConverter.mapListToArray(data.toMap()));
+                return new NoSqlData(path, data.toMap(), MultiValueMode.LISTS);
             }
 
             @Override
@@ -119,7 +120,7 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
 
         JsonObject envelope = JsonObject.create();
         envelope.put(PN_PATH, data.getPath());
-        envelope.put(PN_DATA, JsonObject.from(MapConverter.mapArrayToList(data.getProperties())));
+        envelope.put(PN_DATA, JsonObject.from(data.getProperties(MultiValueMode.LISTS)));
 
         JsonDocument doc = JsonDocument.create(cacheKey, envelope);
         try {
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
deleted file mode 100644
index a8278fd..0000000
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
+++ /dev/null
@@ -1,87 +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.
- */
-package org.apache.sling.nosql.couchbase.resourceprovider.impl;
-
-import java.lang.reflect.Array;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-
-/**
- * Transforms NoSqlData maps to a valid form for couchbase JSON document.
- * All arrays have to be transformed to lists.
- */
-public final class MapConverter {
-
-    private MapConverter() {
-        // static methods only
-    }
-
-    /**
-     * @param map Map with multi-valued arrays
-     * @return Map with multi-valued lists
-     */
-    public static Map<String, Object> mapArrayToList(Map<String, Object> map) {
-        for (Map.Entry<String, Object> entry : map.entrySet()) {
-            if (entry.getValue().getClass().isArray()) {
-                Class componentType = entry.getValue().getClass().getComponentType();
-                if (componentType == int.class) {
-                    entry.setValue(Arrays.asList(ArrayUtils.toObject((int[]) entry.getValue())));
-                }
-                else if (componentType == long.class) {
-                    entry.setValue(Arrays.asList(ArrayUtils.toObject((long[]) entry.getValue())));
-                }
-                else if (componentType == double.class) {
-                    entry.setValue(Arrays.asList(ArrayUtils.toObject((double[]) entry.getValue())));
-                }
-                else if (componentType == boolean.class) {
-                    entry.setValue(Arrays.asList(ArrayUtils.toObject((boolean[]) entry.getValue())));
-                }
-                else {
-                    entry.setValue(Arrays.asList((Object[]) entry.getValue()));
-                }
-            }
-        }
-        return map;
-    }
-
-    /**
-     * @param map Map with multi-valued lists
-     * @return Map with multi-valued arrays
-     */
-    @SuppressWarnings("unchecked")
-    public static Map<String, Object> mapListToArray(Map<String, Object> map) {
-        for (Map.Entry<String, Object> entry : map.entrySet()) {
-            if (entry.getValue() instanceof List) {
-                List list = (List) entry.getValue();
-                if (list.size() == 0) {
-                    entry.setValue(null);
-                }
-                else {
-                    Class type = list.get(0).getClass();
-                    entry.setValue(list.toArray((Object[]) Array.newInstance(type, list.size())));
-                }
-            }
-        }
-        return map;
-    }
-
-}
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverterTest.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverterTest.java
deleted file mode 100644
index 1f8e1ee..0000000
--- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverterTest.java
+++ /dev/null
@@ -1,79 +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.
- */
-package org.apache.sling.nosql.couchbase.resourceprovider.impl;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Map;
-
-import org.apache.sling.nosql.couchbase.resourceprovider.impl.MapConverter;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-public class MapConverterTest {
-
-    @Test
-    public void testMapArrayToList() throws Exception {
-        Map<String, Object> result = MapConverter.mapArrayToList(Maps.newHashMap(ImmutableMap.<String, Object>builder()
-                .put("prop1", "value1")
-                .put("prop2", 2)
-                .put("stringArray", new String[] { "value1", "value2" })
-                .put("integerArray", new Integer[] { 1, 2, 3 })
-                .put("integerArray2", new int[] { 1, 2, 3 })
-                .put("longArray", new long[] { 1L, 2L })
-                .put("doubleArray", new double[] { 1.1d, 1.2d })
-                .put("booleanArray", new boolean[] { true, false })
-                .build()));
-
-        assertEquals("prop1", "value1", result.get("prop1"));
-        assertEquals("prop2", 2, result.get("prop2"));
-        assertEquals("stringArray", ImmutableList.of("value1", "value2"), result.get("stringArray"));
-        assertEquals("integerArray", ImmutableList.of(1, 2, 3), result.get("integerArray"));
-        assertEquals("integerArray2", ImmutableList.of(1, 2, 3), result.get("integerArray2"));
-        assertEquals("longArray", ImmutableList.of(1L, 2L), result.get("longArray"));
-        assertEquals("doubleArray", ImmutableList.of(1.1d, 1.2d), result.get("doubleArray"));
-        assertEquals("booleanArray", ImmutableList.of(true, false), result.get("booleanArray"));
-    }
-
-    @Test
-    public void testMapListToArray() throws Exception {
-        Map<String, Object> result = MapConverter.mapListToArray(Maps.newHashMap(ImmutableMap.<String, Object>builder()
-                .put("prop1", "value1")
-                .put("prop2", 2)
-                .put("stringArray", ImmutableList.of("value1", "value2"))
-                .put("integerArray", ImmutableList.of(1, 2, 3))
-                .put("longArray", ImmutableList.of(1L, 2L))
-                .put("doubleArray", ImmutableList.of(1.1d, 1.2d))
-                .put("booleanArray", ImmutableList.of(true, false))
-                .build()));
-
-        assertEquals("prop1", "value1", result.get("prop1"));
-        assertEquals("prop2", 2, result.get("prop2"));
-        assertArrayEquals("stringArray", new String[] { "value1", "value2" }, (String[]) result.get("stringArray"));
-        assertArrayEquals("integerArray", new Integer[] { 1, 2, 3 }, (Integer[]) result.get("integerArray"));
-        assertArrayEquals("longArray", new Long[] { 1L, 2L }, (Long[]) result.get("longArray"));
-        assertArrayEquals("doubleArray", new Double[] { 1.1d, 1.2d }, (Double[]) result.get("doubleArray"));
-        assertArrayEquals("booleanArray", new Boolean[] { true, false }, (Boolean[]) result.get("booleanArray"));
-    }
-
-}

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 18/42: add missing license headers

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-nosql-couchbase-resourceprovider.git

commit 4716dab4aeb43126ba18143df1b42f144ae9eb2e
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Jun 26 08:20:49 2015 +0000

    add missing license headers
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1687711 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/couchbase-views/ancestorPath.js         | 18 ++++++++++++++++++
 src/main/couchbase-views/ancestorPathTester.html | 18 ++++++++++++++++++
 src/main/couchbase-views/parentPath.js           | 18 ++++++++++++++++++
 src/main/couchbase-views/parentPathTester.html   | 18 ++++++++++++++++++
 4 files changed, 72 insertions(+)

diff --git a/src/main/couchbase-views/ancestorPath.js b/src/main/couchbase-views/ancestorPath.js
index 6302a19..f8cd94b 100644
--- a/src/main/couchbase-views/ancestorPath.js
+++ b/src/main/couchbase-views/ancestorPath.js
@@ -1,4 +1,22 @@
 /*
+ * 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.
+ */
+/*
  * Emits for each document the all parent paths - allowing to fetch children and their decendants by path.
  * Includes the path of the item itself.
  */
diff --git a/src/main/couchbase-views/ancestorPathTester.html b/src/main/couchbase-views/ancestorPathTester.html
index d07e5d9..9933e6f 100644
--- a/src/main/couchbase-views/ancestorPathTester.html
+++ b/src/main/couchbase-views/ancestorPathTester.html
@@ -1,4 +1,22 @@
 <!DOCTYPE html>
+<!--
+ * 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.
+-->
 <html>
   <head>
     <title>Couchbase View Tester</title>
diff --git a/src/main/couchbase-views/parentPath.js b/src/main/couchbase-views/parentPath.js
index 5277818..54c4c1f 100644
--- a/src/main/couchbase-views/parentPath.js
+++ b/src/main/couchbase-views/parentPath.js
@@ -1,4 +1,22 @@
 /*
+ * 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.
+ */
+/*
  * Emits for each document the direct parent path - allowing to fetch direct children by path.
  */
 function(doc, meta) {
diff --git a/src/main/couchbase-views/parentPathTester.html b/src/main/couchbase-views/parentPathTester.html
index 34e037f..efcc2d1 100644
--- a/src/main/couchbase-views/parentPathTester.html
+++ b/src/main/couchbase-views/parentPathTester.html
@@ -1,4 +1,22 @@
 <!DOCTYPE html>
+<!--
+ * 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.
+-->
 <html>
   <head>
     <title>Couchbase View Tester</title>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 19/42: 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-nosql-couchbase-resourceprovider.git

commit 3fdd9e37e1bf2c712b9d47f0c870bd4a7f173081
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 6704009..e8e00f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>23</version>
+        <version>24</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-nosql-couchbase-resourceprovider] 23/42: SLING-4381/SLING-5024 for query efficiency on listChildren store parentPath as separate attribute

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-nosql-couchbase-resourceprovider.git

commit 97ea40213c9267be963d8eefd04c3f8cda50dd98
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 17 06:00:21 2015 +0000

    SLING-4381/SLING-5024 for query efficiency on listChildren store parentPath as separate attribute
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703494 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/CouchbaseNoSqlAdapter.java                | 31 ++++++++++++----------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 5a699a9..d7730e9 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -19,11 +19,14 @@
 package org.apache.sling.nosql.couchbase.resourceprovider.impl;
 
 import static com.couchbase.client.java.query.Select.select;
+import static com.couchbase.client.java.query.dsl.Expression.s;
+import static com.couchbase.client.java.query.dsl.Expression.x;
 
 import java.util.Iterator;
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.couchbase.client.CouchbaseKey;
 import org.apache.sling.nosql.generic.adapter.AbstractNoSqlAdapter;
@@ -34,6 +37,7 @@ import com.couchbase.client.java.Bucket;
 import com.couchbase.client.java.document.JsonDocument;
 import com.couchbase.client.java.document.json.JsonObject;
 import com.couchbase.client.java.error.DocumentAlreadyExistsException;
+import com.couchbase.client.java.query.Index;
 import com.couchbase.client.java.query.N1qlParams;
 import com.couchbase.client.java.query.N1qlQuery;
 import com.couchbase.client.java.query.N1qlQueryResult;
@@ -45,15 +49,9 @@ import com.couchbase.client.java.query.consistency.ScanConsistency;
  */
 public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
 
-    /**
-     * Property holding path
-     */
-    public static final String PN_PATH = "path";
-    
-    /**
-     * Property holding properties data
-     */
-    public static final String PN_DATA = "data";
+    private static final String PN_PATH = "path";
+    private static final String PN_PARENT_PATH = "parentPath";
+    private static final String PN_DATA = "data";
 
     private final CouchbaseClient couchbaseClient;
     private final String cacheKeyPrefix;
@@ -64,9 +62,9 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
         this.couchbaseClient = couchbaseClient;
         this.cacheKeyPrefix = cacheKeyPrefix;
         
-        // make sure primary index is present - ignore error if it is already present
-        Bucket bucket = couchbaseClient.getBucket();
-        bucket.query(N1qlQuery.simple("CREATE PRIMARY INDEX ON " + couchbaseClient.getBucketName()));
+        // make sure primary index and index on parentPath is present - ignore error if it is already present
+        Index.createPrimaryIndex().on(couchbaseClient.getBucketName());
+        Index.createIndex(PN_PARENT_PATH).on(couchbaseClient.getBucketName(), x(PN_PARENT_PATH));
     }
 
     @Override
@@ -97,10 +95,9 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
     public Iterator<NoSqlData> getChildren(String parentPath) {
         Bucket bucket = couchbaseClient.getBucket();
         // fetch all direct children of this path
-        Pattern directChildren = Pattern.compile("^" + StringUtils.removeEnd(parentPath, "/") + "/[^/]+$");
         N1qlQuery query = N1qlQuery.simple(select("*")
                 .from(couchbaseClient.getBucketName())
-                .where("REGEXP_LIKE(`" + PN_PATH + "`, '" + directChildren.pattern() + "')"),
+                .where(x(PN_PARENT_PATH).eq(s(parentPath))),
                 N1QL_PARAMS);
         N1qlQueryResult queryResult = bucket.query(query);
         handleQueryError(queryResult);
@@ -136,6 +133,12 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
         envelope.put(PN_PATH, data.getPath());
         envelope.put(PN_DATA, JsonObject.from(data.getProperties(MultiValueMode.LISTS)));
 
+        // for list-children query efficiency store parent path as well
+        String parentPath = ResourceUtil.getParent(data.getPath());
+        if (parentPath != null) {
+            envelope.put(PN_PARENT_PATH, parentPath);
+        }
+        
         JsonDocument doc = JsonDocument.create(cacheKey, envelope);
         try {
             bucket.insert(doc);

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 42/42: 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-nosql-couchbase-resourceprovider.git

commit e51e4f3271c9a8a9b2cc5f754b8b9b765e9526db
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 10:06:02 2017 +0000

    SLING-7167 Adjust READMEs
    
    add uniform header linking to Sling project
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810914 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 51 ++++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/README.md b/README.md
index 6b88a77..2c9e5d1 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,26 @@
-Apache Sling NoSQL Couchbase Resource Provider
-==============================================
-
-Sling ResourceProvider implementation that uses [Couchbase](http://www.couchbase.com/) NoSQL database as persistence.
-
-Based on the "Apache Sling NoSQL Generic Resource Provider" and "Apache Sling NoSQL Couchbase Client".
-
-Couchbase Server 4.0 with N1QL support is required for this implementation.
-
-
-Configuration on deployment
----------------------------
-
-* To use the resource provider you have to to create a factory configuration for "Apache Sling NoSQL Couchbase Client" with clientId = ´sling-resourceprovider-couchbase´ and propert couchbase host and bucket configuration.
-* Additionally a factory configuration for "Apache Sling NoSQL Couchbase Resource Provider Factory" defines the root of the resource tree that should be stored in Couchbase
-
-
-Run integration tests
----------------------
-
-To run the integration tests you have to set up a real couchbase server and run the tests with this command line (inserting the correct parameters for couchbase host and bucket):
-
-```
-mvn -Pcouchbase-integration-test -DcouchbaseHosts=localhost:8091 -DbucketName=test integration-test
-```
+# Apache Sling NoSQL Couchbase Resource Provider
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
+
+Sling ResourceProvider implementation that uses [Couchbase](http://www.couchbase.com/) NoSQL database as persistence.
+
+Based on the "Apache Sling NoSQL Generic Resource Provider" and "Apache Sling NoSQL Couchbase Client".
+
+Couchbase Server 4.0 with N1QL support is required for this implementation.
+
+
+Configuration on deployment
+---------------------------
+
+* To use the resource provider you have to to create a factory configuration for "Apache Sling NoSQL Couchbase Client" with clientId = ´sling-resourceprovider-couchbase´ and propert couchbase host and bucket configuration.
+* Additionally a factory configuration for "Apache Sling NoSQL Couchbase Resource Provider Factory" defines the root of the resource tree that should be stored in Couchbase
+
+
+Run integration tests
+---------------------
+
+To run the integration tests you have to set up a real couchbase server and run the tests with this command line (inserting the correct parameters for couchbase host and bucket):
+
+```
+mvn -Pcouchbase-integration-test -DcouchbaseHosts=localhost:8091 -DbucketName=test integration-test
+```

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 34/42: SLING-5558 Update to Couchbase Client 2.2.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-nosql-couchbase-resourceprovider.git

commit bd027162aeef93ceefb7348627f71bdd7879dba4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 10:57:23 2016 +0000

    SLING-5558 Update to Couchbase Client 2.2.4
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732070 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index e8e074f..8c19cab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     
@@ -91,7 +91,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>1.0.0</version>
+            <version>1.1.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 14/42: SLING-4381 make classes public but final

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-nosql-couchbase-resourceprovider.git

commit a0131070158542404b70296cec873c7e645c6430
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Jun 2 10:56:58 2015 +0000

    SLING-4381 make classes public but final
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1683075 13f79535-47bb-0310-9956-ffa450edef68
---
 .../nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java | 5 ++++-
 .../resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java | 2 +-
 .../sling/nosql/couchbase/resourceprovider/impl/MapConverter.java    | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 7a9cf5e..815b451 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -33,7 +33,10 @@ import com.couchbase.client.java.view.Stale;
 import com.couchbase.client.java.view.ViewQuery;
 import com.couchbase.client.java.view.ViewRow;
 
-class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
+/**
+ * {@link org.apache.sling.nosql.generic.adapter.NoSqlAdapter} implementation for Couchbase.
+ */
+public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
 
     private static final String PN_PATH = "path";
     private static final String PN_DATA = "data";
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
index 086d64a..ea61ed3 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory;
 @Service(value = ResourceProviderFactory.class)
 @Property(name = "webconsole.configurationFactory.nameHint", 
     value = "Root paths: {" + CouchbaseNoSqlResourceProviderFactory.PROVIDER_ROOTS_PROPERTY + "}")
-public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
+public final class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
 
     /**
      * Couchbase Client ID for Couchbase Resource Provider
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
index f1e4ac4..efde8dd 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
@@ -29,7 +29,7 @@ import org.apache.commons.lang3.ArrayUtils;
  * Transforms NoSqlData maps to a valid form for couchbase JSON document.
  * All arrays have to be transformed to lists.
  */
-final class MapConverter {
+public final class MapConverter {
 
     private MapConverter() {
         // static methods only

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 39/42: [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-nosql-couchbase-resourceprovider.git

commit c378959e375734a7a6a2e512b38c9026c9ebfeac
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 12:20:33 2016 +0000

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

diff --git a/pom.xml b/pom.xml
index c09613f..33bc9d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.nosql.couchbase-resourceprovider</artifactId>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
   
     <name>Apache Sling NoSQL Couchbase Resource Provider</name>
     <description>Resource Provider with Couchbase Persistence for Apache Sling.</description>
   
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.1.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.1.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.1.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/nosql/couchbase-resourceprovider</url>
     </scm>
 
     <properties>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 21/42: SLING-4381 switch to Couchbase 4.0 with N1QL to get rid of couchbase views

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-nosql-couchbase-resourceprovider.git

commit 27c0b6581865b51cc5748b5bb48f741b900d6c30
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 14 23:09:39 2015 +0000

    SLING-4381 switch to Couchbase 4.0 with N1QL to get rid of couchbase views
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703076 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md                                          | 18 +----
 pom.xml                                            |  9 ++-
 src/main/couchbase-views/ancestorPath.js           | 40 -----------
 src/main/couchbase-views/ancestorPathTester.html   | 84 ----------------------
 src/main/couchbase-views/parentPath.js             | 37 ----------
 src/main/couchbase-views/parentPathTester.html     | 82 ---------------------
 .../impl/CouchbaseNoSqlAdapter.java                | 64 ++++++++++++-----
 7 files changed, 58 insertions(+), 276 deletions(-)

diff --git a/README.md b/README.md
index 4fd582b..6b88a77 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,8 @@ Sling ResourceProvider implementation that uses [Couchbase](http://www.couchbase
 
 Based on the "Apache Sling NoSQL Generic Resource Provider" and "Apache Sling NoSQL Couchbase Client".
 
+Couchbase Server 4.0 with N1QL support is required for this implementation.
+
 
 Configuration on deployment
 ---------------------------
@@ -13,21 +15,6 @@ Configuration on deployment
 * Additionally a factory configuration for "Apache Sling NoSQL Couchbase Resource Provider Factory" defines the root of the resource tree that should be stored in Couchbase
 
 
-Couchbase Views for path-based access
--------------------------------------
-
-For list and delete operations two couchbase views have to be defined and published in the bucket that is used by the resource provider.
-
-Steps to create those views:
-* Log into Couchbase Console
-* Go to "Views" and select the correct bucket
-* Add a new design document via "Create Development View" and name it "\_design/dev\_resourceIndex" (the prefix "\_design/dev\_" is added automatically)
-* Use the name "ancestorPath" for the first view that is created together with the design document
-* Paste the view code from [ancestorPath.js](src/main/couchbase-views/ancestorPath.js) into the editor and save it
-* Create another view named "parentPath", paste the view code from [parentPath.js](src/main/couchbase-views/parentPath.js) and save it
-* Publish the design document so the views are production views
-
-
 Run integration tests
 ---------------------
 
@@ -36,4 +23,3 @@ To run the integration tests you have to set up a real couchbase server and run
 ```
 mvn -Pcouchbase-integration-test -DcouchbaseHosts=localhost:8091 -DbucketName=test integration-test
 ```
-
diff --git a/pom.xml b/pom.xml
index 07c509d..49fc370 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,14 @@
             <version>2.2.2</version>
             <scope>provided</scope>
         </dependency>
-          
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.3.2</version>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock</artifactId>
diff --git a/src/main/couchbase-views/ancestorPath.js b/src/main/couchbase-views/ancestorPath.js
deleted file mode 100644
index f8cd94b..0000000
--- a/src/main/couchbase-views/ancestorPath.js
+++ /dev/null
@@ -1,40 +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.
- */
-/*
- * Emits for each document the all parent paths - allowing to fetch children and their decendants by path.
- * Includes the path of the item itself.
- */
-function(doc, meta) {
-  
-  // handle only sling resource documents with a valid path
-  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
-    return;
-  }
-  var pathParts = doc.path.split("/");
-  if (pathParts.length < 3) {
-    return;
-  }
-  
-  while (pathParts.length >= 2) {
-    // remove last element to get parent path
-    var parentPath = pathParts.join("/");
-    emit(parentPath, null);
-    pathParts.pop();
-  }
-}
diff --git a/src/main/couchbase-views/ancestorPathTester.html b/src/main/couchbase-views/ancestorPathTester.html
deleted file mode 100644
index 9933e6f..0000000
--- a/src/main/couchbase-views/ancestorPathTester.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
- * 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.
--->
-<html>
-  <head>
-    <title>Couchbase View Tester</title>
-    <style>body { font-family: Courier }</style>
-  </head>
-  <body>
-  
-<script>
-
-var emit = function(key, value) {
-  document.write("[" + key + "]" + "<br/>");
-}
-
-var testFunction = function(doc, meta) {
-  
-  // handle only sling resource documents with a valid path
-  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
-    return;
-  }
-  var pathParts = doc.path.split("/");
-  if (pathParts.length < 3) {
-    return;
-  }
-  
-  while (pathParts.length >= 2) {
-    // remove last element to get parent path
-    var parentPath = pathParts.join("/");
-    emit(parentPath, null);
-    pathParts.pop();
-  }
-};
-
-var testInput = [
-	  null,
-    "",
-    "abc",
-    "/",
-    "/content",
-    "/content/node1",
-    "/content/node1/node2",
-    "/content/node1/node2/node3",
-    "/content/node1/node2/node3/node4"
-];
-  
-</script>
-    
-    <table border="1">
-      <tr>
-	      <th>Input</th>
-	      <th>Output</th>
-	    </tr>
-<script>
-for (var i=0; i < testInput.length; i++) {
-  document.write("<tr>")
-  document.write("<td>" + testInput[i] + "</td>")
-  document.write("<td>")
-  testFunction({path: testInput[i], data: {}}, {id: "sling-resource:doc" + i});
-  document.write("</td>")
-  document.write("</tr>")
-}
-</script>
-    </table>
-  
-  </body>
-</html>
diff --git a/src/main/couchbase-views/parentPath.js b/src/main/couchbase-views/parentPath.js
deleted file mode 100644
index 54c4c1f..0000000
--- a/src/main/couchbase-views/parentPath.js
+++ /dev/null
@@ -1,37 +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.
- */
-/*
- * Emits for each document the direct parent path - allowing to fetch direct children by path.
- */
-function(doc, meta) {
-  
-  // handle only sling resource documents with a valid path
-  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
-    return;
-  }
-  var pathParts = doc.path.split("/");
-  if (pathParts.length < 3) {
-    return;
-  }
-  
-  // remove last element to get parent path
-  pathParts.pop();
-  var parentPath = pathParts.join("/");
-  emit(parentPath, null);
-}
diff --git a/src/main/couchbase-views/parentPathTester.html b/src/main/couchbase-views/parentPathTester.html
deleted file mode 100644
index efcc2d1..0000000
--- a/src/main/couchbase-views/parentPathTester.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html>
-<!--
- * 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.
--->
-<html>
-  <head>
-    <title>Couchbase View Tester</title>
-    <style>body { font-family: Courier }</style>
-  </head>
-  <body>
-  
-<script>
-
-var emit = function(key, value) {
-  document.write("[" + key + "]" + "<br/>");
-}
-
-var testFunction = function(doc, meta) {
-  
-  // handle only sling resource documents with a valid path
-  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
-    return;
-  }
-  var pathParts = doc.path.split("/");
-  if (pathParts.length < 3) {
-    return;
-  }
-  
-  // remove last element to get parent path
-  pathParts.pop();
-  var parentPath = pathParts.join("/");
-  emit(parentPath, null);
-};
-
-var testInput = [
-	  null,
-    "",
-    "abc",
-    "/",
-    "/content",
-    "/content/node1",
-    "/content/node1/node2",
-    "/content/node1/node2/node3",
-    "/content/node1/node2/node3/node4"
-];
-  
-</script>
-    
-    <table border="1">
-      <tr>
-	      <th>Input</th>
-	      <th>Output</th>
-	    </tr>
-<script>
-for (var i=0; i < testInput.length; i++) {
-  document.write("<tr>")
-  document.write("<td>" + testInput[i] + "</td>")
-  document.write("<td>")
-  testFunction({path: testInput[i], data: {}}, {id: "sling-resource:doc" + i});
-  document.write("</td>")
-  document.write("</tr>")
-}
-</script>
-    </table>
-  
-  </body>
-</html>
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 5ebcc6f..fd4a798 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -18,8 +18,12 @@
  */
 package org.apache.sling.nosql.couchbase.resourceprovider.impl;
 
+import static com.couchbase.client.java.query.Select.select;
+
 import java.util.Iterator;
+import java.util.regex.Pattern;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.couchbase.client.CouchbaseKey;
 import org.apache.sling.nosql.generic.adapter.AbstractNoSqlAdapter;
@@ -30,9 +34,11 @@ import com.couchbase.client.java.Bucket;
 import com.couchbase.client.java.document.JsonDocument;
 import com.couchbase.client.java.document.json.JsonObject;
 import com.couchbase.client.java.error.DocumentAlreadyExistsException;
-import com.couchbase.client.java.view.Stale;
-import com.couchbase.client.java.view.ViewQuery;
-import com.couchbase.client.java.view.ViewRow;
+import com.couchbase.client.java.query.N1qlParams;
+import com.couchbase.client.java.query.N1qlQuery;
+import com.couchbase.client.java.query.N1qlQueryResult;
+import com.couchbase.client.java.query.N1qlQueryRow;
+import com.couchbase.client.java.query.consistency.ScanConsistency;
 
 /**
  * {@link org.apache.sling.nosql.generic.adapter.NoSqlAdapter} implementation for Couchbase.
@@ -49,16 +55,18 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
      */
     public static final String PN_DATA = "data";
 
-    private static final String VIEW_DESIGN_DOCUMENT = "resourceIndex";
-    private static final String VIEW_PARENT_PATH = "parentPath";
-    private static final String VIEW_ANCESTOR_PATH = "ancestorPath";
-
     private final CouchbaseClient couchbaseClient;
     private final String cacheKeyPrefix;
+    
+    private static final N1qlParams N1QL_PARAMS = N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS);
 
     public CouchbaseNoSqlAdapter(CouchbaseClient couchbaseClient, String cacheKeyPrefix) {
         this.couchbaseClient = couchbaseClient;
         this.cacheKeyPrefix = cacheKeyPrefix;
+        
+        // make sure primary index is present - ignore error if it is already present
+        Bucket bucket = couchbaseClient.getBucket();
+        bucket.query(N1qlQuery.simple("CREATE PRIMARY INDEX ON " + couchbaseClient.getBucketName()));
     }
 
     @Override
@@ -89,8 +97,14 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
     public Iterator<NoSqlData> getChildren(String parentPath) {
         Bucket bucket = couchbaseClient.getBucket();
         // fetch all direct children of this path
-        final Iterator<ViewRow> results = bucket.query(
-                ViewQuery.from(VIEW_DESIGN_DOCUMENT, VIEW_PARENT_PATH).key(parentPath).stale(Stale.FALSE)).rows();
+        Pattern directChildren = Pattern.compile("^" + parentPath + "/[^/]+$");
+        N1qlQuery query = N1qlQuery.simple(select("*")
+                .from(couchbaseClient.getBucketName())
+                .where("REGEXP_LIKE(`" + PN_PATH + "`, '" + directChildren.pattern() + "')"),
+                N1QL_PARAMS);
+        N1qlQueryResult queryResult = bucket.query(query);
+        handleQueryError(queryResult);
+        final Iterator<N1qlQueryRow> results = queryResult.iterator();
         return new Iterator<NoSqlData>() {
             @Override
             public boolean hasNext() {
@@ -99,8 +113,8 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
 
             @Override
             public NoSqlData next() {
-                JsonDocument doc = results.next().document();
-                JsonObject envelope = doc.content();
+                JsonObject item = results.next().value();
+                JsonObject envelope = item.getObject(couchbaseClient.getBucketName());
                 String path = envelope.getString(PN_PATH);
                 JsonObject data = envelope.getObject(PN_DATA);
                 return new NoSqlData(path, data.toMap(), MultiValueMode.LISTS);
@@ -136,16 +150,34 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
     @Override
     public boolean deleteRecursive(String path) {
         Bucket bucket = couchbaseClient.getBucket();
-        // fetch referenced item and all descendants
-        Iterator<ViewRow> results = bucket.query(
-                ViewQuery.from(VIEW_DESIGN_DOCUMENT, VIEW_ANCESTOR_PATH).key(path).stale(Stale.FALSE)).rows();
+        // fetch all descendants and self for deletion
+        Pattern descendantsAndSelf = Pattern.compile("^" + path + "(/.+)?$");
+        N1qlQuery query = N1qlQuery.simple(select("*")
+                .from(couchbaseClient.getBucketName())
+                .where("REGEXP_LIKE(`" + PN_PATH + "`, '" + descendantsAndSelf.pattern() + "')"),
+                N1QL_PARAMS);
+        N1qlQueryResult queryResult = bucket.query(query);
+        handleQueryError(queryResult);
+        final Iterator<N1qlQueryRow> results = queryResult.iterator();
         boolean deletedAny = false;
         while (results.hasNext()) {
-            ViewRow result = results.next();
-            bucket.remove(result.document());
+            JsonObject item = results.next().value();
+            JsonObject envelope = item.getObject(couchbaseClient.getBucketName());
+            String itemPath = envelope.getString(PN_PATH);
+            String itemCacheKey = CouchbaseKey.build(itemPath, cacheKeyPrefix);
+            bucket.remove(itemCacheKey);
             deletedAny = true;
         }
         return deletedAny;
     }
+    
+    private void handleQueryError(N1qlQueryResult queryResult) {
+        if (!queryResult.parseSuccess()) {
+            throw new RuntimeException("Couchbase query parsing error: " + StringUtils.join(queryResult.errors(), "\n"));
+        }
+        if (!queryResult.finalSuccess()) {
+            throw new RuntimeException("Couchbase query error: " + StringUtils.join(queryResult.errors(), "\n"));
+        }
+    }
 
 }

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 09/42: SLING-4381 add special handling for root resource

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-nosql-couchbase-resourceprovider.git

commit a088554f90bb0dc24fd01d3719d2a2483b029d97
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 23:28:04 2015 +0000

    SLING-4381 add special handling for root resource
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680700 13f79535-47bb-0310-9956-ffa450edef68
---
 .../CouchbaseNoSqlResourceProviderIT.java          | 24 +++++------
 ...a => CouchbaseNoSqlResourceProviderRootIT.java} | 49 +++++-----------------
 ...chbaseNoSqlResourceProviderTransactionalIT.java | 24 +++++------
 3 files changed, 32 insertions(+), 65 deletions(-)

diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
index cacf7f8..9fb8186 100644
--- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
@@ -40,15 +40,15 @@ public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProvi
 
     @Override
     protected void registerResourceProviderFactory() {
-        context.registerInjectActivateService(
-                new CouchbaseClientImpl(),
-                ImmutableMap.<String, Object> builder()
+        context.registerInjectActivateService(new CouchbaseClientImpl(), ImmutableMap.<String, Object>builder()
                         .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID)
                         .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
-                        .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
+                        .put("bucketName", System.getProperty("bucketName", "resource-test"))
+                        .build());
 
-        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap
-                .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build());
+        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap.<String, Object>builder()
+                .put(ResourceProvider.ROOTS, "/test")
+                .build());
     }
 
     @Override
@@ -58,15 +58,13 @@ public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProvi
                 Resource root = context.resourceResolver().getResource("/");
                 Resource providerRoot = root.getChild("test");
                 if (providerRoot == null) {
-                    providerRoot = context.resourceResolver().create(
-                            root,
-                            "test",
-                            ImmutableMap
-                                    .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+                    providerRoot = context.resourceResolver().create(root, "test",
+                            ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
                 }
                 this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(),
-                        ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
-            } catch (PersistenceException ex) {
+                        ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+            }
+            catch (PersistenceException ex) {
                 throw new RuntimeException(ex);
             }
         }
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderRootIT.java
similarity index 50%
copy from src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
copy to src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderRootIT.java
index cacf7f8..11e325a 100644
--- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderRootIT.java
@@ -18,59 +18,30 @@
  */
 package org.apache.sling.nosql.couchbase.resourceprovider.integration;
 
-import java.util.UUID;
-
-import org.apache.jackrabbit.JcrConstants;
-import org.apache.sling.api.resource.PersistenceException;
-import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceProvider;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.couchbase.client.impl.CouchbaseClientImpl;
 import org.apache.sling.nosql.couchbase.resourceprovider.impl.CouchbaseNoSqlResourceProviderFactory;
-import org.apache.sling.nosql.generic.resource.impl.AbstractNoSqlResourceProviderTest;
+import org.apache.sling.nosql.generic.resource.impl.AbstractNoSqlResourceProviderRootTest;
 
 import com.google.common.collect.ImmutableMap;
 
 /**
  * Test basic ResourceResolver and ValueMap with different data types.
  */
-public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProviderTest {
-
-    private Resource testRoot;
-
+public class CouchbaseNoSqlResourceProviderRootIT extends AbstractNoSqlResourceProviderRootTest {
+    
     @Override
-    protected void registerResourceProviderFactory() {
-        context.registerInjectActivateService(
-                new CouchbaseClientImpl(),
-                ImmutableMap.<String, Object> builder()
+    protected void registerResourceProviderFactoryAsRoot() {
+        context.registerInjectActivateService(new CouchbaseClientImpl(), ImmutableMap.<String, Object>builder()
                         .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID)
                         .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
-                        .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
+                        .put("bucketName", System.getProperty("bucketName", "resource-test"))
+                        .build());
 
-        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap
-                .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build());
-    }
-
-    @Override
-    protected Resource testRoot() {
-        if (this.testRoot == null) {
-            try {
-                Resource root = context.resourceResolver().getResource("/");
-                Resource providerRoot = root.getChild("test");
-                if (providerRoot == null) {
-                    providerRoot = context.resourceResolver().create(
-                            root,
-                            "test",
-                            ImmutableMap
-                                    .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
-                }
-                this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(),
-                        ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
-            } catch (PersistenceException ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-        return this.testRoot;
+        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap.<String, Object>builder()
+                .put(ResourceProvider.ROOTS, "/")
+                .build());
     }
 
 }
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
index 76f87a5..9fc1a0b 100644
--- a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
@@ -40,15 +40,15 @@ public class CouchbaseNoSqlResourceProviderTransactionalIT extends AbstractNoSql
 
     @Override
     protected void registerResourceProviderFactory() {
-        context.registerInjectActivateService(
-                new CouchbaseClientImpl(),
-                ImmutableMap.<String, Object> builder()
+        context.registerInjectActivateService(new CouchbaseClientImpl(),ImmutableMap.<String, Object>builder()
                         .put(CouchbaseClient.CLIENT_ID_PROPERTY, CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID)
                         .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
-                        .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
+                        .put("bucketName", System.getProperty("bucketName", "resource-test"))
+                        .build());
 
-        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap
-                .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build());
+        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap.<String, Object>builder()
+                .put(ResourceProvider.ROOTS, "/test")
+                .build());
     }
 
     @Override
@@ -58,15 +58,13 @@ public class CouchbaseNoSqlResourceProviderTransactionalIT extends AbstractNoSql
                 Resource root = context.resourceResolver().getResource("/");
                 Resource providerRoot = root.getChild("test");
                 if (providerRoot == null) {
-                    providerRoot = context.resourceResolver().create(
-                            root,
-                            "test",
-                            ImmutableMap
-                                    .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+                    providerRoot = context.resourceResolver().create(root,"test",
+                            ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
                 }
                 this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(),
-                        ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
-            } catch (PersistenceException ex) {
+                        ImmutableMap.<String, Object>of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+            }
+            catch (PersistenceException ex) {
                 throw new RuntimeException(ex);
             }
         }

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 26/42: [maven-release-plugin] prepare release org.apache.sling.nosql.couchbase-resourceprovider-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-nosql-couchbase-resourceprovider.git

commit 2a1f9b8db8578fb0f63693c3f5caa30eca766a75
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 17 21:36:34 2015 +0000

    [maven-release-plugin] prepare release org.apache.sling.nosql.couchbase-resourceprovider-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703706 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4872bfd..b64c7e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,28 +17,27 @@
   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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>24</version>
-        <relativePath/>
+        <relativePath />
     </parent>
 
     <artifactId>org.apache.sling.nosql.couchbase-resourceprovider</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
+    <version>1.0.0</version>
     <packaging>bundle</packaging>
   
     <name>Apache Sling NoSQL Couchbase Resource Provider</name>
     <description>Resource Provider with Couchbase Persistence for Apache Sling.</description>
   
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/nosql/couchbase-resourceprovider</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.0.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.0.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.0.0</url>
     </scm>
 
     <properties>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 11/42: SLING-4381 enable metrics logging for nosql adapter and disable event distribution

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-nosql-couchbase-resourceprovider.git

commit 8fa77097ec00661f37f7196b18518d8ba0c705d5
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 21 14:09:21 2015 +0000

    SLING-4381 enable metrics logging for nosql adapter and disable event distribution
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680879 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/CouchbaseNoSqlResourceProviderFactory.java                | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
index 3c63704..086d64a 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -30,10 +30,12 @@ import org.apache.sling.api.resource.ResourceProvider;
 import org.apache.sling.api.resource.ResourceProviderFactory;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
+import org.apache.sling.nosql.generic.adapter.MetricsNoSqlAdapterWrapper;
 import org.apache.sling.nosql.generic.adapter.NoSqlAdapter;
 import org.apache.sling.nosql.generic.resource.AbstractNoSqlResourceProviderFactory;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.event.EventAdmin;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@link ResourceProviderFactory} implementation that uses couchbase as
@@ -50,7 +52,7 @@ import org.osgi.service.event.EventAdmin;
 public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
 
     /**
-     * Couchbase Client ID for Couchbase Resource Provier
+     * Couchbase Client ID for Couchbase Resource Provider
      */
     public static final String COUCHBASE_CLIENT_ID = "sling-resourceprovider-couchbase";
     
@@ -78,7 +80,8 @@ public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResource
 
     @Override
     protected NoSqlAdapter getNoSqlAdapter() {
-        return noSqlAdapter;
+        // enable call logging and metrics for {@link CouchbaseNoSqlAdapter}
+        return new MetricsNoSqlAdapterWrapper(noSqlAdapter, LoggerFactory.getLogger(CouchbaseNoSqlAdapter.class));
     }
 
     @Override

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 15/42: SLING-4381 make classes public but final

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-nosql-couchbase-resourceprovider.git

commit fd9383c3b4014f6d46b3cb31f4033275ac956497
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Jun 2 13:33:37 2015 +0000

    SLING-4381 make classes public but final
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1683106 13f79535-47bb-0310-9956-ffa450edef68
---
 .../resourceprovider/impl/CouchbaseNoSqlAdapter.java         | 11 +++++++++--
 .../nosql/couchbase/resourceprovider/impl/MapConverter.java  | 12 ++++++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 815b451..9fe9931 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -38,8 +38,15 @@ import com.couchbase.client.java.view.ViewRow;
  */
 public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
 
-    private static final String PN_PATH = "path";
-    private static final String PN_DATA = "data";
+    /**
+     * Property holding path
+     */
+    public static final String PN_PATH = "path";
+    
+    /**
+     * Property holding properties data
+     */
+    public static final String PN_DATA = "data";
 
     private static final String VIEW_DESIGN_DOCUMENT = "resourceIndex";
     private static final String VIEW_PARENT_PATH = "parentPath";
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
index efde8dd..a8278fd 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
@@ -35,7 +35,11 @@ public final class MapConverter {
         // static methods only
     }
 
-    static Map<String, Object> mapArrayToList(Map<String, Object> map) {
+    /**
+     * @param map Map with multi-valued arrays
+     * @return Map with multi-valued lists
+     */
+    public static Map<String, Object> mapArrayToList(Map<String, Object> map) {
         for (Map.Entry<String, Object> entry : map.entrySet()) {
             if (entry.getValue().getClass().isArray()) {
                 Class componentType = entry.getValue().getClass().getComponentType();
@@ -59,8 +63,12 @@ public final class MapConverter {
         return map;
     }
 
+    /**
+     * @param map Map with multi-valued lists
+     * @return Map with multi-valued arrays
+     */
     @SuppressWarnings("unchecked")
-    static Map<String, Object> mapListToArray(Map<String, Object> map) {
+    public static Map<String, Object> mapListToArray(Map<String, Object> map) {
         for (Map.Entry<String, Object> entry : map.entrySet()) {
             if (entry.getValue() instanceof List) {
                 List list = (List) entry.getValue();

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 17/42: 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-nosql-couchbase-resourceprovider.git

commit 53826f8bd22b6477a7d0e477a791e5c9877d0902
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 c8e3774..6704009 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>22</version>
+        <version>23</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-nosql-couchbase-resourceprovider] 30/42: SLING-5077 NoSQL Couchbase Resource Provider: Make index creation compatible with Couchbase 4.0 RC0

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-nosql-couchbase-resourceprovider.git

commit 2eb10c40fc6a80a4ebfb74926ad389bf92d2a136
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Sep 29 21:55:12 2015 +0000

    SLING-5077 NoSQL Couchbase Resource Provider: Make index creation compatible with Couchbase 4.0 RC0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1705931 13f79535-47bb-0310-9956-ffa450edef68
---
 .../couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index d7730e9..12302fa 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -37,7 +37,6 @@ import com.couchbase.client.java.Bucket;
 import com.couchbase.client.java.document.JsonDocument;
 import com.couchbase.client.java.document.json.JsonObject;
 import com.couchbase.client.java.error.DocumentAlreadyExistsException;
-import com.couchbase.client.java.query.Index;
 import com.couchbase.client.java.query.N1qlParams;
 import com.couchbase.client.java.query.N1qlQuery;
 import com.couchbase.client.java.query.N1qlQueryResult;
@@ -63,8 +62,9 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
         this.cacheKeyPrefix = cacheKeyPrefix;
         
         // make sure primary index and index on parentPath is present - ignore error if it is already present
-        Index.createPrimaryIndex().on(couchbaseClient.getBucketName());
-        Index.createIndex(PN_PARENT_PATH).on(couchbaseClient.getBucketName(), x(PN_PARENT_PATH));
+        Bucket bucket = couchbaseClient.getBucket();
+        bucket.query(N1qlQuery.simple("CREATE PRIMARY INDEX ON `" + couchbaseClient.getBucketName() + "`"));
+        bucket.query(N1qlQuery.simple("CREATE INDEX " + PN_PARENT_PATH + " ON `" + couchbaseClient.getBucketName() + "`(" + PN_PARENT_PATH + ")"));
     }
 
     @Override

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 01/42: SLING-4381 couchbase resource provider

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-nosql-couchbase-resourceprovider.git

commit c8267e8206da62549e336ebf59db1f65c2e9b2a0
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 14:11:43 2015 +0000

    SLING-4381 couchbase resource provider
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680578 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 119 +++++++++++++++++
 src/main/couchbase-views/ancestorPath.js           |  22 ++++
 src/main/couchbase-views/ancestorPathTester.html   |  66 ++++++++++
 src/main/couchbase-views/parentPath.js             |  19 +++
 src/main/couchbase-views/parentPathTester.html     |  64 +++++++++
 .../impl/CouchbaseNoSqlAdapter.java                | 146 +++++++++++++++++++++
 .../CouchbaseNoSqlResourceProviderFactory.java     | 118 +++++++++++++++++
 .../resourceprovider/impl/MapConverter.java        |  79 +++++++++++
 .../resourceprovider/impl/MapConverterTest.java    |  79 +++++++++++
 .../CouchbaseNoSqlResourceProviderIT.java          |  76 +++++++++++
 ...chbaseNoSqlResourceProviderTransactionalIT.java |  76 +++++++++++
 11 files changed, 864 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..8df9d96
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>22</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>org.apache.sling.nosql.couchbase-resourceprovider</artifactId>
+    <version>0.5.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+  
+    <name>Apache Sling NoSQL Couchbase Resource Provider</name>
+    <description>Resource Provider with Couchbase Persistence for Apache Sling.</description>
+  
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/nosql/couchbase-resourceprovider</url>
+    </scm>
+
+    <properties>
+        <sling.java.version>7</sling.java.version>
+    </properties>
+  
+    <dependencies>
+  
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
+            <version>0.5.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.nosql.generic</artifactId>
+            <version>0.5.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.2.2</version>
+            <scope>provided</scope>
+        </dependency>
+  
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.3.2</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.sling-mock</artifactId>
+            <version>1.2.1-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+  
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.nosql.generic</artifactId>
+            <classifier>tests</classifier>
+            <version>0.5.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+      
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+  
+    <build>
+        <plugins>
+    
+          <plugin>
+              <groupId>org.apache.felix</groupId>
+              <artifactId>maven-bundle-plugin</artifactId>
+              <extensions>true</extensions>
+          </plugin>
+    
+          <plugin>
+              <groupId>org.apache.felix</groupId>
+              <artifactId>maven-scr-plugin</artifactId>
+          </plugin>
+    
+        </plugins>
+    </build>
+  
+</project>
diff --git a/src/main/couchbase-views/ancestorPath.js b/src/main/couchbase-views/ancestorPath.js
new file mode 100644
index 0000000..6302a19
--- /dev/null
+++ b/src/main/couchbase-views/ancestorPath.js
@@ -0,0 +1,22 @@
+/*
+ * Emits for each document the all parent paths - allowing to fetch children and their decendants by path.
+ * Includes the path of the item itself.
+ */
+function(doc, meta) {
+  
+  // handle only sling resource documents with a valid path
+  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
+    return;
+  }
+  var pathParts = doc.path.split("/");
+  if (pathParts.length < 3) {
+    return;
+  }
+  
+  while (pathParts.length >= 2) {
+    // remove last element to get parent path
+    var parentPath = pathParts.join("/");
+    emit(parentPath, null);
+    pathParts.pop();
+  }
+}
diff --git a/src/main/couchbase-views/ancestorPathTester.html b/src/main/couchbase-views/ancestorPathTester.html
new file mode 100644
index 0000000..d07e5d9
--- /dev/null
+++ b/src/main/couchbase-views/ancestorPathTester.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Couchbase View Tester</title>
+    <style>body { font-family: Courier }</style>
+  </head>
+  <body>
+  
+<script>
+
+var emit = function(key, value) {
+  document.write("[" + key + "]" + "<br/>");
+}
+
+var testFunction = function(doc, meta) {
+  
+  // handle only sling resource documents with a valid path
+  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
+    return;
+  }
+  var pathParts = doc.path.split("/");
+  if (pathParts.length < 3) {
+    return;
+  }
+  
+  while (pathParts.length >= 2) {
+    // remove last element to get parent path
+    var parentPath = pathParts.join("/");
+    emit(parentPath, null);
+    pathParts.pop();
+  }
+};
+
+var testInput = [
+	  null,
+    "",
+    "abc",
+    "/",
+    "/content",
+    "/content/node1",
+    "/content/node1/node2",
+    "/content/node1/node2/node3",
+    "/content/node1/node2/node3/node4"
+];
+  
+</script>
+    
+    <table border="1">
+      <tr>
+	      <th>Input</th>
+	      <th>Output</th>
+	    </tr>
+<script>
+for (var i=0; i < testInput.length; i++) {
+  document.write("<tr>")
+  document.write("<td>" + testInput[i] + "</td>")
+  document.write("<td>")
+  testFunction({path: testInput[i], data: {}}, {id: "sling-resource:doc" + i});
+  document.write("</td>")
+  document.write("</tr>")
+}
+</script>
+    </table>
+  
+  </body>
+</html>
diff --git a/src/main/couchbase-views/parentPath.js b/src/main/couchbase-views/parentPath.js
new file mode 100644
index 0000000..5277818
--- /dev/null
+++ b/src/main/couchbase-views/parentPath.js
@@ -0,0 +1,19 @@
+/*
+ * Emits for each document the direct parent path - allowing to fetch direct children by path.
+ */
+function(doc, meta) {
+  
+  // handle only sling resource documents with a valid path
+  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
+    return;
+  }
+  var pathParts = doc.path.split("/");
+  if (pathParts.length < 3) {
+    return;
+  }
+  
+  // remove last element to get parent path
+  pathParts.pop();
+  var parentPath = pathParts.join("/");
+  emit(parentPath, null);
+}
diff --git a/src/main/couchbase-views/parentPathTester.html b/src/main/couchbase-views/parentPathTester.html
new file mode 100644
index 0000000..34e037f
--- /dev/null
+++ b/src/main/couchbase-views/parentPathTester.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Couchbase View Tester</title>
+    <style>body { font-family: Courier }</style>
+  </head>
+  <body>
+  
+<script>
+
+var emit = function(key, value) {
+  document.write("[" + key + "]" + "<br/>");
+}
+
+var testFunction = function(doc, meta) {
+  
+  // handle only sling resource documents with a valid path
+  if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
+    return;
+  }
+  var pathParts = doc.path.split("/");
+  if (pathParts.length < 3) {
+    return;
+  }
+  
+  // remove last element to get parent path
+  pathParts.pop();
+  var parentPath = pathParts.join("/");
+  emit(parentPath, null);
+};
+
+var testInput = [
+	  null,
+    "",
+    "abc",
+    "/",
+    "/content",
+    "/content/node1",
+    "/content/node1/node2",
+    "/content/node1/node2/node3",
+    "/content/node1/node2/node3/node4"
+];
+  
+</script>
+    
+    <table border="1">
+      <tr>
+	      <th>Input</th>
+	      <th>Output</th>
+	    </tr>
+<script>
+for (var i=0; i < testInput.length; i++) {
+  document.write("<tr>")
+  document.write("<td>" + testInput[i] + "</td>")
+  document.write("<td>")
+  testFunction({path: testInput[i], data: {}}, {id: "sling-resource:doc" + i});
+  document.write("</td>")
+  document.write("</tr>")
+}
+</script>
+    </table>
+  
+  </body>
+</html>
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
new file mode 100644
index 0000000..14f4e72
--- /dev/null
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -0,0 +1,146 @@
+/*
+ * 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.nosql.couchbase.resourceprovider.impl;
+
+import java.util.Iterator;
+
+import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
+import org.apache.sling.nosql.couchbase.client.CouchbaseKey;
+import org.apache.sling.nosql.generic.adapter.NoSqlAdapter;
+import org.apache.sling.nosql.generic.adapter.NoSqlData;
+
+import com.couchbase.client.java.Bucket;
+import com.couchbase.client.java.document.JsonDocument;
+import com.couchbase.client.java.document.json.JsonObject;
+import com.couchbase.client.java.error.DocumentAlreadyExistsException;
+import com.couchbase.client.java.view.Stale;
+import com.couchbase.client.java.view.ViewQuery;
+import com.couchbase.client.java.view.ViewRow;
+
+class CouchbaseNoSqlAdapter implements NoSqlAdapter {
+
+    private static final String PN_PATH = "path";
+    private static final String PN_DATA = "data";
+
+    private static final String VIEW_DESIGN_DOCUMENT = "resourceIndex";
+    private static final String VIEW_PARENT_PATH = "parentPath";
+    private static final String VIEW_ANCESTOR_PATH = "ancestorPath";
+
+    private final CouchbaseClient couchbaseClient;
+    private final String cacheKeyPrefix;
+
+    public CouchbaseNoSqlAdapter(CouchbaseClient couchbaseClient, String cacheKeyPrefix) {
+        this.couchbaseClient = couchbaseClient;
+        this.cacheKeyPrefix = cacheKeyPrefix;
+    }
+
+    @Override
+    public boolean validPath(String path) {
+        return (couchbaseClient != null);
+    }
+
+    @Override
+    public NoSqlData get(String path) {
+        Bucket bucket = couchbaseClient.getBucket();
+        String cacheKey = CouchbaseKey.build(path, cacheKeyPrefix);
+        JsonDocument doc = bucket.get(cacheKey);
+        if (doc == null) {
+            return null;
+        }
+        else {
+            JsonObject data = doc.content().getObject(PN_DATA);
+            if (data == null) {
+                return null;
+            }
+            else {
+                return new NoSqlData(path, MapConverter.mapListToArray(data.toMap()));
+            }
+        }
+    }
+
+    @Override
+    public Iterator<NoSqlData> getChildren(String parentPath) {
+        Bucket bucket = couchbaseClient.getBucket();
+        // fetch all direct children of this path
+        final Iterator<ViewRow> results = bucket.query(
+                ViewQuery.from(VIEW_DESIGN_DOCUMENT, VIEW_PARENT_PATH).key(parentPath).stale(Stale.FALSE)).rows();
+        return new Iterator<NoSqlData>() {
+            @Override
+            public boolean hasNext() {
+                return results.hasNext();
+            }
+
+            @Override
+            public NoSqlData next() {
+                JsonDocument doc = results.next().document();
+                JsonObject envelope = doc.content();
+                String path = envelope.getString(PN_PATH);
+                JsonObject data = envelope.getObject(PN_DATA);
+                return new NoSqlData(path, MapConverter.mapListToArray(data.toMap()));
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        };
+    }
+
+    @Override
+    public boolean store(NoSqlData data) {
+        Bucket bucket = couchbaseClient.getBucket();
+        String cacheKey = CouchbaseKey.build(data.getPath(), cacheKeyPrefix);
+
+        JsonObject envelope = JsonObject.create();
+        envelope.put(PN_PATH, data.getPath());
+        envelope.put(PN_DATA, JsonObject.from(MapConverter.mapArrayToList(data.getProperties())));
+
+        JsonDocument doc = JsonDocument.create(cacheKey, envelope);
+        try {
+            bucket.insert(doc);
+            return true; // created
+        }
+        catch (DocumentAlreadyExistsException ex) {
+            bucket.upsert(doc);
+            return false; // updated
+        }
+    }
+
+    @Override
+    public boolean deleteRecursive(String path) {
+        Bucket bucket = couchbaseClient.getBucket();
+        // fetch referenced item and all descendants
+        Iterator<ViewRow> results = bucket.query(
+                ViewQuery.from(VIEW_DESIGN_DOCUMENT, VIEW_ANCESTOR_PATH).key(path).stale(Stale.FALSE)).rows();
+        boolean deletedAny = false;
+        while (results.hasNext()) {
+            ViewRow result = results.next();
+            bucket.remove(result.document());
+            deletedAny = true;
+        }
+        return deletedAny;
+    }
+
+    @Override
+    public Iterator<NoSqlData> query(String query, String language) {
+        // not supported
+        return null;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
new file mode 100644
index 0000000..3f20e6c
--- /dev/null
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -0,0 +1,118 @@
+/*
+ * 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.nosql.couchbase.resourceprovider.impl;
+
+import java.util.Map;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+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.ResourceProvider;
+import org.apache.sling.api.resource.ResourceProviderFactory;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
+import org.apache.sling.nosql.generic.adapter.NoSqlAdapter;
+import org.apache.sling.nosql.generic.resource.AbstractNoSqlResourceProviderFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.event.EventAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * {@link ResourceProviderFactory} implementation that uses couchbase as
+ * persistence.
+ */
+@Component(immediate = true)
+@Service(value = ResourceProviderFactory.class)
+public class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlResourceProviderFactory {
+
+    @Property(label = "Couchbase Client ID", description = "ID referencing the matching couchbase client configuration and bucket for caching.", value = CouchbaseNoSqlResourceProviderFactory.COUCHBASE_CLIENT_ID_DEFAULT)
+    static final String COUCHBASE_CLIENT_ID_PROPERTY = "couchbaseClientID";
+    private static final String COUCHBASE_CLIENT_ID_DEFAULT = "caravan-resourceprovider-couchbase";
+
+    @Property(label = "Cache Key Prefix", description = "Prefix for caching keys.", value = CouchbaseNoSqlResourceProviderFactory.CACHE_KEY_PREFIX_DEFAULT)
+    static final String CACHE_KEY_PREFIX_PROPERTY = "cacheKeyPrefix";
+    private static final String CACHE_KEY_PREFIX_DEFAULT = "sling-resource:";
+
+    @Property(label = "Root paths", description = "Root paths for resource provider.", cardinality = Integer.MAX_VALUE)
+    static final String PROVIDER_ROOTS_PROPERTY = ResourceProvider.ROOTS;
+
+    @Reference
+    private EventAdmin eventAdmin;
+
+    private String couchbaseClientId;
+    private ServiceReference couchbaseClientServiceReference;
+    private NoSqlAdapter noSqlAdapter;
+
+    private static final Logger log = LoggerFactory.getLogger(CouchbaseNoSqlResourceProviderFactory.class);
+
+    @Activate
+    private void activate(ComponentContext componentContext, Map<String, Object> config) {
+        CouchbaseClient couchbaseClient = null;
+        try {
+            couchbaseClientId = PropertiesUtil.toString(config.get(COUCHBASE_CLIENT_ID_PROPERTY),
+                    COUCHBASE_CLIENT_ID_DEFAULT);
+            BundleContext bundleContext = componentContext.getBundleContext();
+            ServiceReference[] serviceReferences = bundleContext.getServiceReferences(
+                    CouchbaseClient.class.getName(), "(" + CouchbaseClient.CLIENT_ID_PROPERTY + "=" + couchbaseClientId + ")");
+            if (serviceReferences.length == 1) {
+                couchbaseClientServiceReference = serviceReferences[0];
+                couchbaseClient = (CouchbaseClient)bundleContext.getService(couchbaseClientServiceReference);
+            }
+            else if (serviceReferences.length > 1) {
+                log.error("Multiple couchbase clients registered for client id '{}', caching is disabled.",
+                        couchbaseClientId);
+            }
+            else {
+                log.error("No couchbase clients registered for client id '{}', caching is disabled.", couchbaseClientId);
+            }
+        }
+        catch (InvalidSyntaxException ex) {
+            log.error("Invalid service filter, couchbase caching is disabled.", ex);
+        }
+
+        String cacheKeyPrefix = PropertiesUtil
+                .toString(config.get(CACHE_KEY_PREFIX_PROPERTY), CACHE_KEY_PREFIX_DEFAULT);
+        noSqlAdapter = new CouchbaseNoSqlAdapter(couchbaseClient, cacheKeyPrefix);
+    }
+
+    @Deactivate
+    private void deactivate(ComponentContext componentContext) {
+        if (couchbaseClientServiceReference != null) {
+            componentContext.getBundleContext().ungetService(couchbaseClientServiceReference);
+        }
+    }
+
+    @Override
+    protected NoSqlAdapter getNoSqlAdapter() {
+        return noSqlAdapter;
+    }
+
+    @Override
+    protected EventAdmin getEventAdmin() {
+        return eventAdmin;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
new file mode 100644
index 0000000..f1e4ac4
--- /dev/null
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverter.java
@@ -0,0 +1,79 @@
+/*
+ * 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.nosql.couchbase.resourceprovider.impl;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+/**
+ * Transforms NoSqlData maps to a valid form for couchbase JSON document.
+ * All arrays have to be transformed to lists.
+ */
+final class MapConverter {
+
+    private MapConverter() {
+        // static methods only
+    }
+
+    static Map<String, Object> mapArrayToList(Map<String, Object> map) {
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            if (entry.getValue().getClass().isArray()) {
+                Class componentType = entry.getValue().getClass().getComponentType();
+                if (componentType == int.class) {
+                    entry.setValue(Arrays.asList(ArrayUtils.toObject((int[]) entry.getValue())));
+                }
+                else if (componentType == long.class) {
+                    entry.setValue(Arrays.asList(ArrayUtils.toObject((long[]) entry.getValue())));
+                }
+                else if (componentType == double.class) {
+                    entry.setValue(Arrays.asList(ArrayUtils.toObject((double[]) entry.getValue())));
+                }
+                else if (componentType == boolean.class) {
+                    entry.setValue(Arrays.asList(ArrayUtils.toObject((boolean[]) entry.getValue())));
+                }
+                else {
+                    entry.setValue(Arrays.asList((Object[]) entry.getValue()));
+                }
+            }
+        }
+        return map;
+    }
+
+    @SuppressWarnings("unchecked")
+    static Map<String, Object> mapListToArray(Map<String, Object> map) {
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            if (entry.getValue() instanceof List) {
+                List list = (List) entry.getValue();
+                if (list.size() == 0) {
+                    entry.setValue(null);
+                }
+                else {
+                    Class type = list.get(0).getClass();
+                    entry.setValue(list.toArray((Object[]) Array.newInstance(type, list.size())));
+                }
+            }
+        }
+        return map;
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverterTest.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverterTest.java
new file mode 100644
index 0000000..1f8e1ee
--- /dev/null
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/MapConverterTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.nosql.couchbase.resourceprovider.impl;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.apache.sling.nosql.couchbase.resourceprovider.impl.MapConverter;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+public class MapConverterTest {
+
+    @Test
+    public void testMapArrayToList() throws Exception {
+        Map<String, Object> result = MapConverter.mapArrayToList(Maps.newHashMap(ImmutableMap.<String, Object>builder()
+                .put("prop1", "value1")
+                .put("prop2", 2)
+                .put("stringArray", new String[] { "value1", "value2" })
+                .put("integerArray", new Integer[] { 1, 2, 3 })
+                .put("integerArray2", new int[] { 1, 2, 3 })
+                .put("longArray", new long[] { 1L, 2L })
+                .put("doubleArray", new double[] { 1.1d, 1.2d })
+                .put("booleanArray", new boolean[] { true, false })
+                .build()));
+
+        assertEquals("prop1", "value1", result.get("prop1"));
+        assertEquals("prop2", 2, result.get("prop2"));
+        assertEquals("stringArray", ImmutableList.of("value1", "value2"), result.get("stringArray"));
+        assertEquals("integerArray", ImmutableList.of(1, 2, 3), result.get("integerArray"));
+        assertEquals("integerArray2", ImmutableList.of(1, 2, 3), result.get("integerArray2"));
+        assertEquals("longArray", ImmutableList.of(1L, 2L), result.get("longArray"));
+        assertEquals("doubleArray", ImmutableList.of(1.1d, 1.2d), result.get("doubleArray"));
+        assertEquals("booleanArray", ImmutableList.of(true, false), result.get("booleanArray"));
+    }
+
+    @Test
+    public void testMapListToArray() throws Exception {
+        Map<String, Object> result = MapConverter.mapListToArray(Maps.newHashMap(ImmutableMap.<String, Object>builder()
+                .put("prop1", "value1")
+                .put("prop2", 2)
+                .put("stringArray", ImmutableList.of("value1", "value2"))
+                .put("integerArray", ImmutableList.of(1, 2, 3))
+                .put("longArray", ImmutableList.of(1L, 2L))
+                .put("doubleArray", ImmutableList.of(1.1d, 1.2d))
+                .put("booleanArray", ImmutableList.of(true, false))
+                .build()));
+
+        assertEquals("prop1", "value1", result.get("prop1"));
+        assertEquals("prop2", 2, result.get("prop2"));
+        assertArrayEquals("stringArray", new String[] { "value1", "value2" }, (String[]) result.get("stringArray"));
+        assertArrayEquals("integerArray", new Integer[] { 1, 2, 3 }, (Integer[]) result.get("integerArray"));
+        assertArrayEquals("longArray", new Long[] { 1L, 2L }, (Long[]) result.get("longArray"));
+        assertArrayEquals("doubleArray", new Double[] { 1.1d, 1.2d }, (Double[]) result.get("doubleArray"));
+        assertArrayEquals("booleanArray", new Boolean[] { true, false }, (Boolean[]) result.get("booleanArray"));
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
new file mode 100644
index 0000000..ed64041
--- /dev/null
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderIT.java
@@ -0,0 +1,76 @@
+/*
+ * 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.nosql.couchbase.resourceprovider.integration;
+
+import java.util.UUID;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceProvider;
+import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
+import org.apache.sling.nosql.couchbase.client.impl.CouchbaseClientImpl;
+import org.apache.sling.nosql.couchbase.resourceprovider.impl.CouchbaseNoSqlResourceProviderFactory;
+import org.apache.sling.nosql.generic.resource.impl.AbstractNoSqlResourceProviderTest;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Test basic ResourceResolver and ValueMap with different data types.
+ */
+public class CouchbaseNoSqlResourceProviderIT extends AbstractNoSqlResourceProviderTest {
+
+    private Resource testRoot;
+
+    @Override
+    protected void registerResourceProviderFactory() {
+        context.registerInjectActivateService(
+                new CouchbaseClientImpl(),
+                ImmutableMap.<String, Object> builder()
+                        .put(CouchbaseClient.CLIENT_ID_PROPERTY, "caravan-resourceprovider-couchbase")
+                        .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
+                        .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
+
+        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap
+                .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build());
+    }
+
+    @Override
+    protected Resource testRoot() {
+        if (this.testRoot == null) {
+            try {
+                Resource root = context.resourceResolver().getResource("/");
+                Resource providerRoot = root.getChild("test");
+                if (providerRoot == null) {
+                    providerRoot = context.resourceResolver().create(
+                            root,
+                            "test",
+                            ImmutableMap
+                                    .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+                }
+                this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(),
+                        ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+            } catch (PersistenceException ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+        return this.testRoot;
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
new file mode 100644
index 0000000..3c62e9d
--- /dev/null
+++ b/src/test/java/org/apache/sling/nosql/couchbase/resourceprovider/integration/CouchbaseNoSqlResourceProviderTransactionalIT.java
@@ -0,0 +1,76 @@
+/*
+ * 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.nosql.couchbase.resourceprovider.integration;
+
+import java.util.UUID;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceProvider;
+import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
+import org.apache.sling.nosql.couchbase.client.impl.CouchbaseClientImpl;
+import org.apache.sling.nosql.couchbase.resourceprovider.impl.CouchbaseNoSqlResourceProviderFactory;
+import org.apache.sling.nosql.generic.resource.impl.AbstractNoSqlResourceProviderTransactionalTest;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Test basic ResourceResolver and ValueMap with different data types.
+ */
+public class CouchbaseNoSqlResourceProviderTransactionalIT extends AbstractNoSqlResourceProviderTransactionalTest {
+
+    private Resource testRoot;
+
+    @Override
+    protected void registerResourceProviderFactory() {
+        context.registerInjectActivateService(
+                new CouchbaseClientImpl(),
+                ImmutableMap.<String, Object> builder()
+                        .put(CouchbaseClient.CLIENT_ID_PROPERTY, "caravan-resourceprovider-couchbase")
+                        .put("couchbaseHosts", System.getProperty("couchbaseHosts", "localhost:8091"))
+                        .put("bucketName", System.getProperty("bucketName", "resource-test")).build());
+
+        context.registerInjectActivateService(new CouchbaseNoSqlResourceProviderFactory(), ImmutableMap
+                .<String, Object> builder().put(ResourceProvider.ROOTS, "/test").build());
+    }
+
+    @Override
+    protected Resource testRoot() {
+        if (this.testRoot == null) {
+            try {
+                Resource root = context.resourceResolver().getResource("/");
+                Resource providerRoot = root.getChild("test");
+                if (providerRoot == null) {
+                    providerRoot = context.resourceResolver().create(
+                            root,
+                            "test",
+                            ImmutableMap
+                                    .<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+                }
+                this.testRoot = context.resourceResolver().create(providerRoot, UUID.randomUUID().toString(),
+                        ImmutableMap.<String, Object> of(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED));
+            } catch (PersistenceException ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+        return this.testRoot;
+    }
+
+}

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 16/42: SLING-4381 instantiate metrics adapter only once

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-nosql-couchbase-resourceprovider.git

commit df23bdcc6d72a4c97d3a58e1b4518c2d7e5b81b8
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Jun 2 14:36:07 2015 +0000

    SLING-4381 instantiate metrics adapter only once
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1683118 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/CouchbaseNoSqlResourceProviderFactory.java           | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
index ea61ed3..a567978 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlResourceProviderFactory.java
@@ -73,15 +73,16 @@ public final class CouchbaseNoSqlResourceProviderFactory extends AbstractNoSqlRe
 
     @Activate
     private void activate(ComponentContext componentContext, Map<String, Object> config) {
-        String cacheKeyPrefix = PropertiesUtil
-                .toString(config.get(CACHE_KEY_PREFIX_PROPERTY), CACHE_KEY_PREFIX_DEFAULT);
-        noSqlAdapter = new CouchbaseNoSqlAdapter(couchbaseClient, cacheKeyPrefix);
+        String cacheKeyPrefix = PropertiesUtil.toString(config.get(CACHE_KEY_PREFIX_PROPERTY), CACHE_KEY_PREFIX_DEFAULT);
+        NoSqlAdapter couchbaseAdapter = new CouchbaseNoSqlAdapter(couchbaseClient, cacheKeyPrefix);
+        
+        // enable call logging and metrics for {@link CouchbaseNoSqlAdapter}
+        noSqlAdapter = new MetricsNoSqlAdapterWrapper(couchbaseAdapter, LoggerFactory.getLogger(CouchbaseNoSqlAdapter.class));
     }
 
     @Override
     protected NoSqlAdapter getNoSqlAdapter() {
-        // enable call logging and metrics for {@link CouchbaseNoSqlAdapter}
-        return new MetricsNoSqlAdapterWrapper(noSqlAdapter, LoggerFactory.getLogger(CouchbaseNoSqlAdapter.class));
+        return noSqlAdapter;
     }
 
     @Override

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 37/42: update dependencies

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-nosql-couchbase-resourceprovider.git

commit 505462272caa80fae0965ef43fd0ffc07a16f2c4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 12:19:26 2016 +0000

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

diff --git a/pom.xml b/pom.xml
index ee575ea..ccc9945 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.2</version>
             <scope>provided</scope>
         </dependency>
     

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 38/42: [maven-release-plugin] prepare release org.apache.sling.nosql.couchbase-resourceprovider-1.1.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-nosql-couchbase-resourceprovider.git

commit cda58d6764bf92dcbaafdb1108324a7618dca567
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 12:20:17 2016 +0000

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

diff --git a/pom.xml b/pom.xml
index ccc9945..c09613f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.nosql.couchbase-resourceprovider</artifactId>
-    <version>1.1.0-SNAPSHOT</version>
+    <version>1.1.0</version>
     <packaging>bundle</packaging>
   
     <name>Apache Sling NoSQL Couchbase Resource Provider</name>
     <description>Resource Provider with Couchbase Persistence for Apache Sling.</description>
   
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/nosql/couchbase-resourceprovider</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.1.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.1.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.1.0</url>
     </scm>
 
     <properties>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 27/42: [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-nosql-couchbase-resourceprovider.git

commit f53efb0f3fb9b64afbba64a4c9410de6172471f5
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 17 21:36:50 2015 +0000

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

diff --git a/pom.xml b/pom.xml
index b64c7e8..4556c58 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.nosql.couchbase-resourceprovider</artifactId>
-    <version>1.0.0</version>
+    <version>1.0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
   
     <name>Apache Sling NoSQL Couchbase Resource Provider</name>
     <description>Resource Provider with Couchbase Persistence for Apache Sling.</description>
   
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.0.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.0.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.nosql.couchbase-resourceprovider-1.0.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/couchbase-resourceprovider</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/nosql/couchbase-resourceprovider</url>
     </scm>
 
     <properties>

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 22/42: SLING-4381/SLING-5024 fix root node child listing

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-nosql-couchbase-resourceprovider.git

commit 80352d7a754d8f14ce383d0178ccdcb379f7e92e
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Sep 16 19:25:11 2015 +0000

    SLING-4381/SLING-5024 fix root node child listing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703453 13f79535-47bb-0310-9956-ffa450edef68
---
 .../nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index fd4a798..5a699a9 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -97,7 +97,7 @@ public final class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
     public Iterator<NoSqlData> getChildren(String parentPath) {
         Bucket bucket = couchbaseClient.getBucket();
         // fetch all direct children of this path
-        Pattern directChildren = Pattern.compile("^" + parentPath + "/[^/]+$");
+        Pattern directChildren = Pattern.compile("^" + StringUtils.removeEnd(parentPath, "/") + "/[^/]+$");
         N1qlQuery query = N1qlQuery.simple(select("*")
                 .from(couchbaseClient.getBucketName())
                 .where("REGEXP_LIKE(`" + PN_PATH + "`, '" + directChildren.pattern() + "')"),

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 06/42: SLING-4381 update README

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-nosql-couchbase-resourceprovider.git

commit acd7217d422c26a982b11049f9dfc4d63c3a9338
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 16:33:00 2015 +0000

    SLING-4381 update README
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680631 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/README.md b/README.md
index 53be13a..c47f479 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,21 @@ Configuration on deployment
 * Additionally a factory configuration for "Apache Sling NoSQL Couchbase Resource Provider Factory" defines the root of the resource tree that should be stored in Couchbase
 
 
+Couchbase Views for path-based access
+-------------------------------------
+
+For list and delete operations two couchbase views have to be defined and published in the bucket that is used by the resource provider.
+
+Steps to create those views:
+* Log into Couchbase Console
+* Go to "Views" and select the correct bucket
+* Add a new design document via "Create Development View" and name it "_design/dev_resourceIndex" (the prefix "_design/dev_" is added automatically)
+* Use the name "ancestorPath" for the first view that is created together with the design document
+* Paste the view code from [ancestorPath.js](src/main/couchbase-views/ancestorPath.js) into the editor and save it
+* Create another view named "parentPath", paste the view code from [parentPath.js](src/main/couchbase-views/ancestorPath.js) and save it
+* Publish the design document so the views are production views
+
+
 Run integration tests
 ---------------------
 
@@ -21,3 +36,4 @@ To run the integration tests you have to set up a real couchbase server and run
 ```
 mvn -Pcouchbase-integration-test -DcouchbaseHosts=localhost:8091 -DbucketName=test integration-test
 ```
+

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 36/42: update dependencies

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-nosql-couchbase-resourceprovider.git

commit 38234ca295a367befb29aac58cc4d2cf92b0c6f7
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 12:07:22 2016 +0000

    update dependencies
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732103 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2ce12c4..ee575ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.1.0</version>
             <scope>provided</scope>
         </dependency>
     
@@ -91,7 +91,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.1.0</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 24/42: update dependencies

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-nosql-couchbase-resourceprovider.git

commit bcf0327a64053279512cd514021e2d7ce79d1522
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 17 21:31:07 2015 +0000

    update dependencies
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703701 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 49fc370..5d9384c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>0.5.0-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
     
@@ -92,7 +92,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>0.5.0-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 28/42: update to next snapshot version until releases are available in maven central

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-nosql-couchbase-resourceprovider.git

commit 93c77272641a22ac166a311ea9f47b0e26763c07
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 17 21:44:36 2015 +0000

    update to next snapshot version until releases are available in maven central
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1703715 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4556c58..2dc6240 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,14 +49,14 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     
@@ -91,7 +91,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 07/42: SLING-4381 update README

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-nosql-couchbase-resourceprovider.git

commit 5c36c3e12c08475addc9ce503e784c020a520803
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed May 20 16:35:50 2015 +0000

    SLING-4381 update README
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1680634 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index c47f479..4fd582b 100644
--- a/README.md
+++ b/README.md
@@ -21,10 +21,10 @@ For list and delete operations two couchbase views have to be defined and publis
 Steps to create those views:
 * Log into Couchbase Console
 * Go to "Views" and select the correct bucket
-* Add a new design document via "Create Development View" and name it "_design/dev_resourceIndex" (the prefix "_design/dev_" is added automatically)
+* Add a new design document via "Create Development View" and name it "\_design/dev\_resourceIndex" (the prefix "\_design/dev\_" is added automatically)
 * Use the name "ancestorPath" for the first view that is created together with the design document
 * Paste the view code from [ancestorPath.js](src/main/couchbase-views/ancestorPath.js) into the editor and save it
-* Create another view named "parentPath", paste the view code from [parentPath.js](src/main/couchbase-views/ancestorPath.js) and save it
+* Create another view named "parentPath", paste the view code from [parentPath.js](src/main/couchbase-views/parentPath.js) and save it
 * Publish the design document so the views are production views
 
 

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 40/42: update version to next development snapshot until releases available on maven central

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-nosql-couchbase-resourceprovider.git

commit 304bd6bc1f18489424c19b18d7d40a3dcd58c8c6
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Wed Feb 24 12:27:43 2016 +0000

    update version to next development snapshot until releases available on maven central
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732128 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 33bc9d6..b19007b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,14 +49,14 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.couchbase-client</artifactId>
-            <version>1.0.2</version>
+            <version>1.0.3-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
-            <version>1.1.0</version>
+            <version>1.1.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     
@@ -91,7 +91,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.nosql.generic</artifactId>
             <classifier>tests</classifier>
-            <version>1.1.0</version>
+            <version>1.1.1-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
       

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

[sling-org-apache-sling-nosql-couchbase-resourceprovider] 12/42: SLING-4381 introduce AbstractNoSqlAdapter

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-nosql-couchbase-resourceprovider.git

commit 4645bd203412e56981df82a3e44a363cd6fd1b6b
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri May 22 08:55:34 2015 +0000

    SLING-4381 introduce AbstractNoSqlAdapter
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1681048 13f79535-47bb-0310-9956-ffa450edef68
---
 .../couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
index 6d85b4f..7a9cf5e 100644
--- a/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/couchbase/resourceprovider/impl/CouchbaseNoSqlAdapter.java
@@ -22,7 +22,7 @@ import java.util.Iterator;
 
 import org.apache.sling.nosql.couchbase.client.CouchbaseClient;
 import org.apache.sling.nosql.couchbase.client.CouchbaseKey;
-import org.apache.sling.nosql.generic.adapter.NoSqlAdapter;
+import org.apache.sling.nosql.generic.adapter.AbstractNoSqlAdapter;
 import org.apache.sling.nosql.generic.adapter.NoSqlData;
 
 import com.couchbase.client.java.Bucket;
@@ -33,7 +33,7 @@ import com.couchbase.client.java.view.Stale;
 import com.couchbase.client.java.view.ViewQuery;
 import com.couchbase.client.java.view.ViewRow;
 
-class CouchbaseNoSqlAdapter implements NoSqlAdapter {
+class CouchbaseNoSqlAdapter extends AbstractNoSqlAdapter {
 
     private static final String PN_PATH = "path";
     private static final String PN_DATA = "data";
@@ -137,10 +137,4 @@ class CouchbaseNoSqlAdapter implements NoSqlAdapter {
         return deletedAny;
     }
 
-    @Override
-    public Iterator<NoSqlData> query(String query, String language) {
-        // not supported
-        return null;
-    }
-
 }

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