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:25:10 UTC

[sling-org-apache-sling-mongodb] 22/36: Use latest mongo driver

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-mongodb.git

commit 26027ca76802b86edee755edacdfb052a4bb3529
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Sep 22 10:38:08 2013 +0000

    Use latest mongo driver
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1525343 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                    |  2 +-
 .../org/apache/sling/mongodb/impl/MongoDBResource.java     |  7 +++++++
 .../apache/sling/mongodb/impl/MongoDBResourceProvider.java | 14 +++++++-------
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5a5e1a9..07bb13d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
         <dependency>
         	<groupId>org.mongodb</groupId>
         	<artifactId>mongo-java-driver</artifactId>
-        	<version>2.9.1</version>
+        	<version>2.11.3</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/mongodb/impl/MongoDBResource.java b/src/main/java/org/apache/sling/mongodb/impl/MongoDBResource.java
index 0aad630..93c51e4 100644
--- a/src/main/java/org/apache/sling/mongodb/impl/MongoDBResource.java
+++ b/src/main/java/org/apache/sling/mongodb/impl/MongoDBResource.java
@@ -58,6 +58,13 @@ public class MongoDBResource extends AbstractResource {
         this.provider = provider;
     }
 
+    public MongoDBResource(final MongoDBResource source) {
+        this.resourceResolver = source.resourceResolver;
+        this.resourcePath = source.resourcePath;
+        this.collection = source.collection;
+        this.dbObject = source.dbObject;
+        this.provider = source.provider;
+    }
     /**
      * @see org.apache.sling.api.resource.Resource#getPath()
      */
diff --git a/src/main/java/org/apache/sling/mongodb/impl/MongoDBResourceProvider.java b/src/main/java/org/apache/sling/mongodb/impl/MongoDBResourceProvider.java
index b1168ed..55fdb5f 100644
--- a/src/main/java/org/apache/sling/mongodb/impl/MongoDBResourceProvider.java
+++ b/src/main/java/org/apache/sling/mongodb/impl/MongoDBResourceProvider.java
@@ -230,7 +230,7 @@ public class MongoDBResourceProvider implements ResourceProvider, ModifyingResou
             return null;
         }
         if ( this.changedResources.containsKey(path) ) {
-            return this.changedResources.get(path);
+            return new MongoDBResource(this.changedResources.get(path));
         }
         final String[] info = this.extractResourceInfo(path);
         if ( info != null ) {
@@ -366,12 +366,12 @@ public class MongoDBResourceProvider implements ResourceProvider, ModifyingResou
         return names.contains(name) && !this.context.isFilterCollectionName(name);
     }
 
-    
+
     /**
      * Check if a collection with a given name exists and return it
      */
     protected DBCollection getCollection(final String name) {
-        if ( this.hasCollection(name) ) {            
+        if ( this.hasCollection(name) ) {
             return this.context.getDatabase().getCollection(name);
         }
         return null;
@@ -418,19 +418,19 @@ public class MongoDBResourceProvider implements ResourceProvider, ModifyingResou
         }
         return dbObj;
     }
-    
+
     protected Set<String> getDeletedResources() {
         return this.deletedResources;
     }
-    
+
     protected Map<String, MongoDBResource> getChangedResources() {
         return this.changedResources;
     }
-    
+
     protected MongoDBContext getContext() {
         return this.context;
     }
-    
+
     protected String getPROP_PATH() {
         return PROP_PATH;
     }

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