jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1392271 [1/2] - in /jackrabbit/oak/trunk/oak-mongomk/src: main/java/org/apache/jackrabbit/mongomk/ main/java/org/apache/jackrabbit/mongomk/api/model/ main/java/org/apache/jackrabbit/mongomk/command/ main/java/org/apache/jackrabbit/mongomk/...
Date Mon, 01 Oct 2012 10:40:14 GMT
Author: jukka
Date: Mon Oct  1 10:40:12 2012
New Revision: 1392271

URL: http://svn.apache.org/viewvc?rev=1392271&view=rev
Log:
OAK-342: [MongoMK] Revision id type inconsistency

Patch by Mete Atamel

Added:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/BlobStoreMongo.java
      - copied, changed from r1392246, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/BlobStoreMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoConnection.java
      - copied, changed from r1392246, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoConnection.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeStoreMongo.java
      - copied, changed from r1392246, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/NodeStoreMongo.java
Removed:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/BlobStoreMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoConnection.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/NodeStoreMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java
Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitCommandInstructionVisitor.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/HeadMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/NodeMongo.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/AbstractQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadRevisionQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodeByPathQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidRevisionsQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/ReadAndIncHeadRevisionQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveAndSetHeadRevisionQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveCommitQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveNodesQuery.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/MongoUtil.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BaseMongoTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongoTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/ConcurrentCommitCommandMongoTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongoTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongoTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongoTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/NodeAssert.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilderTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQueryTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQueryTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQueryTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/scenario/SimpleNodeScenario.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java Mon Oct  1 10:40:12 2012
@@ -56,14 +56,14 @@ public interface Commit {
     String getPath();
 
     /**
-     * Returns the revision id of this commit if known already, else this will return {@code null}. The revision
-     * id will be determined only after the commit has been successfully performed.
+     * Returns the revision id of this commit if known already, else this will return {@code null}.
+     * The revision id will be determined only after the commit has been successfully performed.
      *
-     * @see #setRevisionId(String)
+     * @see #setRevisionId(Long)
      *
      * @return The revision id of this commit or {@code null}.
      */
-    String getRevisionId();
+    Long getRevisionId();
 
     /**
      * Sets the revision id of this commit.
@@ -72,7 +72,7 @@ public interface Commit {
      *
      * @param revisionId The revision id to set.
      */
-    void setRevisionId(String revisionId);
+    void setRevisionId(Long revisionId);
 
 
     /**

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java Mon Oct  1 10:40:12 2012
@@ -79,15 +79,15 @@ public interface Node {
     Map<String, Object> getProperties();
 
     /**
-     * Returns the revision id of this node if known already, else this will return {@code null}. The revision id
-     * will be determined only after the commit has been successfully performed or the node has been read as part of an
-     * existing revision.
+     * Returns the revision id of this node if known already, else this will return {@code null}.
+     * The revision id will be determined only after the commit has been successfully
+     * performed or the node has been read as part of an existing revision.
      *
-     * @see #setRevisionId(String)
+     * @see #setRevisionId(Long)
      *
      * @return The revision id of this commit or {@code null}.
      */
-    String getRevisionId();
+    Long getRevisionId();
 
     /**
      * Sets the revision id of this node.
@@ -96,5 +96,5 @@ public interface Node {
      *
      * @param revisionId The revision id to set.
      */
-    void setRevisionId(String revisionId);
+    void setRevisionId(Long revisionId);
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -23,10 +23,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
 import org.apache.jackrabbit.mongomk.api.model.Commit;
 import org.apache.jackrabbit.mongomk.api.model.Instruction;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.CommitCommandInstructionVisitor;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
@@ -50,7 +50,7 @@ import com.mongodb.WriteResult;
  *
  * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
  */
-public class CommitCommandMongo extends AbstractCommand<String> {
+public class CommitCommandMongo extends AbstractCommand<Long> {
 
     private static final Logger logger = LoggerFactory.getLogger(CommitCommandMongo.class);
 
@@ -62,7 +62,7 @@ public class CommitCommandMongo extends 
     private List<NodeMongo> existingNodes;
     private HeadMongo headMongo;
     private Set<NodeMongo> nodeMongos;
-    private String revisionId;
+    private Long revisionId;
 
     /**
      * Constructs a new {@code CommitCommandMongo}.
@@ -76,7 +76,7 @@ public class CommitCommandMongo extends 
     }
 
     @Override
-    public String execute() throws Exception {
+    public Long execute() throws Exception {
         logger.debug(String.format("Trying to commit: %s", commit.getDiff()));
 
         readAndIncHeadRevision();
@@ -122,13 +122,12 @@ public class CommitCommandMongo extends 
     protected boolean saveAndSetHeadRevision() throws Exception {
         boolean success = true;
 
-        HeadMongo headMongo = new SaveAndSetHeadRevisionQuery(mongoConnection, this.headMongo.getHeadRevisionId(),
-                HeadMongo.toDBRepresentation(revisionId)).execute();
+        HeadMongo headMongo = new SaveAndSetHeadRevisionQuery(mongoConnection,
+                this.headMongo.getHeadRevisionId(), revisionId).execute();
         if (headMongo == null) {
             // TODO: Check for conflicts!
-            logger.warn(String
-                    .format("Encounterd a conflicting update, thus can't commit revision %s and will be retried with new revision",
-                            revisionId));
+            logger.warn(String.format("Encounterd a conflicting update, thus can't commit"
+                    + " revision %s and will be retried with new revision", revisionId));
 
             success = false;
         }
@@ -164,7 +163,7 @@ public class CommitCommandMongo extends 
     }
 
     private void createRevision() {
-        revisionId = String.valueOf(headMongo.getNextRevisionId() - 1);
+        revisionId = headMongo.getNextRevisionId() - 1;
     }
 
     private void markAsFailed() throws Exception {
@@ -277,7 +276,7 @@ public class CommitCommandMongo extends 
         }
 
         existingNodes = new FetchNodesForRevisionQuery(mongoConnection, paths,
-                String.valueOf(headMongo.getHeadRevisionId())).execute();
+                headMongo.getHeadRevisionId()).execute();
     }
 
     private void saveCommit() throws Exception {

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.mongomk.command;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 
 import com.mongodb.BasicDBObject;
 import com.mongodb.gridfs.GridFS;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.mongomk.command;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.query.FetchHeadRevisionQuery;
 
 /**
@@ -25,7 +25,7 @@ import org.apache.jackrabbit.mongomk.que
  *
  * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
  */
-public class GetHeadRevisionCommandMongo extends AbstractCommand<String> {
+public class GetHeadRevisionCommandMongo extends AbstractCommand<Long> {
 
     private final MongoConnection mongoConnection;
 
@@ -39,18 +39,7 @@ public class GetHeadRevisionCommandMongo
     }
 
     @Override
-    public String execute() throws Exception {
-        long headRevision = fetchHeadRevision();
-        String revisionId = convertToRevisionId(headRevision);
-
-        return revisionId;
-    }
-
-    private String convertToRevisionId(long headRevision) {
-        return String.valueOf(headRevision);
-    }
-
-    private long fetchHeadRevision() throws Exception {
+    public Long execute() throws Exception {
         return new FetchHeadRevisionQuery(mongoConnection).execute();
     }
-}
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -22,15 +22,14 @@ import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
 import org.apache.jackrabbit.mongomk.api.model.Node;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.impl.model.NodeImpl;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
 import org.apache.jackrabbit.mongomk.query.FetchNodesByPathAndDepthQuery;
 import org.apache.jackrabbit.mongomk.query.FetchValidCommitsQuery;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,7 +47,7 @@ public class GetNodesCommandMongo extend
     private final String path;
     private final int depth;
 
-    private String revisionId;
+    private Long revisionId;
     private List<CommitMongo> lastCommits;
     private List<NodeMongo> nodeMongos;
 
@@ -61,11 +60,11 @@ public class GetNodesCommandMongo extend
      *
      * @param mongoConnection The {@link MongoConnection}.
      * @param path The root path of the nodes to get.
-     * @param revisionId The {@link RevisionId} or {@code null}.
+     * @param revisionId The revision id or null.
      * @param depth The depth.
      */
     public GetNodesCommandMongo(MongoConnection mongoConnection, String path,
-            String revisionId, int depth) {
+            Long revisionId, int depth) {
         this.mongoConnection = mongoConnection;
         this.path = path;
         this.revisionId = revisionId;
@@ -155,9 +154,8 @@ public class GetNodesCommandMongo extend
         // TODO Move this into the Query which should throw the exception in case the commit doesn't exist
         if (revisionId != null) {
             boolean revisionExists = false;
-            long revId = MongoUtil.toMongoRepresentation(revisionId);
             for (CommitMongo commitMongo : lastCommits) {
-                if (commitMongo.getRevisionId() == revId) {
+                if (commitMongo.getRevisionId() == revisionId) {
                     revisionExists = true;
 
                     break;
@@ -165,14 +163,14 @@ public class GetNodesCommandMongo extend
             }
 
             if (!revisionExists) {
-                throw new Exception(String.format("The revisionId %d could not be found", revId));
+                throw new Exception(String.format("Revision %d could not be found", revisionId));
             }
         }
     }
 
     private void readNodesByPath() {
-        FetchNodesByPathAndDepthQuery query = new FetchNodesByPathAndDepthQuery(mongoConnection, path, revisionId,
-                depth);
+        FetchNodesByPathAndDepthQuery query = new FetchNodesByPathAndDepthQuery(mongoConnection,
+                path, revisionId, depth);
         nodeMongos = query.execute();
     }
 
@@ -182,8 +180,8 @@ public class GetNodesCommandMongo extend
         verified = verifyNodeHierarchyRec(path, 0);
 
         if (!verified) {
-            LOG.error(String.format("Node hierarchy could not be verified because some nodes were inconsistent: %s",
-                    path));
+            LOG.error(String.format("Node hierarchy could not be verified because"
+                    + " some nodes were inconsistent: %s", path));
         }
 
         return verified;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -18,9 +18,9 @@ package org.apache.jackrabbit.mongomk.co
 
 import java.util.Set;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
 import org.apache.jackrabbit.mongomk.api.model.Node;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 
 /**
@@ -31,7 +31,7 @@ import org.apache.jackrabbit.oak.commons
 public class NodeExistsCommandMongo extends AbstractCommand<Boolean> {
 
     private final MongoConnection mongoConnection;
-    private final String revisionId;
+    private final Long revisionId;
 
     private Node parentNode;
     private String path;
@@ -41,9 +41,10 @@ public class NodeExistsCommandMongo exte
      *
      * @param mongoConnection The {@link MongoConnection}.
      * @param path The root path of the nodes to get.
-     * @param revisionId The {@link RevisionId} or {@code null}.
+     * @param revisionId The revision id or null.
      */
-    public NodeExistsCommandMongo(MongoConnection mongoConnection, String path, String revisionId) {
+    public NodeExistsCommandMongo(MongoConnection mongoConnection, String path,
+            Long revisionId) {
         this.mongoConnection = mongoConnection;
         this.path = path;
         this.revisionId = revisionId;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -19,8 +19,8 @@ package org.apache.jackrabbit.mongomk.co
 import java.io.InputStream;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 
 import com.mongodb.BasicDBObject;
 import com.mongodb.gridfs.GridFS;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongo.java Mon Oct  1 10:40:12 2012
@@ -21,8 +21,8 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.command.AbstractCommand;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 
 import com.mongodb.BasicDBObject;
 import com.mongodb.gridfs.GridFS;

Copied: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/BlobStoreMongo.java (from r1392246, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/BlobStoreMongo.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/BlobStoreMongo.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/BlobStoreMongo.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/BlobStoreMongo.java&r1=1392246&r2=1392271&rev=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/BlobStoreMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/BlobStoreMongo.java Mon Oct  1 10:40:12 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk;
+package org.apache.jackrabbit.mongomk.impl;
 
 import java.io.InputStream;
 

Copied: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoConnection.java (from r1392246, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoConnection.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoConnection.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoConnection.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoConnection.java&r1=1392246&r2=1392271&rev=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoConnection.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoConnection.java Mon Oct  1 10:40:12 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk;
+package org.apache.jackrabbit.mongomk.impl;
 
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
@@ -32,7 +32,7 @@ import com.mongodb.gridfs.GridFS;
  */
 public class MongoConnection {
 
-    private static final String COLLECTION_COMMIT = "commit";
+    private static final String COLLECTION_COMMITS = "commits";
     private static final String COLLECTION_HEAD = "head";
     private static final String COLLECTION_NODES = "nodes";
     private final DB db;
@@ -57,9 +57,8 @@ public class MongoConnection {
      * @return The commit {@link DBCollection}.
      */
     public DBCollection getCommitCollection() {
-        DBCollection commitCollection = db.getCollection(COLLECTION_COMMIT);
+        DBCollection commitCollection = db.getCollection(COLLECTION_COMMITS);
         commitCollection.setObjectClass(CommitMongo.class);
-
         return commitCollection;
     }
 
@@ -89,7 +88,6 @@ public class MongoConnection {
     public DBCollection getHeadCollection() {
         DBCollection headCollection = db.getCollection(COLLECTION_HEAD);
         headCollection.setObjectClass(HeadMongo.class);
-
         return headCollection;
     }
 
@@ -101,7 +99,6 @@ public class MongoConnection {
     public DBCollection getNodeCollection() {
         DBCollection nodeCollection = db.getCollection(COLLECTION_NODES);
         nodeCollection.setObjectClass(NodeMongo.class);
-
         return nodeCollection;
     }
-}
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java Mon Oct  1 10:40:12 2012
@@ -20,6 +20,7 @@ import java.io.InputStream;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
+import org.apache.jackrabbit.mk.util.NodeFilter;
 import org.apache.jackrabbit.mongomk.api.BlobStore;
 import org.apache.jackrabbit.mongomk.api.NodeStore;
 import org.apache.jackrabbit.mongomk.api.model.Commit;

Copied: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeStoreMongo.java (from r1392246, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/NodeStoreMongo.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeStoreMongo.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeStoreMongo.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/NodeStoreMongo.java&r1=1392246&r2=1392271&rev=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/NodeStoreMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeStoreMongo.java Mon Oct  1 10:40:12 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk;
+package org.apache.jackrabbit.mongomk.impl;
 
 import java.util.List;
 
@@ -60,29 +60,29 @@ public class NodeStoreMongo implements N
 
     @Override
     public String commit(Commit commit) throws Exception {
-        Command<String> command = new CommitCommandMongo(mongoConnection, commit);
-
-        return commandExecutor.execute(command);
+        Command<Long> command = new CommitCommandMongo(mongoConnection, commit);
+        Long revision = commandExecutor.execute(command);
+        return MongoUtil.fromMongoRepresentation(revision);
     }
 
     @Override
     public String getHeadRevision() throws Exception {
-        Command<String> command = new GetHeadRevisionCommandMongo(mongoConnection);
-
-        return commandExecutor.execute(command);
+        Long headRevision = commandExecutor.execute(new GetHeadRevisionCommandMongo(mongoConnection));
+        return MongoUtil.fromMongoRepresentation(headRevision);
     }
 
     @Override
     public Node getNodes(String path, String revisionId, int depth, long offset,
             int maxChildNodes, String filter) throws Exception {
-        Command<Node> command = new GetNodesCommandMongo(mongoConnection, path, revisionId, depth);
+        Command<Node> command = new GetNodesCommandMongo(mongoConnection, path,
+                MongoUtil.toMongoRepresentation(revisionId), depth);
         return commandExecutor.execute(command);
     }
 
     @Override
-    public boolean nodeExists(String path, String revId) throws Exception {
-        Command<Boolean> command = new NodeExistsCommandMongo(mongoConnection, path, revId);
-
+    public boolean nodeExists(String path, String revisionId) throws Exception {
+        Command<Boolean> command = new NodeExistsCommandMongo(mongoConnection, path,
+                MongoUtil.toMongoRepresentation(revisionId));
         return commandExecutor.execute(command);
     }
 
@@ -93,24 +93,28 @@ public class NodeStoreMongo implements N
 
         // FIXME [Mete] There's more work here.
 
+        Long fromRevision = MongoUtil.toMongoRepresentation(fromRevisionId);
+        Long toRevision = null;
         if (toRevisionId == null) {
             try {
-                toRevisionId = new GetHeadRevisionCommandMongo(mongoConnection).execute();
+                toRevision = new GetHeadRevisionCommandMongo(mongoConnection).execute();
             } catch (Exception e) {
                 // FIXME Handle
             }
+        } else {
+            toRevision = MongoUtil.toMongoRepresentation(toRevisionId);
         }
 
         List<CommitMongo> commits = new FetchValidCommitsQuery(mongoConnection,
-                fromRevisionId, toRevisionId).execute();
+                fromRevision, toRevision).execute();
 
-        CommitMongo toCommit = getCommit(commits, toRevisionId);
+        CommitMongo toCommit = getCommit(commits, toRevision);
 
         CommitMongo fromCommit;
-        if (toRevisionId.equals(fromRevisionId)) {
+        if (toRevision == fromRevision) {
             fromCommit = toCommit;
         } else {
-            fromCommit = getCommit(commits, fromRevisionId);
+            fromCommit = getCommit(commits, fromRevision);
             if (fromCommit == null || (fromCommit.getTimestamp() > toCommit.getTimestamp())) {
                 // negative range, return empty journal
                 return "[]";
@@ -129,7 +133,7 @@ public class NodeStoreMongo implements N
             // FIXME Check that filter really works.
             if (!filtered || commit.getAffectedPaths().contains(path)) {
                 commitBuff.object()
-                .key("id").value(String.valueOf(commit.getRevisionId()))
+                .key("id").value(MongoUtil.fromMongoRepresentation(commit.getRevisionId()))
                 .key("ts").value(commit.getTimestamp())
                 .key("msg").value(commit.getMessage())
                 .key("changes").value(diff).endObject();
@@ -138,15 +142,6 @@ public class NodeStoreMongo implements N
         return commitBuff.endArray().toString();
     }
 
-    private CommitMongo getCommit(List<CommitMongo> commits, String toRevisionId) {
-        for (CommitMongo commit : commits) {
-            if (String.valueOf(commit.getRevisionId()).equals(toRevisionId)) {
-                return commit;
-            }
-        }
-        return null;
-    }
-
     @Override
     public String getRevisionHistory(long since, int maxEntries, String path) {
       path = (path == null || "".equals(path)) ? "/" : path;
@@ -161,7 +156,7 @@ public class NodeStoreMongo implements N
               // FIXME [Mete] Check that filter really works.
               if (!filtered || commit.getAffectedPaths().contains(path)) {
                   buff.object()
-                  .key("id").value(String.valueOf(commit.getRevisionId()))
+                  .key("id").value(MongoUtil.fromMongoRepresentation(commit.getRevisionId()))
                   .key("ts").value(commit.getTimestamp())
                   .key("msg").value(commit.getMessage())
                   .endObject();
@@ -178,12 +173,12 @@ public class NodeStoreMongo implements N
         long initialHeadRevisionId = getHeadRevisionId();
 
         if (timeout <= 0) {
-            return String.valueOf(initialHeadRevisionId);
+            return MongoUtil.fromMongoRepresentation(initialHeadRevisionId);
         }
 
         long oldHeadRevision = MongoUtil.toMongoRepresentation(oldHeadRevisionId);
         if (oldHeadRevision < initialHeadRevisionId) {
-            return String.valueOf(initialHeadRevisionId);
+            return MongoUtil.fromMongoRepresentation(initialHeadRevisionId);
         }
 
         long waitForCommitPollMillis = Math.min(WAIT_FOR_COMMIT_POLL_MILLIS, timeout);
@@ -191,16 +186,27 @@ public class NodeStoreMongo implements N
             long headRevisionId = getHeadRevisionId();
             long now = System.currentTimeMillis();
             if (headRevisionId != initialHeadRevisionId || now - startTimestamp >= timeout) {
-                return String.valueOf(headRevisionId);
+                return MongoUtil.fromMongoRepresentation(headRevisionId);
             }
             Thread.sleep(waitForCommitPollMillis);
         }
     }
 
+    // FIXME - Consolidate with getHeadRevision
     private long getHeadRevisionId() {
         DBCollection headCollection = mongoConnection.getHeadCollection();
         HeadMongo headMongo = (HeadMongo)headCollection.findOne();
         long headRevisionId = headMongo.getHeadRevisionId();
         return headRevisionId;
     }
+
+    // FIXME - Move to a command.
+    private CommitMongo getCommit(List<CommitMongo> commits, Long revisionId) {
+        for (CommitMongo commit : commits) {
+            if (commit.getRevisionId() == revisionId) {
+                return commit;
+            }
+        }
+        return null;
+    }
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java Mon Oct  1 10:40:12 2012
@@ -23,6 +23,7 @@ import java.util.Map;
 import org.apache.jackrabbit.mongomk.api.model.Node;
 import org.apache.jackrabbit.mongomk.impl.json.JsonUtil;
 import org.apache.jackrabbit.mongomk.impl.model.NodeImpl;
+import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -95,7 +96,7 @@ public class NodeBuilder {
         }
 
         NodeImpl node = new NodeImpl(realPath);
-        node.setRevisionId(revisionId);
+        node.setRevisionId(MongoUtil.toMongoRepresentation(revisionId));
 
         Map<String, Object> properties = null;
         for (@SuppressWarnings("rawtypes")

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java Mon Oct  1 10:40:12 2012
@@ -22,8 +22,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.jackrabbit.mk.json.JsopBuilder;
+import org.apache.jackrabbit.mk.util.NodeFilter;
 import org.apache.jackrabbit.mongomk.api.model.Node;
-import org.apache.jackrabbit.mongomk.impl.NodeFilter;
 import org.json.JSONArray;
 import org.json.JSONObject;
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java Mon Oct  1 10:40:12 2012
@@ -37,7 +37,7 @@ public class CommitImpl implements Commi
     private final String message;
     private final String path;
     private final long timestamp;
-    private String revisionId;
+    private Long revisionId;
 
     /**
      * Constructs a new {@code CommitImpl}.
@@ -91,11 +91,11 @@ public class CommitImpl implements Commi
         return path;
     }
 
-    public String getRevisionId() {
+    public Long getRevisionId() {
         return revisionId;
     }
 
-    public void setRevisionId(String revisionId) {
+    public void setRevisionId(Long revisionId) {
         this.revisionId = revisionId;
     }
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java Mon Oct  1 10:40:12 2012
@@ -44,7 +44,7 @@ public class NodeImpl implements Node {
     private String name;
     private String path;
     private Map<String, Object> properties;
-    private String revisionId;
+    private Long revisionId;
 
     /**
      * Constructs a new {@code NodeImpl}.
@@ -209,12 +209,12 @@ public class NodeImpl implements Node {
     }
 
     @Override
-    public String getRevisionId() {
+    public Long getRevisionId() {
         return revisionId;
     }
 
     @Override
-    public void setRevisionId(String revisionId) {
+    public void setRevisionId(Long revisionId) {
         this.revisionId = revisionId;
     }
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitCommandInstructionVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitCommandInstructionVisitor.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitCommandInstructionVisitor.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitCommandInstructionVisitor.java Mon Oct  1 10:40:12 2012
@@ -21,9 +21,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Set;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
 import org.apache.jackrabbit.mongomk.api.model.Instruction.AddNodeInstruction;
 import org.apache.jackrabbit.mongomk.api.model.Instruction.AddPropertyInstruction;
 import org.apache.jackrabbit.mongomk.api.model.Instruction.CopyNodeInstruction;
@@ -31,6 +29,7 @@ import org.apache.jackrabbit.mongomk.api
 import org.apache.jackrabbit.mongomk.api.model.Instruction.RemoveNodeInstruction;
 import org.apache.jackrabbit.mongomk.api.model.Instruction.SetPropertyInstruction;
 import org.apache.jackrabbit.mongomk.api.model.InstructionVisitor;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.query.FetchNodeByPathQuery;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitMongo.java Mon Oct  1 10:40:12 2012
@@ -25,7 +25,6 @@ import java.util.Set;
 import org.apache.jackrabbit.mongomk.api.model.Commit;
 import org.apache.jackrabbit.mongomk.api.model.Instruction;
 import org.apache.jackrabbit.mongomk.api.model.Instruction.AddNodeInstruction;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 
 import com.mongodb.BasicDBObject;
@@ -60,7 +59,7 @@ public class CommitMongo extends BasicDB
         String diff = commit.getDiff();
         commitMongo.setDiff(diff);
 
-        String revisionId = commit.getRevisionId();
+        Long revisionId = commit.getRevisionId();
         if (revisionId != null) {
             commitMongo.setRevisionId(revisionId);
         }
@@ -141,10 +140,6 @@ public class CommitMongo extends BasicDB
         put(KEY_REVISION_ID, revisionId);
     }
 
-    public void setRevisionId(String revisionId) {
-        setRevisionId(MongoUtil.toMongoRepresentation(revisionId));
-    }
-
     public void setTimestamp(long timestamp) {
         put(KEY_TIMESTAMP, timestamp);
     }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/HeadMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/HeadMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/HeadMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/HeadMongo.java Mon Oct  1 10:40:12 2012
@@ -38,10 +38,6 @@ public class HeadMongo extends BasicDBOb
         return headMongo;
     }
 
-    public static long toDBRepresentation(String revisionId) {
-        return Long.valueOf(revisionId);
-    }
-
     public long getHeadRevisionId() {
         return getLong(KEY_HEAD_REVISION_ID);
     }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/NodeMongo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/NodeMongo.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/NodeMongo.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/NodeMongo.java Mon Oct  1 10:40:12 2012
@@ -27,7 +27,6 @@ import java.util.Set;
 
 import org.apache.jackrabbit.mongomk.api.model.Node;
 import org.apache.jackrabbit.mongomk.impl.model.NodeImpl;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 
 import com.mongodb.BasicDBObject;
@@ -61,7 +60,7 @@ public class NodeMongo extends BasicDBOb
         String path = node.getPath();
         nodeMongo.setPath(path);
 
-        String revisionId = node.getRevisionId();
+        Long revisionId = node.getRevisionId();
         if (revisionId != null) {
             nodeMongo.setRevisionId(revisionId);
         }
@@ -104,7 +103,6 @@ public class NodeMongo extends BasicDBOb
     }
 
     public static NodeImpl toNode(NodeMongo nodeMongo) {
-        String revisionId = String.valueOf(nodeMongo.getRevisionId());
         String path = nodeMongo.getPath();
         List<String> childNames = nodeMongo.getChildren();
         long childCount = childNames != null ? childNames.size() : 0;
@@ -119,6 +117,7 @@ public class NodeMongo extends BasicDBOb
             }
         }
 
+        Long revisionId = nodeMongo.getRevisionId();
         NodeImpl nodeImpl = new NodeImpl();
         nodeImpl.setPath(path);
         nodeImpl.setChildCount(childCount);
@@ -247,10 +246,6 @@ public class NodeMongo extends BasicDBOb
         put(KEY_REVISION_ID, revisionId);
     }
 
-    public void setRevisionId(String revisionId) {
-        this.setRevisionId(MongoUtil.toMongoRepresentation(revisionId));
-    }
-
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/AbstractQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/AbstractQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/AbstractQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/AbstractQuery.java Mon Oct  1 10:40:12 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mongomk.query;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 
 /**
  * An abstract base class for queries performed with {@code MongoDB}.

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java Mon Oct  1 10:40:12 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mongomk.query;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
 
 import com.mongodb.DBCollection;
@@ -31,8 +31,7 @@ public class FetchHeadQuery extends Abst
     /**
      * Constructs a new {@code FetchHeadQuery}.
      *
-     * @param mongoConnection
-     *            The {@link MongoConnection}.
+     * @param mongoConnection The {@link MongoConnection}.
      */
     public FetchHeadQuery(MongoConnection mongoConnection) {
         super(mongoConnection);
@@ -41,8 +40,6 @@ public class FetchHeadQuery extends Abst
     @Override
     public HeadMongo execute() throws Exception {
         DBCollection headCollection = mongoConnection.getHeadCollection();
-        HeadMongo headMongo = (HeadMongo) headCollection.findOne();
-
-        return headMongo;
+        return (HeadMongo)headCollection.findOne();
     }
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadRevisionQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadRevisionQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadRevisionQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadRevisionQuery.java Mon Oct  1 10:40:12 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mongomk.query;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
 
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodeByPathQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodeByPathQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodeByPathQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodeByPathQuery.java Mon Oct  1 10:40:12 2012
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.mongomk.qu
 
 import java.util.List;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
 
 import com.mongodb.DBCollection;
@@ -96,7 +96,8 @@ public class FetchNodeByPathQuery extend
         if (revisionId == 0) {
             return true;
         }
-        FetchValidRevisionsQuery query = new FetchValidRevisionsQuery(mongoConnection, String.valueOf(Long.MAX_VALUE));
+        FetchValidRevisionsQuery query = new FetchValidRevisionsQuery(mongoConnection,
+                Long.MAX_VALUE);
         List<Long> revisionIds = query.execute();
         return revisionIds.contains(revisionId);
     }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQuery.java Mon Oct  1 10:40:12 2012
@@ -19,9 +19,8 @@ package org.apache.jackrabbit.mongomk.qu
 import java.util.List;
 import java.util.regex.Pattern;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,21 +40,18 @@ public class FetchNodesByPathAndDepthQue
 
     private final int depth;
     private final String path;
-    private final String revisionId;
+    private final Long revisionId;
 
     /**
      * Constructs a new {@code FetchNodesByPathAndDepthQuery}.
      *
-     * @param mongoConnection
-     *            The {@link MongoConnection}.
-     * @param path
-     *            The path.
-     * @param revisionId
-     *            The revision id.
-     * @param depth
-     *            The depth.
+     * @param mongoConnection The {@link MongoConnection}.
+     * @param path The path.
+     * @param revisionId The revision id.
+     * @param depth The depth.
      */
-    public FetchNodesByPathAndDepthQuery(MongoConnection mongoConnection, String path, String revisionId, int depth) {
+    public FetchNodesByPathAndDepthQuery(MongoConnection mongoConnection, String path,
+            Long revisionId, int depth) {
         super(mongoConnection);
         this.path = path;
         this.revisionId = revisionId;
@@ -100,7 +96,7 @@ public class FetchNodesByPathAndDepthQue
         return pattern;
     }
 
-    private List<Long> fetchValidRevisions(MongoConnection mongoConnection, String revisionId) {
+    private List<Long> fetchValidRevisions(MongoConnection mongoConnection, Long revisionId) {
         return new FetchValidRevisionsQuery(mongoConnection, revisionId).execute();
     }
 
@@ -109,7 +105,7 @@ public class FetchNodesByPathAndDepthQue
 
         QueryBuilder qb = QueryBuilder.start(NodeMongo.KEY_PATH).regex(pattern);
         if (revisionId != null) {
-            qb = qb.and(NodeMongo.KEY_REVISION_ID).lessThanEquals(MongoUtil.toMongoRepresentation(revisionId));
+            qb = qb.and(NodeMongo.KEY_REVISION_ID).lessThanEquals(revisionId);
         }
 
         DBObject query = qb.get();

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQuery.java Mon Oct  1 10:40:12 2012
@@ -21,9 +21,8 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,19 +41,17 @@ public class FetchNodesForRevisionQuery 
     private static final Logger LOG = LoggerFactory.getLogger(FetchNodesForRevisionQuery.class);
 
     private final Set<String> paths;
-    private final String revisionId;
+    private final Long revisionId;
 
     /**
      * Constructs a new {@code FetchNodesForRevisionQuery}.
      *
-     * @param mongoConnection
-     *            The {@link MongoConnection}.
-     * @param paths
-     *            The paths to fetch.
-     * @param revisionId
-     *            The revision id.
+     * @param mongoConnection The {@link MongoConnection}.
+     * @param paths The paths to fetch.
+     * @param revisionId The revision id.
      */
-    public FetchNodesForRevisionQuery(MongoConnection mongoConnection, Set<String> paths, String revisionId) {
+    public FetchNodesForRevisionQuery(MongoConnection mongoConnection, Set<String> paths,
+            Long revisionId) {
         super(mongoConnection);
         this.paths = paths;
         this.revisionId = revisionId;
@@ -63,40 +60,31 @@ public class FetchNodesForRevisionQuery 
     /**
      * Constructs a new {@code FetchNodesForRevisionQuery}.
      *
-     * @param mongoConnection
-     *            The {@link MongoConnection}.
-     * @param paths
-     *            The paths to fetch.
-     * @param revisionId
-     *            The revision id.
+     * @param mongoConnection The {@link MongoConnection}.
+     * @param paths The paths to fetch.
+     * @param revisionId The revision id.
      */
-    public FetchNodesForRevisionQuery(MongoConnection mongoConnection, String[] paths, String revisionId) {
+    public FetchNodesForRevisionQuery(MongoConnection mongoConnection, String[] paths,
+            Long revisionId) {
         this(mongoConnection, new HashSet<String>(Arrays.asList(paths)), revisionId);
     }
 
     @Override
     public List<NodeMongo> execute() {
-        List<Long> validRevisions = fetchValidRevisions(mongoConnection, revisionId);
-
+        List<Long> validRevisions = new FetchValidRevisionsQuery(mongoConnection, revisionId).execute();
         DBCursor dbCursor = retrieveAllNodes();
         List<NodeMongo> nodes = QueryUtils.convertToNodes(dbCursor, validRevisions);
-
         return nodes;
     }
 
-    private List<Long> fetchValidRevisions(MongoConnection mongoConnection, String revisionId) {
-        return new FetchValidRevisionsQuery(mongoConnection, revisionId).execute();
-    }
-
     private DBCursor retrieveAllNodes() {
         DBCollection nodeCollection = mongoConnection.getNodeCollection();
-        DBObject query = QueryBuilder.start(NodeMongo.KEY_PATH).in(paths).and(NodeMongo.KEY_REVISION_ID)
-                .lessThanEquals(MongoUtil.toMongoRepresentation(revisionId)).get();
+        DBObject query = QueryBuilder.start(NodeMongo.KEY_PATH).in(paths)
+                .and(NodeMongo.KEY_REVISION_ID)
+                .lessThanEquals(revisionId).get();
 
         LOG.debug(String.format("Executing query: %s", query));
 
-        DBCursor dbCursor = nodeCollection.find(query);
-
-        return dbCursor;
+        return nodeCollection.find(query);
     }
-}
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQuery.java Mon Oct  1 10:40:12 2012
@@ -22,9 +22,8 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,8 +42,8 @@ public class FetchValidCommitsQuery exte
     private static final int LIMITLESS = 0;
     private static final Logger LOG = LoggerFactory.getLogger(FetchValidCommitsQuery.class);
 
-    private final String fromRevisionId;
-    private String toRevisionId;
+    private final Long fromRevisionId;
+    private Long toRevisionId;
     private int maxEntries = LIMITLESS;
 
     /**
@@ -53,8 +52,8 @@ public class FetchValidCommitsQuery exte
      * @param mongoConnection Mongo connection.
      * @param fromRevisionId From revision id.
      */
-    public FetchValidCommitsQuery(MongoConnection mongoConnection, String toRevisionId) {
-        this(mongoConnection, null, toRevisionId);
+    public FetchValidCommitsQuery(MongoConnection mongoConnection, Long toRevisionId) {
+        this(mongoConnection, 0L, toRevisionId);
     }
 
     /**
@@ -64,8 +63,8 @@ public class FetchValidCommitsQuery exte
      * @param fromRevisionId From revision id.
      * @param toRevisionId To revision id.
      */
-    public FetchValidCommitsQuery(MongoConnection mongoConnection, String fromRevisionId,
-            String toRevisionId) {
+    public FetchValidCommitsQuery(MongoConnection mongoConnection, Long fromRevisionId,
+            Long toRevisionId) {
         super(mongoConnection);
         this.fromRevisionId = fromRevisionId;
         this.toRevisionId = toRevisionId;
@@ -81,8 +80,8 @@ public class FetchValidCommitsQuery exte
      */
     public FetchValidCommitsQuery(MongoConnection mongoConnection, int maxEntries) {
         super(mongoConnection);
-        fromRevisionId = null;
-        toRevisionId = String.valueOf(Integer.MAX_VALUE);
+        fromRevisionId = 0L;
+        toRevisionId = Long.MAX_VALUE;
         this.maxEntries = maxEntries;
     }
 
@@ -106,7 +105,7 @@ public class FetchValidCommitsQuery exte
             return validCommits;
         }
 
-        Long currentRevision = MongoUtil.toMongoRepresentation(toRevisionId);
+        Long currentRevision = toRevisionId;
         if (!revisions.containsKey(currentRevision)) {
             currentRevision = Collections.max(revisions.keySet());
         }
@@ -118,11 +117,9 @@ public class FetchValidCommitsQuery exte
             }
             validCommits.add(commitMongo);
             Long baseRevision = commitMongo.getBaseRevisionId();
-            Long fromRevision = MongoUtil.toMongoRepresentation(fromRevisionId);
-            if ((currentRevision == 0L) || (baseRevision == null || baseRevision < fromRevision)) {
+            if ((currentRevision == 0L) || (baseRevision == null || baseRevision < fromRevisionId)) {
                 break;
             }
-
             currentRevision = baseRevision;
         }
 
@@ -134,7 +131,7 @@ public class FetchValidCommitsQuery exte
     private DBCursor fetchListOfValidCommits() {
         DBCollection commitCollection = mongoConnection.getCommitCollection();
         DBObject query = QueryBuilder.start(CommitMongo.KEY_FAILED).notEquals(Boolean.TRUE)
-                .and(CommitMongo.KEY_REVISION_ID).lessThanEquals(MongoUtil.toMongoRepresentation(toRevisionId))
+                .and(CommitMongo.KEY_REVISION_ID).lessThanEquals(toRevisionId)
                 .get();
 
         LOG.debug(String.format("Executing query: %s", query));

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidRevisionsQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidRevisionsQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidRevisionsQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidRevisionsQuery.java Mon Oct  1 10:40:12 2012
@@ -19,10 +19,9 @@ package org.apache.jackrabbit.mongomk.qu
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 
-
 /**
  * An query for fetching valid revisions.
  *
@@ -30,24 +29,22 @@ import org.apache.jackrabbit.mongomk.mod
  */
 public class FetchValidRevisionsQuery extends AbstractQuery<List<Long>> {
 
-    private final String maxRevisionId;
+    private final Long maxRevisionId;
 
     /**
      * Constructs a new {@code FetchValidRevisionsQuery}.
      *
-     * @param mongoConnection
-     *            The {@link MongoConnection}.
-     * @param maxRevisionId
-     *            The max revision id which should be fetched.
+     * @param mongoConnection The {@link MongoConnection}.
+     * @param maxRevisionId The max revision id which should be fetched.
      */
-    public FetchValidRevisionsQuery(MongoConnection mongoConnection, String maxRevisionId) {
+    public FetchValidRevisionsQuery(MongoConnection mongoConnection, Long maxRevisionId) {
         super(mongoConnection);
         this.maxRevisionId = maxRevisionId;
     }
 
     @Override
     public List<Long> execute() {
-        List<CommitMongo> validCommits = fetchValidCommits();
+        List<CommitMongo> validCommits = new FetchValidCommitsQuery(mongoConnection, maxRevisionId).execute();
         List<Long> validRevisions = new ArrayList<Long>(validCommits.size());
         for (CommitMongo commitMongo : validCommits) {
             validRevisions.add(commitMongo.getRevisionId());
@@ -55,8 +52,4 @@ public class FetchValidRevisionsQuery ex
 
         return validRevisions;
     }
-
-    private List<CommitMongo> fetchValidCommits() {
-        return new FetchValidCommitsQuery(mongoConnection, maxRevisionId).execute();
-    }
-}
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/ReadAndIncHeadRevisionQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/ReadAndIncHeadRevisionQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/ReadAndIncHeadRevisionQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/ReadAndIncHeadRevisionQuery.java Mon Oct  1 10:40:12 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mongomk.query;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
 
 import com.mongodb.BasicDBObject;
@@ -43,7 +43,7 @@ public class ReadAndIncHeadRevisionQuery
     @Override
     public HeadMongo execute() throws Exception {
         DBObject query = new BasicDBObject();
-        DBObject inc = new BasicDBObject(HeadMongo.KEY_NEXT_REVISION_ID, Long.valueOf(1));
+        DBObject inc = new BasicDBObject(HeadMongo.KEY_NEXT_REVISION_ID, 1L);
         DBObject update = new BasicDBObject("$inc", inc);
         DBCollection headCollection = mongoConnection.getHeadCollection();
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveAndSetHeadRevisionQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveAndSetHeadRevisionQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveAndSetHeadRevisionQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveAndSetHeadRevisionQuery.java Mon Oct  1 10:40:12 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mongomk.query;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
 
 import com.mongodb.BasicDBObject;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveCommitQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveCommitQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveCommitQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveCommitQuery.java Mon Oct  1 10:40:12 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mongomk.query;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 
 import com.mongodb.DBCollection;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveNodesQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveNodesQuery.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveNodesQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveNodesQuery.java Mon Oct  1 10:40:12 2012
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.mongomk.qu
 
 import java.util.Collection;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
 
 import com.mongodb.DBCollection;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/MongoUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/MongoUtil.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/MongoUtil.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/MongoUtil.java Mon Oct  1 10:40:12 2012
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.mongomk.ut
 
 import java.util.Arrays;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
@@ -63,7 +63,7 @@ public class MongoUtil {
     public static void initCommitCollection(MongoConnection mongoConnection) {
         DBCollection commitCollection = mongoConnection.getCommitCollection();
         DBObject index = new BasicDBObject();
-        index.put(CommitMongo.KEY_REVISION_ID, Long.valueOf(1));
+        index.put(CommitMongo.KEY_REVISION_ID, 1L);
         DBObject options = new BasicDBObject();
         options.put("unique", Boolean.TRUE);
         commitCollection.ensureIndex(index, options);
@@ -96,8 +96,8 @@ public class MongoUtil {
     public static void initNodeCollection(MongoConnection mongoConnection) {
         DBCollection nodeCollection = mongoConnection.getNodeCollection();
         DBObject index = new BasicDBObject();
-        index.put(NodeMongo.KEY_PATH, Long.valueOf(1));
-        index.put(NodeMongo.KEY_REVISION_ID, Long.valueOf(1));
+        index.put(NodeMongo.KEY_PATH, 1L);
+        index.put(NodeMongo.KEY_REVISION_ID, 1L);
         DBObject options = new BasicDBObject();
         options.put("unique", Boolean.TRUE);
         nodeCollection.ensureIndex(index, options);
@@ -107,7 +107,11 @@ public class MongoUtil {
         nodeCollection.insert(root);
     }
 
+    public static String fromMongoRepresentation(Long revisionId) {
+        return String.valueOf(revisionId);
+    }
+
     public static Long toMongoRepresentation(String revisionId) {
-        return revisionId != null? Long.parseLong(revisionId) : 0L;
+        return revisionId != null? Long.parseLong(revisionId) : null;
     }
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BaseMongoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BaseMongoTest.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BaseMongoTest.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BaseMongoTest.java Mon Oct  1 10:40:12 2012
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.mongomk;
 import java.io.InputStream;
 import java.util.Properties;
 
-import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.junit.After;
 import org.junit.AfterClass;

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java?rev=1392271&r1=1392270&r2=1392271&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java Mon Oct  1 10:40:12 2012
@@ -24,10 +24,10 @@ import java.util.Set;
 
 import org.apache.jackrabbit.mongomk.api.model.Commit;
 import org.apache.jackrabbit.mongomk.api.model.Node;
+import org.apache.jackrabbit.mongomk.impl.MongoConnection;
 import org.apache.jackrabbit.mongomk.model.CommitMongo;
 import org.apache.jackrabbit.mongomk.model.HeadMongo;
 import org.apache.jackrabbit.mongomk.model.NodeMongo;
-import org.apache.jackrabbit.mongomk.util.MongoUtil;
 import org.junit.Assert;
 
 import com.mongodb.DBCollection;
@@ -44,10 +44,10 @@ public class MongoAssert {
 
     private static MongoConnection mongoConnection;
 
-    public static void assertCommitContainsAffectedPaths(String revisionId, String... expectedPaths) {
+    public static void assertCommitContainsAffectedPaths(Long revisionId, String... expectedPaths) {
         DBCollection commitCollection = mongoConnection.getCommitCollection();
         DBObject query = QueryBuilder.start(CommitMongo.KEY_REVISION_ID)
-                .is(MongoUtil.toMongoRepresentation(revisionId)).get();
+                .is(revisionId).get();
         CommitMongo result = (CommitMongo) commitCollection.findOne(query);
         Assert.assertNotNull(result);
 
@@ -58,7 +58,7 @@ public class MongoAssert {
     public static void assertCommitExists(Commit commit) {
         DBCollection commitCollection = mongoConnection.getCommitCollection();
         DBObject query = QueryBuilder.start(CommitMongo.KEY_REVISION_ID)
-                .is(MongoUtil.toMongoRepresentation(commit.getRevisionId())).and(CommitMongo.KEY_MESSAGE)
+                .is(commit.getRevisionId()).and(CommitMongo.KEY_MESSAGE)
                 .is(commit.getMessage()).and(CommitMongo.KEY_DIFF).is(commit.getDiff()).and(CommitMongo.KEY_PATH)
                 .is(commit.getPath()).and(CommitMongo.KEY_FAILED).notEquals(Boolean.TRUE).get();
         CommitMongo result = (CommitMongo) commitCollection.findOne(query);
@@ -77,10 +77,10 @@ public class MongoAssert {
         Assert.assertEquals(revisionId, result.getNextRevisionId());
     }
 
-    public static void assertNodeRevisionId(String path, String revisionId, boolean exists) {
+    public static void assertNodeRevisionId(String path, Long revisionId, boolean exists) {
         DBCollection nodeCollection = mongoConnection.getNodeCollection();
         DBObject query = QueryBuilder.start(NodeMongo.KEY_PATH).is(path).and(NodeMongo.KEY_REVISION_ID)
-                .is(MongoUtil.toMongoRepresentation(revisionId)).get();
+                .is(revisionId).get();
         NodeMongo nodeMongo = (NodeMongo) nodeCollection.findOne(query);
 
         if (exists) {
@@ -90,10 +90,11 @@ public class MongoAssert {
         }
     }
 
-    public static void assertNodesExist(String parentPath, Node expected) {
+    public static void assertNodesExist(Node expected) {
         DBCollection nodeCollection = mongoConnection.getNodeCollection();
-        QueryBuilder qb = QueryBuilder.start(NodeMongo.KEY_PATH).is(expected.getPath()).and(NodeMongo.KEY_REVISION_ID)
-                .is(MongoUtil.toMongoRepresentation(expected.getRevisionId()));
+        QueryBuilder qb = QueryBuilder.start(NodeMongo.KEY_PATH).is(expected.getPath())
+                .and(NodeMongo.KEY_REVISION_ID)
+                .is(expected.getRevisionId());
         Map<String, Object> properties = expected.getProperties();
         if (properties != null) {
             for (Map.Entry<String, Object> entry : properties.entrySet()) {
@@ -113,7 +114,7 @@ public class MongoAssert {
             Assert.assertEquals(children.size(), childNames.size());
             Assert.assertEquals(children.size(), new HashSet<String>(childNames).size());
             for (Node child : children) {
-                assertNodesExist(expected.getPath(), child);
+                assertNodesExist(child);
                 Assert.assertTrue(childNames.contains(child.getName()));
             }
         } else {



Mime
View raw message