jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1386591 [1/7] - in /jackrabbit/oak/trunk: ./ oak-mongomk-api/ oak-mongomk-api/src/ oak-mongomk-api/src/main/ oak-mongomk-api/src/main/java/ oak-mongomk-api/src/main/java/org/ oak-mongomk-api/src/main/java/org/apache/ oak-mongomk-api/src/ma...
Date Mon, 17 Sep 2012 12:54:06 GMT
Author: jukka
Date: Mon Sep 17 12:54:01 2012
New Revision: 1386591

URL: http://svn.apache.org/viewvc?rev=1386591&view=rev
Log:
OAK-293: MongoDB-based MicroKernel

Contributed by Philipp Marx.

Added:
    jackrabbit/oak/trunk/oak-mongomk/
    jackrabbit/oak/trunk/oak-mongomk-api/
    jackrabbit/oak/trunk/oak-mongomk-api/pom.xml   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/
    jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddNodeInstructionImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddPropertyInstructionImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CopyNodeInstructionImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MoveNodeInstructionImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/RemoveNodeInstructionImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/SetPropertyInstructionImpl.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/CommitBuilderImplTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/NodeBuilderTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/InstructionAssert.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/NodeAssert.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/json/
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/
    jackrabbit/oak/trunk/oak-mongomk-perf/pom.xml   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/BlobStoreFS.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/Config.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/MicroKernelPerf.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/MicroKernelPerfClient.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/MicroKernelPerfMaster.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/PrepareEnvironment.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/perf/RandomJsopGenerator.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/performance/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/performance/write/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/performance/write/MultipleMksWriteNodesTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/performance/write/MultipleNodesTestBase.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/performance/write/TestUtil.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/java/org/apache/jackrabbit/mongomk/performance/write/WriteNodesTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/resources/
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/resources/config.cfg
    jackrabbit/oak/trunk/oak-mongomk-perf/src/main/resources/log4j.cfg
    jackrabbit/oak/trunk/oak-mongomk-test/
    jackrabbit/oak/trunk/oak-mongomk-test/pom.xml   (with props)
    jackrabbit/oak/trunk/oak-mongomk-test/src/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/test/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/test/it/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/test/it/MongoDataStoreIT.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/test/it/MongoEverythingIT.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/test/it/MongoMicroKernelFixture.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/java/org/apache/jackrabbit/mongomk/test/it/MongoMicroKernelIT.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/resources/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/resources/META-INF/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/resources/META-INF/services/
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/resources/META-INF/services/org.apache.jackrabbit.mk.test.MicroKernelFixture
    jackrabbit/oak/trunk/oak-mongomk-test/src/test/resources/config.cfg
    jackrabbit/oak/trunk/oak-mongomk/pom.xml   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/
    jackrabbit/oak/trunk/oak-mongomk/src/main/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/BlobStoreMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/MongoConnection.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/NodeStoreMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ConflictingCommitException.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitCommandInstructionVisitor.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/CommitMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/HeadMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/model/NodeMongo.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/AbstractQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadRevisionQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodeByPathQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchValidRevisionsQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/QueryUtils.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/ReadAndIncHeadRevisionQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveAndSetHeadRevisionQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveCommitQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/SaveNodesQuery.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/util/MongoUtil.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/com/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/com/mongodb/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/com/mongodb/DBCollection.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BaseMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/CommitCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/ConcurrentCommitCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetHeadRevisionCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetNodesCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/ReadBlobCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/WriteBlobCommandMongoTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/FetchNodesByPathAndDepthQueryTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/FetchNodesForRevisionQueryTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/query/FetchValidCommitsQueryTest.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/scenario/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/scenario/SimpleNodeScenario.java   (with props)
    jackrabbit/oak/trunk/oak-mongomk/src/test/resources/
    jackrabbit/oak/trunk/oak-mongomk/src/test/resources/config.cfg
Modified:
    jackrabbit/oak/trunk/pom.xml

Added: jackrabbit/oak/trunk/oak-mongomk-api/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/pom.xml?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/pom.xml (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/pom.xml Mon Sep 17 12:54:01 2012
@@ -0,0 +1,42 @@
+<?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.jackrabbit</groupId>
+    <artifactId>oak-parent</artifactId>
+    <version>0.5-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>oak-mongomk-api</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>oak-mk</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,73 @@
+/*
+ * 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.jackrabbit.mongomk.api;
+
+import java.io.InputStream;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+
+/**
+ * The <code>BlobStore</code> interface deals with all blob related operations of the {@link MicroKernel}.
+ *
+ * <p>
+ * Since binary storage and node storage most likely use different backend technologies two separate interfaces for
+ * these operations are provided.
+ * </p>
+ *
+ * <p>
+ * This interface is not only a partly {@code MicroKernel} but also provides a different layer of abstraction by
+ * converting the {@link String} parameters into higher level objects to ease the development for implementors of the
+ * {@code MicroKernel}.
+ * </p>
+ *
+ * @see NodeStore
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface BlobStore {
+
+    /**
+     * @see MicroKernel#getLength(String)
+     *
+     * @param blobId The id of the blob.
+     * @return The length in bytes.
+     * @throws Exception If an error occurred while getting the blob lenght.
+     */
+    long getBlobLength(String blobId) throws Exception;
+
+    /**
+     * @see MicroKernel#read(String, long, byte[], int, int)
+     *
+     * @param blobId The id of the blob.
+     * @param blobOffset The offset to read from.
+     * @param buffer The buffer to read the binary data into.
+     * @param bufferOffset The offset to read into the buffer.
+     * @param length The length of the data to read.
+     * @return The actual number of bytes which were read.
+     * @throws Exception If an error occurred while reading the blob data.
+     */
+    int readBlob(String blobId, long blobOffset, byte[] buffer, int bufferOffset, int length) throws Exception;
+
+    /**
+     * @see MicroKernel#write(InputStream)
+     *
+     * @param is The {@link InputStream} containing the data which should be written.
+     * @return The id of the blob.
+     * @throws Exception If an error occurred while writing the data.
+     */
+    String writeBlob(InputStream is) throws Exception;
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java Mon Sep 17 12:54:01 2012
@@ -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.jackrabbit.mongomk.api;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mongomk.api.model.Commit;
+import org.apache.jackrabbit.mongomk.api.model.Node;
+
+/**
+ * The <code>NodeStore</code> interface deals with all node related operations of the {@link MicroKernel}.
+ *
+ * <p>
+ * Since binary storage and node storage most likely use different backend technologies two separate interfaces for
+ * these operations are provided.
+ * </p>
+ *
+ * <p>
+ * This interface is not only a partly {@code MicroKernel} but also provides a different layer of abstraction by
+ * converting the {@link String} parameters into higher level objects to ease the development for implementors of the
+ * {@code MicroKernel}.
+ * </p>
+ *
+ * @see BlobStore
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface NodeStore {
+
+    /**
+     * @see MicroKernel#commit(String, String, String, String)
+     *
+     * @param commit The {@link Commit} object to store in the backend.
+     * @return The revision id of this commit.
+     * @throws Exception If an error occurred while committing.
+     */
+    String commit(Commit commit) throws Exception;
+
+    /**
+     * @see MicroKernel#getHeadRevision()
+     *
+     * @return The revision id of the head revision.
+     * @throws Exception If an error occurred while retrieving the head revision.
+     */
+    String getHeadRevision() throws Exception;
+
+    /**
+     * @see MicroKernel#getJournal(String, String, String)
+     *
+     * @param fromRevisionId id of first revision to be returned in journal
+     * @param toRevisionId id of last revision to be returned in journal,
+     * if {@code null} the current head revision is assumed
+     * @param path optional path filter; if {@code null} or {@code ""}
+     * the default ({@code "/"}) will be assumed, i.e. no filter will be applied
+     * @return a chronological list of revisions in JSON format
+     */
+    String getJournal(String fromRevisionId, String toRevisionId, String path);
+
+    /**
+     * @see MicroKernel#getRevisionHistory(long, int, String)
+     *
+     * @param since timestamp (ms) of earliest revision to be returned
+     * @param maxEntries maximum #entries to be returned; if < 0, no limit will be applied.
+     * @param path optional path filter; if {@code null} or {@code ""} the default
+     *  ({@code "/"}) will be assumed, i.e. no filter will be applied
+     * @return a list of revisions in chronological order in JSON format.
+     */
+    String getRevisionHistory(long since, int maxEntries, String path);
+
+    /**
+     * @see MicroKernel#getNodes(String, String, int, long, int, String)
+     *
+     * @param path The path of the root of nodes to retrieve.
+     * @param revisionId The revision id of the nodes or {@code null} if the latest head revision
+     * should be retrieved.
+     * @param depth The maximum depth of the retrieved node tree or -1 to retrieve all nodes.
+     * @param offset The offset of the child list to retrieve.
+     * @param maxChildNodes The count of children to retrieve or -1 to retrieve all children.
+     * @param filter An optional filter for the retrieved nodes.
+     * @return The {@link Node} of the root node.
+     * @throws Exception If an error occurred while retrieving the nodes.
+     */
+    Node getNodes(String path, String revisionId, int depth, long offset, int maxChildNodes,
+            String filter) throws Exception;
+
+    /**
+     * @see MicroKernel#nodeExists(String, String)
+     *
+     * @param path The path of the node to test.
+     * @param revisionId The revision id of the node or {@code null} for the head revision.
+     * @return {@code true} if the node for the specific revision exists else {@code false}.
+     * @throws Exception If an error occurred while testing the node.
+     */
+    boolean nodeExists(String path, String revisionId) throws Exception;
+
+    /**
+     * @see MicroKernel#waitForCommit(String, long)
+     *
+     * @param oldHeadRevisionId id of earlier head revision
+     * @param timeout the maximum time to wait in milliseconds
+     * @return the id of the head revision
+     * @throws InterruptedException if the thread was interrupted
+     */
+    String waitForCommit(String oldHeadRevisionId, long timeout) throws InterruptedException;
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,42 @@
+/*
+ * 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.jackrabbit.mongomk.api.command;
+
+/**
+ * Base implementation of {@link Command}.
+ *
+ * @param <T> The result type of the {@code Command}.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public abstract class AbstractCommand<T> implements Command<T> {
+
+    @Override
+    public int getNumOfRetries() {
+        return 0;
+    }
+
+    @Override
+    public boolean needsRetry(Exception e) {
+        return false;
+    }
+
+    @Override
+    public boolean needsRetry(T result) {
+        return false;
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,92 @@
+/*
+ * 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.jackrabbit.mongomk.api.command;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+
+/**
+ * The {@code Command} framework provides an way to encapsulate specific actions of the {@link MicroKernel}.
+ *
+ * <p>
+ * It adds some functionality for retries and other non business logic related actions (i.e. logging, performance
+ * tracking, etc).
+ * </p>
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/Command_pattern">Command Pattern</a>
+ * @see CommandExecutor
+ *
+ * @param <T>
+ *            The result type of the {@code Command}.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface Command<T> {
+
+    // TODO Add postExecute and preExecute; Maybe add AOP but only if Granite moves to OSGi 4.3
+
+    /**
+     * Executes the {@code Command} and returns its result.
+     *
+     * @return The result.
+     * @throws Exception
+     *             If an error occurred while executing.
+     */
+    T execute() throws Exception;
+
+    /**
+     * Returns the number of retries this {@code Command} should be retried in case of an error or false result.
+     *
+     * <p>
+     * The number of reties is evaluated in the following way:
+     * <li>n < 0: Unlimited retries</li>
+     * <li>n = 0: No retries (just one execution)</li>
+     * <li>n > 0: Corresponding number of retries</li>
+     * </p>
+     *
+     * <p>
+     * In order to determine whether the {@code Command} should be retired on of {@link #needsRetry(Exception)} or
+     * {@link #needsRetry(Object)} will be called.
+     * </p>
+     *
+     * @see #needsRetry(Exception)
+     * @see #needsRetry(Object)
+     *
+     * @return The number of retries.
+     */
+    int getNumOfRetries();
+
+    /**
+     * Will be called in case of an {@link Exception} during the execution and a given number of retries which has not
+     * exceeded.
+     *
+     * @param e The Exception which was thrown.
+     * @return {@code true} if a retry should be performed, else {@code false}.
+     */
+    boolean needsRetry(Exception e);
+
+    /**
+     * Will be called in case of a successful execution and a given number of retries which has not exceeded.
+     *
+     * <p>
+     * This gives the implementor a chance to retry a false result.
+     * </p>
+     *
+     * @param result The result of the execution.
+     * @return {@code true} if a retry should be performed, else {@code false}.
+     */
+    boolean needsRetry(T result);
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,45 @@
+/*
+ * 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.jackrabbit.mongomk.api.command;
+
+/**
+ * The executor part of the <a href="http://en.wikipedia.org/wiki/Command_pattern">Command Pattern</a>.
+ *
+ * <p>
+ * The implementation of this class contains the business logic to execute a command.
+ * </p>
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/Command_pattern">Command Pattern</a>
+ * @see Command
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface CommandExecutor {
+
+    /**
+     * Executes the given {@link Command} and returns the result.
+     *
+     * <p>
+     * If an retry behavior is specified this will be taken care of by the implementation as well.
+     * </p>
+     *
+     * @param command
+     * @return The result of the execution.
+     * @throws Exception If an error occurred while executing.
+     */
+    <T> T execute(Command<T> command) throws Exception;
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,84 @@
+/*
+ * 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.jackrabbit.mongomk.api.model;
+
+import java.util.List;
+
+/**
+ * A higher level object representing a commit.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface Commit {
+
+    /**
+     * Returns the <a href="http://wiki.apache.org/jackrabbit/Jsop">JSOP</a> diff of this commit.
+     *
+     * @return The {@link String} representing the diff.
+     */
+    String getDiff();
+
+    /**
+     * Returns the {@link List} of {@link Instruction}s which were created from the diff.
+     *
+     * @see #getDiff()
+     *
+     * @return The {@link List} of {@link Instruction}s.
+     */
+    List<Instruction> getInstructions();
+
+    /**
+     * Returns the message of the commit.
+     *
+     * @return The message.
+     */
+    String getMessage();
+
+    /**
+     * Returns the path of the root node of this commit.
+     *
+     * @return The path of the root node.
+     */
+    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.
+     *
+     * @see #setRevisionId(String)
+     *
+     * @return The revision id of this commit or {@code null}.
+     */
+    String getRevisionId();
+
+    /**
+     * Sets the revision id of this commit.
+     *
+     * @see #getRevisionId()
+     *
+     * @param revisionId The revision id to set.
+     */
+    void setRevisionId(String revisionId);
+
+
+    /**
+     * Returns the timestamp of this commit.
+     *
+     * @return The timestamp of this commit.
+     */
+    long getTimestamp();
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,143 @@
+/*
+ * 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.jackrabbit.mongomk.api.model;
+
+/**
+ * An {@code Instruction} is an abstraction of a single <a href="http://wiki.apache.org/jackrabbit/Jsop">JSOP</a>
+ * operation.
+ *
+ * <p>
+ * Each operation is a concrete subinterface of {@code Instruction} and extending it by the specific properties of the
+ * operation. There is no exact 1 : 1 mapping between a {@code JSOP} operation and a subinterface, i.e. in {@code JSOP}
+ * there is one add operation for adding nodes and properties whereas there are two specific subinterfaces; one for
+ * adding a node and one for adding a property.
+ * </p>
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface Instruction {
+
+    /**
+     * Accepts an {@code InstructionVisitor}.
+     *
+     * @param visitor The visitor.
+     */
+    void accept(InstructionVisitor visitor);
+
+    /**
+     * Returns the path of this {@code Instruction}.
+     *
+     * <p>
+     * The semantics of this property differ depending on the concrete subinterface.
+     * </p>
+     *
+     * @return The path.
+     */
+    String getPath();
+
+    /**
+     * The add node operation => "+" STRING ":" (OBJECT).
+     */
+    public interface AddNodeInstruction extends Instruction {
+    }
+
+    /**
+     * The add property operation => "+" STRING ":" (ATOM | ARRAY)
+     */
+    public interface AddPropertyInstruction extends Instruction {
+
+        /**
+         * Returns the key of the property to add.
+         *
+         * @return The key.
+         */
+        String getKey();
+
+        /**
+         * Returns the value of the property to add.
+         *
+         * @return The value.
+         */
+        Object getValue();
+    }
+
+    /**
+     * The copy node operation => "*" STRING ":" STRING
+     */
+    public interface CopyNodeInstruction extends Instruction {
+
+        /**
+         * Returns the destination path.
+         *
+         * @return the destination path.
+         */
+        String getDestPath();
+
+        /**
+         * Returns the source path.
+         *
+         * @return the source path.
+         */
+        String getSourcePath();
+    }
+
+    /**
+     * The move node operation => ">" STRING ":" STRING
+     */
+    public interface MoveNodeInstruction extends Instruction {
+
+        /**
+         * Returns the destination path.
+         *
+         * @return the destination path.
+         */
+        String getDestPath();
+
+        /**
+         * Returns the source path.
+         *
+         * @return the source path.
+         */
+        String getSourcePath();
+    }
+
+    /**
+     * The remove node operation => "-" STRING
+     */
+    public interface RemoveNodeInstruction extends Instruction {
+    }
+
+    /**
+     * The set property operation => "^" STRING ":" ATOM | ARRAY
+     */
+    public interface SetPropertyInstruction extends Instruction {
+
+        /**
+         * Returns the key of the property to set.
+         *
+         * @return The key.
+         */
+        String getKey();
+
+        /**
+         * Returns the value of the property to set.
+         *
+         * @return The value.
+         */
+        Object getValue();
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,74 @@
+/*
+ * 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.jackrabbit.mongomk.api.model;
+
+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;
+import org.apache.jackrabbit.mongomk.api.model.Instruction.MoveNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.model.Instruction.RemoveNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.model.Instruction.SetPropertyInstruction;
+
+/**
+ * A <a href="http://en.wikipedia.org/wiki/Visitor_pattern">Visitor</a> to iterate through a list of
+ * {@code Instruction}s without the need to use {@code instanceof} on each item.
+ */
+public interface InstructionVisitor {
+
+    /**
+     * Visits a {@code AddNodeInstruction}.
+     *
+     * @param instruction
+     *            The instruction.
+     */
+    void visit(AddNodeInstruction instruction);
+
+    /**
+     * Visits a {@code AddPropertyInstruction}.
+     *
+     * @param instruction The instruction.
+     */
+    void visit(AddPropertyInstruction instruction);
+
+    /**
+     * Visits a {@code CopyNodeInstruction}.
+     *
+     * @param instruction The instruction.
+     */
+    void visit(CopyNodeInstruction instruction);
+
+    /**
+     * Visits a {@code MoveNodeInstruction}.
+     *
+     * @param instruction The instruction.
+     */
+    void visit(MoveNodeInstruction instruction);
+
+    /**
+     * Visits a {@code RemoveNodeInstruction}.
+     *
+     * @param instruction The instruction.
+     */
+    void visit(RemoveNodeInstruction instruction);
+
+    /**
+     * Visits a {@code SetPropertyInstruction}.
+     *
+     * @param instruction The instruction.
+     */
+    void visit(SetPropertyInstruction instruction);
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,100 @@
+/*
+ * 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.jackrabbit.mongomk.api.model;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A higher level object representing a node.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public interface Node {
+
+    /**
+     * Returns the total number of children of this node.
+     *
+     * <p>
+     * <strong>This is not necessarily equal to the number of children returned by {@link #getChildren()} since this
+     * {@code Node} might be created with only a subset of children.</strong>
+     * </p>
+     *
+     * @return The total number of children.
+     */
+    long getChildCount();
+
+    /**
+     * Returns the children this {@code Node} was created with.
+     *
+     * @return The children.
+     */
+    Set<Node> getChildren(); // TODO Replace Set with Collection
+
+    // TODO - [Mete] Document.
+    Iterator<Node> getChildEntries(int offset, int count);
+
+    /**
+     * Returns the descendants (children, children of the children, etc) this {@code Node} was created with.
+     *
+     * @param includeThis Flag indicating whether this {@code Node} should be included in the list.
+     * @return The descendants.
+     */
+    Set<Node> getDescendants(boolean includeThis);
+
+    /**
+     * Returns the name of this {@code Node}.
+     *
+     * @return The name.
+     */
+    String getName();
+
+    /**
+     * Returns the path of this {@code Node}.
+     *
+     * @return The path.
+     */
+    String getPath();
+
+    /**
+     * Returns the properties this {@code Node} was created with.
+     *
+     * @return The properties.
+     */
+    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.
+     *
+     * @see #setRevisionId(String)
+     *
+     * @return The revision id of this commit or {@code null}.
+     */
+    String getRevisionId();
+
+    /**
+     * Sets the revision id of this node.
+     *
+     * @see #getRevisionId()
+     *
+     * @param revisionId The revision id to set.
+     */
+    void setRevisionId(String revisionId);
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml Mon Sep 17 12:54:01 2012
@@ -0,0 +1,73 @@
+<?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.jackrabbit</groupId>
+    <artifactId>oak-parent</artifactId>
+    <version>0.5-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>oak-mongomk-impl</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>oak-mk</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.json</groupId>
+      <artifactId>json</artifactId>
+      <version>20090211</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>oak-mongomk-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,213 @@
+/*
+ * 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.jackrabbit.mongomk.impl;
+
+import java.io.InputStream;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.api.MicroKernelException;
+import org.apache.jackrabbit.mongomk.api.BlobStore;
+import org.apache.jackrabbit.mongomk.api.NodeStore;
+import org.apache.jackrabbit.mongomk.api.model.Commit;
+import org.apache.jackrabbit.mongomk.api.model.Node;
+import org.apache.jackrabbit.mongomk.impl.builder.CommitBuilder;
+import org.apache.jackrabbit.mongomk.impl.json.JsonUtil;
+
+/**
+ * The {@code MongoDB} implementation of the {@link MicroKernel}.
+ *
+ * <p>
+ * This class will transform and delegate to instances of {@link NodeStore} and {@link BlobStore}.
+ * </p>
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public class MongoMicroKernel implements MicroKernel {
+
+    private final BlobStore blobStore;
+    private final NodeStore nodeStore;
+
+    /**
+     * Constructs a new {@code MongoMicroKernel}.
+     *
+     * @param nodeStore The {@link NodeStore}.
+     * @param blobStore The {@link BlobStore}.
+     */
+    public MongoMicroKernel(NodeStore nodeStore, BlobStore blobStore) {
+        this.nodeStore = nodeStore;
+        this.blobStore = blobStore;
+    }
+
+    @Override
+    public String branch(String trunkRevisionId) throws MicroKernelException {
+        throw new UnsupportedOperationException("Branch is currently not supported.");
+    }
+
+    @Override
+    public String commit(String path, String jsonDiff, String revisionId, String message) throws MicroKernelException {
+        String newRevisionId = null;
+
+        try {
+            Commit commit = CommitBuilder.build(path, jsonDiff, message);
+            newRevisionId = nodeStore.commit(commit);
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return newRevisionId;
+    }
+
+    @Override
+    public String diff(String fromRevisionId, String toRevisionId, String filter,
+            int depth) throws MicroKernelException {
+        throw new UnsupportedOperationException("Diff is currently not supported.");
+    }
+
+    @Override
+    public long getChildNodeCount(String path, String revisionId) throws MicroKernelException {
+        long childNodeCount = 0L;
+
+        try {
+            String revId = null;
+            if (revisionId != null) {
+                revId = new String(revisionId);
+            }
+            Node rootOfPath = nodeStore.getNodes(path, revId, 0, 0, -1, null);
+            if (rootOfPath != null) {
+                childNodeCount = rootOfPath.getChildCount();
+            }
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return childNodeCount;
+    }
+
+    @Override
+    public String getHeadRevision() throws MicroKernelException {
+        String headRevisionId = null;
+
+        try {
+            headRevisionId = nodeStore.getHeadRevision();
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return headRevisionId;
+    }
+
+    @Override
+    public String getJournal(String fromRevisionId, String toRevisionId,
+            String path) throws MicroKernelException {
+        return nodeStore.getJournal(fromRevisionId, toRevisionId, path);
+    }
+
+    @Override
+    public long getLength(String blobId) throws MicroKernelException {
+        long length = -1;
+
+        try {
+            length = blobStore.getBlobLength(blobId);
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return length;
+    }
+
+    @Override
+    public String getNodes(String path, String revisionId, int depth, long offset,
+            int maxChildNodes, String filter) throws MicroKernelException {
+
+        NodeFilter nodeFilter = filter == null || filter.isEmpty() ? null : NodeFilter.parse(filter);
+        if (offset > 0 && nodeFilter != null && nodeFilter.getChildNodeFilter() != null) {
+            // Both an offset > 0 and a filter on node names have been specified...
+            throw new IllegalArgumentException("offset > 0 with child node filter");
+        }
+
+        try {
+            // FIXME [Mete] Should filter, offset, and maxChildNodes be handled in Mongo instead?
+            Node rootNode = nodeStore.getNodes(path, revisionId, depth, offset, maxChildNodes, filter);
+            if (rootNode == null) {
+                return null;
+            }
+            return JsonUtil.convertToJson(rootNode, depth, (int)offset, maxChildNodes, true, nodeFilter);
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+    }
+
+    @Override
+    public String getRevisionHistory(long since, int maxEntries, String path) throws MicroKernelException {
+        return nodeStore.getRevisionHistory(since, maxEntries, path);
+    }
+
+    @Override
+    public String merge(String branchRevisionId, String message) throws MicroKernelException {
+        throw new UnsupportedOperationException("Merge is currently not supported.");
+    }
+
+    @Override
+    public boolean nodeExists(String path, String revisionId) throws MicroKernelException {
+        boolean exists = false;
+
+        try {
+            String revId = null;
+            if (revisionId != null) {
+                revId = new String(revisionId);
+            }
+
+            exists = nodeStore.nodeExists(path, revId);
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return exists;
+    }
+
+    @Override
+    public int read(String blobId, long pos, byte[] buff, int off, int length) throws MicroKernelException {
+        int totalBytes = -1;
+
+        try {
+            totalBytes = blobStore.readBlob(blobId, pos, buff, off, length);
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return totalBytes;
+    }
+
+    @Override
+    public String waitForCommit(String oldHeadRevisionId, long timeout) throws MicroKernelException,
+            InterruptedException {
+        return nodeStore.waitForCommit(oldHeadRevisionId, timeout);
+    }
+
+    @Override
+    public String write(InputStream in) throws MicroKernelException {
+        String blobId = null;
+
+        try {
+            blobId = blobStore.writeBlob(in);
+        } catch (Exception e) {
+            throw new MicroKernelException(e);
+        }
+
+        return blobId;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,88 @@
+/*
+ * 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.jackrabbit.mongomk.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jackrabbit.mk.json.JsopTokenizer;
+import org.apache.jackrabbit.mk.util.NameFilter;
+
+/**
+ * FIXME [Mete] Stolen from OAK. Should go away at some point when MongoMK becomes
+ * part of OAK.
+ */
+public class NodeFilter {
+
+    NameFilter nodeFilter;
+    NameFilter propFilter;
+
+    private NodeFilter(NameFilter nodeFilter, NameFilter propFilter) {
+        this.nodeFilter = nodeFilter;
+        this.propFilter = propFilter;
+    }
+
+    static NodeFilter parse(String json) {
+        // parse json format filter
+        JsopTokenizer t = new JsopTokenizer(json);
+        t.read('{');
+
+        NameFilter nodeFilter = null, propFilter = null;
+
+        do {
+            String type = t.readString();
+            t.read(':');
+            String[] globs = parseArray(t);
+            if (type.equals("nodes")) {
+                nodeFilter = new NameFilter(globs);
+            } else if (type.equals("properties")) {
+                propFilter = new NameFilter(globs);
+            } else {
+                throw new IllegalArgumentException("illegal filter format");
+            }
+        } while (t.matches(','));
+        t.read('}');
+
+        return new NodeFilter(nodeFilter, propFilter);
+    }
+
+    private static String[] parseArray(JsopTokenizer t) {
+        List<String> l = new ArrayList<String>();
+        t.read('[');
+        do {
+            l.add(t.readString());
+        } while (t.matches(','));
+        t.read(']');
+        return l.toArray(new String[l.size()]);
+    }
+
+    NameFilter getChildNodeFilter() {
+        return nodeFilter;
+    }
+
+    NameFilter getPropertyFilter() {
+        return propFilter;
+    }
+
+    boolean includeNode(String name) {
+        return nodeFilter == null || nodeFilter.matches(name);
+    }
+
+    public boolean includeProperty(String name) {
+        return propFilter == null || propFilter.matches(name);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,114 @@
+/*
+ * 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.jackrabbit.mongomk.impl.builder;
+
+import org.apache.jackrabbit.mongomk.api.model.Commit;
+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;
+import org.apache.jackrabbit.mongomk.api.model.Instruction.MoveNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.model.Instruction.RemoveNodeInstruction;
+import org.apache.jackrabbit.mongomk.api.model.Instruction.SetPropertyInstruction;
+import org.apache.jackrabbit.mongomk.impl.json.DefaultJsopHandler;
+import org.apache.jackrabbit.mongomk.impl.json.JsopParser;
+import org.apache.jackrabbit.mongomk.impl.model.AddNodeInstructionImpl;
+import org.apache.jackrabbit.mongomk.impl.model.AddPropertyInstructionImpl;
+import org.apache.jackrabbit.mongomk.impl.model.CommitImpl;
+import org.apache.jackrabbit.mongomk.impl.model.CopyNodeInstructionImpl;
+import org.apache.jackrabbit.mongomk.impl.model.MoveNodeInstructionImpl;
+import org.apache.jackrabbit.mongomk.impl.model.RemoveNodeInstructionImpl;
+import org.apache.jackrabbit.mongomk.impl.model.SetPropertyInstructionImpl;
+
+/**
+ * A builder to convert a <a href="http://wiki.apache.org/jackrabbit/Jsop">JSOP</a> diff into a {@link Commit}.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public class CommitBuilder {
+
+    /**
+     * Creates and returns the {@link Commit}.
+     *
+     * @param path The root path of the {@code Commit}.
+     * @param diff The {@code JSOP} diff of the {@code Commit}.
+     * @param message The message of the {@code Commit}.
+     *
+     * @return The {@code Commit}.
+     * @throws Exception If an error occurred while creating the {@code Commit}.
+     */
+    public static Commit build(String path, String diff, String message) throws Exception {
+        CommitHandler commitHandler = new CommitHandler(new CommitImpl(path, diff, message));
+        JsopParser jsopParser = new JsopParser(path, diff, commitHandler);
+        jsopParser.parse();
+        return commitHandler.getCommit();
+    }
+
+    private CommitBuilder() {
+        // no instantiation
+    }
+
+    /**
+     * The {@link DefaultHandler} for the {@code JSOP} diff.
+     */
+    private static class CommitHandler extends DefaultJsopHandler {
+        private final CommitImpl commit;
+
+        CommitHandler(CommitImpl commit) {
+            this.commit = commit;
+        }
+
+        @Override
+        public void nodeAdded(String parentPath, String name) {
+            AddNodeInstruction instruction = new AddNodeInstructionImpl(parentPath, name);
+            commit.addInstruction(instruction);
+        }
+
+        @Override
+        public void nodeCopied(String rootPath, String oldPath, String newPath) {
+            CopyNodeInstruction instruction = new CopyNodeInstructionImpl(rootPath, oldPath, newPath);
+            commit.addInstruction(instruction);
+        }
+
+        @Override
+        public void nodeMoved(String rootPath, String oldPath, String newPath) {
+            MoveNodeInstruction instruction = new MoveNodeInstructionImpl(rootPath, oldPath, newPath);
+            commit.addInstruction(instruction);
+        }
+
+        @Override
+        public void nodeRemoved(String parentPath, String name) {
+            RemoveNodeInstruction instruction = new RemoveNodeInstructionImpl(parentPath, name);
+            commit.addInstruction(instruction);
+        }
+
+        @Override
+        public void propertyAdded(String path, String key, Object value) {
+            AddPropertyInstruction instruction = new AddPropertyInstructionImpl(path, key, value);
+            commit.addInstruction(instruction);
+        }
+
+        @Override
+        public void propertySet(String path, String key, Object value) {
+            SetPropertyInstruction instruction = new SetPropertyInstructionImpl(path, key, value);
+            commit.addInstruction(instruction);
+        }
+
+        Commit getCommit() {
+            return commit;
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,125 @@
+/*
+ * 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.jackrabbit.mongomk.impl.builder;
+
+import java.util.HashMap;
+import java.util.Iterator;
+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.oak.commons.PathUtils;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * A builder to create {@link Node}s from <a hred="http://en.wikipedia.org/wiki/JavaScript_Object_Notation">JSON</a>
+ * strings.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public class NodeBuilder {
+
+    /**
+     * Creates {@link Node} from the given {@code json} and an empty path as root path.
+     *
+     * @param json The {@code json}.
+     * @return The {@code Node}.
+     * @throws Exception If an error occurred while creating.
+     * @see #build(String, String)
+     */
+    public static Node build(String json) throws Exception {
+        return build(json, "");
+    }
+
+    /**
+     * Creates {@link Node} from the given {@code json} and an empty path as root path.
+     *
+     * @param json The {@code json}.
+     * @param path The root path of the nodes.
+     * @return The {@code Node}.
+     * @throws Exception If an error occurred while creating.
+     * @see #build(String, String)
+     */
+    public static Node build(String json, String path) throws Exception {
+        NodeBuilder nodeBuilder = new NodeBuilder();
+
+        return nodeBuilder.doBuild(json, path);
+    }
+
+    private NodeBuilder() {
+        // only private construction
+    }
+
+    private Node doBuild(String json, String path) throws Exception {
+        try {
+            JSONObject jsonObject = new JSONObject(json);
+            JSONArray names = jsonObject.names();
+            if (names.length() != 1) {
+                throw new IllegalArgumentException("JSON must contain exactly 1 root node");
+            }
+
+            String name = names.getString(0);
+            JSONObject value = jsonObject.getJSONObject(name);
+
+            return parseNode(PathUtils.concat(path, name), value);
+        } catch (JSONException e) {
+            throw new Exception(e);
+        }
+    }
+
+    private Node parseNode(String path, JSONObject jsonObject) throws Exception {
+        String realPath = path;
+        String revisionId = null;
+
+        int index = path.lastIndexOf('#');
+        if (index != -1) {
+            realPath = path.substring(0, index);
+            revisionId = path.substring(index + 1);
+        }
+
+        NodeImpl node = new NodeImpl(realPath);
+        node.setRevisionId(revisionId);
+
+        Map<String, Object> properties = null;
+        for (@SuppressWarnings("rawtypes")
+        Iterator iterator = jsonObject.keys(); iterator.hasNext();) {
+            String key = (String) iterator.next();
+            Object value = jsonObject.get(key);
+
+            if (value instanceof JSONObject) {
+                String childPath = PathUtils.concat(realPath, key);
+
+                Node childNode = parseNode(childPath, (JSONObject) value);
+                node.addChild(childNode);
+            } else {
+                if (properties == null) {
+                    properties = new HashMap<String, Object>();
+                }
+
+                Object converted = JsonUtil.convertJsonValue(value.toString());
+                properties.put(key, converted);
+            }
+        }
+
+        node.setProperties(properties);
+
+        return node;
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.mongomk.impl.command;
+
+import org.apache.jackrabbit.mongomk.api.command.Command;
+import org.apache.jackrabbit.mongomk.api.command.CommandExecutor;
+
+/**
+ * Implementation of the {@link CommandExecutor} interface.
+ *
+ * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ */
+public class CommandExecutorImpl implements CommandExecutor {
+
+    @Override
+    public <T> T execute(Command<T> command) throws Exception {
+        T result = null;
+
+        int numOfRetries = command.getNumOfRetries();
+        int currentRetry = 0;
+        boolean needsRetry = true;
+
+        while ((currentRetry <= numOfRetries) && needsRetry) {
+
+            try {
+                result = command.execute();
+                needsRetry = command.needsRetry(result);
+            } catch (Exception e) {
+                needsRetry = command.needsRetry(e);
+
+                if (!needsRetry) {
+                    throw e;
+                }
+            }
+
+            ++currentRetry;
+        }
+
+        return result;
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java?rev=1386591&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java Mon Sep 17 12:54:01 2012
@@ -0,0 +1,92 @@
+/*
+ * 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.jackrabbit.mongomk.impl.json;
+
+/**
+ * The event callback of the parser.
+ *
+ * <p>
+ * Each event callback has an empty default implementation. An implementor may choose the appropriate methods to
+ * overwrite.
+ * </p>
+ */
+public class DefaultJsopHandler {
+
+    /**
+     * Event: A node has been added.
+     *
+     * @param parentPath The path where the node was added to.
+     * @param name The name of the added node.
+     */
+    public void nodeAdded(String parentPath, String name) {
+        // No-op
+    }
+
+    /**
+     * Event: A node was copied.
+     *
+     * @param rootPath The root path where the copy took place.
+     * @param oldPath The old path of the node (relative to the root path).
+     * @param newPath The new path of the node (relative to the root path).
+     */
+    public void nodeCopied(String rootPath, String oldPath, String newPath) {
+        // No-op
+    }
+
+    /**
+     * Event: A node was moved.
+     *
+     * @param rootPath The root path where the copy took place.
+     * @param oldPath The old path of the node (relative to the root path).
+     * @param newPath The new path of the node (relative to the root path).
+     */
+    public void nodeMoved(String rootPath, String oldPath, String newPath) {
+        // No-op
+    }
+
+    /**
+     * Event: A node was removed.
+     *
+     * @param parentPath The path where the node was removed from.
+     * @param name The name of the node.
+     */
+    public void nodeRemoved(String parentPath, String name) {
+        // No-op
+    }
+
+    /**
+     * Event: A property was added.
+     *
+     * @param path The path of the node where the property was added.
+     * @param key The key of the property.
+     * @param value The value of the property.
+     */
+    public void propertyAdded(String path, String key, Object value) {
+        // No-op
+    }
+
+    /**
+     * Event: A property was set.
+     *
+     * @param path The path of the node where the property was set.
+     * @param key The key of the property.
+     * @param value The value of the property.
+     */
+    public void propertySet(String path, String key, Object value) {
+        // No-op
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message