jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1388369 [1/3] - in /jackrabbit/oak/trunk: ./ oak-mongomk-api/ oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/ oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/ oak-mongomk-api/src/main/java/org/apach...
Date Fri, 21 Sep 2012 08:26:45 GMT
Author: jukka
Date: Fri Sep 21 08:26:42 2012
New Revision: 1388369

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

Move mongomk-api and -impl to mongomk. Patch by Mete Atamel.

Added:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/command/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/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/Instruction.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddNodeInstructionImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddPropertyInstructionImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddPropertyInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/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/CopyNodeInstructionImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CopyNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MoveNodeInstructionImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MoveNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/RemoveNodeInstructionImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/RemoveNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/SetPropertyInstructionImpl.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/SetPropertyInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/InstructionAssert.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/InstructionAssert.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/NodeAssert.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/NodeAssert.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilderImplTest.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/CommitBuilderImplTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilderTest.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/NodeBuilderTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/json/
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java
      - copied, changed from r1388086, jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java
Modified:
    jackrabbit/oak/trunk/oak-mongomk-api/pom.xml
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java
    jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java
    jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/AddPropertyInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CommitImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/CopyNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MoveNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/NodeImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/RemoveNodeInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/model/SetPropertyInstructionImpl.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/CommitBuilderImplTest.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/builder/NodeBuilderTest.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/InstructionAssert.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/NodeAssert.java
    jackrabbit/oak/trunk/oak-mongomk-impl/src/test/java/org/apache/jackrabbit/mongomk/impl/json/JsopParserTest.java
    jackrabbit/oak/trunk/oak-mongomk/pom.xml
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/NodeExistsCommandMongoTest.java
    jackrabbit/oak/trunk/pom.xml

Modified: jackrabbit/oak/trunk/oak-mongomk-api/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-api/pom.xml?rev=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/pom.xml Fri Sep 21 08:26:42 2012
@@ -1,42 +0,0 @@
-<?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>

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/BlobStore.java Fri Sep 21 08:26:42 2012
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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;
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/NodeStore.java Fri Sep 21 08:26:42 2012
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/AbstractCommand.java Fri Sep 21 08:26:42 2012
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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;
-    }
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/Command.java Fri Sep 21 08:26:42 2012
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/command/CommandExecutor.java Fri Sep 21 08:26:42 2012
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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;
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Commit.java Fri Sep 21 08:26:42 2012
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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();
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Instruction.java Fri Sep 21 08:26:42 2012
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/InstructionVisitor.java Fri Sep 21 08:26:42 2012
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-api/src/main/java/org/apache/jackrabbit/mongomk/api/model/Node.java Fri Sep 21 08:26:42 2012
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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);
-}

Modified: jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml?rev=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/pom.xml Fri Sep 21 08:26:42 2012
@@ -1,73 +0,0 @@
-<?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>

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java Fri Sep 21 08:26:42 2012
@@ -1,213 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/NodeFilter.java Fri Sep 21 08:26:42 2012
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/CommitBuilder.java Fri Sep 21 08:26:42 2012
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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;
-        }
-    }
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/builder/NodeBuilder.java Fri Sep 21 08:26:42 2012
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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;
-    }
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommandExecutorImpl.java Fri Sep 21 08:26:42 2012
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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;
-    }
-}

Modified: 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=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/DefaultJsopHandler.java Fri Sep 21 08:26:42 2012
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.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
-    }
-}

Modified: jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java?rev=1388369&r1=1388368&r2=1388369&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk-impl/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsonUtil.java Fri Sep 21 08:26:42 2012
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.mongomk.impl.json;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.jackrabbit.mk.json.JsopBuilder;
-import org.apache.jackrabbit.mongomk.api.model.Node;
-import org.apache.jackrabbit.mongomk.impl.NodeFilter;
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-
-/**
- * FIXME - [Mete] This should really merge with MicroKernelImpl#toJson.
- *
- * <a href="http://en.wikipedia.org/wiki/JavaScript_Object_Notation">JSON</a> related utility classes.
- *
- * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
- */
-public class JsonUtil {
-
-    public static Object convertJsonValue(String jsonValue) throws Exception {
-        if (jsonValue == null) {
-            return null;
-        }
-
-        String dummyJson = "{dummy : " + jsonValue + "}";
-        JSONObject jsonObject = new JSONObject(dummyJson);
-        Object dummyObject = jsonObject.get("dummy");
-        return convertJsonValue(dummyObject);
-    }
-
-    public static String convertToJson(Node node, int depth, int offset, int maxChildNodes,
-            boolean inclVirtualProps, NodeFilter filter) {
-        JsopBuilder builder = new JsopBuilder();
-        convertToJson(builder, node, depth, 0, offset, maxChildNodes, inclVirtualProps, filter);
-        return builder.toString();
-    }
-
-    static void convertToJson(JsopBuilder builder, Node node, int depth, int currentDepth,
-            int offset, int maxChildNodes, boolean inclVirtualProps,  NodeFilter filter) {
-        builder.object();
-
-        Map<String, Object> properties = node.getProperties();
-        if (properties != null) {
-            for (Map.Entry<String, Object> entry : properties.entrySet()) {
-                String key = entry.getKey();
-                if (filter == null || filter.includeProperty(key)) {
-                    Object value = entry.getValue();
-                    builder.key(key);
-                    if (value instanceof String) {
-                        builder.value(value.toString());
-                    } else {
-                        builder.encodedValue(value.toString());
-                    }
-                }
-            }
-        }
-
-        long childCount = node.getChildCount();
-        if (inclVirtualProps) {
-            if (filter == null || filter.includeProperty(":childNodeCount")) {
-                // :childNodeCount is by default always included
-                // unless it is explicitly excluded in the filter
-                builder.key(":childNodeCount").value(childCount);
-            }
-            // FIXME [Mete] See if :hash is still being used.
-            /*check whether :hash has been explicitly included
-            if (filter != null) {
-                NameFilter nf = filter.getPropertyFilter();
-                if (nf != null
-                        && nf.getInclusionPatterns().contains(":hash")
-                        && !nf.getExclusionPatterns().contains(":hash")) {
-                    builder.key(":hash").value(rep.getRevisionStore().getId(node).toString());
-                }
-            }
-            */
-        }
-
-        // FIXME [Mete] There's still some more work here.
-        Iterator<Node> entries = node.getChildEntries(offset, maxChildNodes);
-        while (entries.hasNext()) {
-            Node child = entries.next();
-            int numSiblings = 0;
-            if (maxChildNodes != -1 && ++numSiblings > maxChildNodes) {
-                break;
-            }
-            builder.key(child.getName());
-            if ((depth == -1) || (currentDepth < depth)) {
-                convertToJson(builder, child, depth, currentDepth + 1, offset,
-                        maxChildNodes, inclVirtualProps, filter);
-            } else {
-                builder.object();
-                builder.endObject();
-            }
-        }
-
-        builder.endObject();
-    }
-
-    private static Object convertJsonValue(Object jsonObject) throws Exception {
-        if (jsonObject == JSONObject.NULL) {
-            return null;
-        }
-
-        if (jsonObject instanceof JSONArray) {
-            List<Object> elements = new LinkedList<Object>();
-            JSONArray dummyArray = (JSONArray) jsonObject;
-            for (int i = 0; i < dummyArray.length(); ++i) {
-                Object raw = dummyArray.get(i);
-                Object parsed = convertJsonValue(raw);
-                elements.add(parsed);
-            }
-            return elements;
-        }
-
-        return jsonObject;
-    }
-
-    private JsonUtil() {
-        // no instantiation
-    }
-}



Mime
View raw message