jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1212018 [1/7] - in /jackrabbit/sandbox/jackrabbit-microkernel: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/jackrabbit/ src/main/java/org/apache/jackrabbit/configuration/ src/main/j...
Date Thu, 08 Dec 2011 18:18:45 GMT
Author: mduerig
Date: Thu Dec  8 18:18:42 2011
New Revision: 1212018

URL: http://svn.apache.org/viewvc?rev=1212018&view=rev
Log:
add Microkernel based prototype of JCR implementation (WIP)

Added:
    jackrabbit/sandbox/jackrabbit-microkernel/
    jackrabbit/sandbox/jackrabbit-microkernel/pom.xml   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/SessionContext.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/SessionFactory.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/SessionImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/WorkspaceImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/configuration/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/configuration/RepositoryConfiguration.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/configuration/RepositoryConfigurationImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/DefaultJsonTokenizer.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/FullJsonParser.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsonHandler.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsonParser.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsonTokenizer.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsonValue.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsopHandler.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsopHandler.java.orig
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsopParser.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/JsopParser.java.orig
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/LevelOrderJsonParser.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/ParseException.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/Token.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/json/UnescapingJsonTokenizer.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/security/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/security/Authenticator.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/security/AuthenticatorImpl.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/security/CredentialsInfo.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeLog.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/NodeDelta.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/Operation.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientSpace.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/Arrays.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/ChildItemCollector.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/NodeIteratorAdapter.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/PropertyIteratorAdapter.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/RangeIteratorAdapter.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/Unchecked.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/utils/ValueConverter.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/resources/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/resources/META-INF/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/resources/META-INF/services/
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/json/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/json/DefaultJsonTokenizerTest.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/json/JsonParserTest.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/json/JsopParserTest.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/json/UnescapingJsonTokenizerTest.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/util/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/util/Loop.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/util/NumberStream.java   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/test1.json   (with props)
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/test2.json   (with props)

Added: jackrabbit/sandbox/jackrabbit-microkernel/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/pom.xml?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/pom.xml (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/pom.xml Thu Dec  8 18:18:42 2011
@@ -0,0 +1,96 @@
+<?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>
+
+    <groupId>org.apache.jackrabbit</groupId>
+    <artifactId>jackrabbit-microkernel</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>10</version>
+    </parent>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+                <version>2.0.2</version>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-commons</artifactId>
+            <version>2.4-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-spi-commons</artifactId>
+            <version>2.4-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>microkernel</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>1.6.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-tests</artifactId>
+            <version>2.4-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,304 @@
+/*
+ * 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;
+
+import javax.jcr.PropertyType;
+import javax.jcr.Repository;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import java.util.HashMap;
+import java.util.Map;
+
+import static javax.jcr.Repository.IDENTIFIER_STABILITY;
+import static javax.jcr.Repository.LEVEL_1_SUPPORTED;
+import static javax.jcr.Repository.LEVEL_2_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_INHERITANCE;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_PROPERTY_TYPES;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED;
+import static javax.jcr.Repository.NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED;
+import static javax.jcr.Repository.OPTION_ACCESS_CONTROL_SUPPORTED;
+import static javax.jcr.Repository.OPTION_ACTIVITIES_SUPPORTED;
+import static javax.jcr.Repository.OPTION_BASELINES_SUPPORTED;
+import static javax.jcr.Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED;
+import static javax.jcr.Repository.OPTION_LIFECYCLE_SUPPORTED;
+import static javax.jcr.Repository.OPTION_LOCKING_SUPPORTED;
+import static javax.jcr.Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED;
+import static javax.jcr.Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED;
+import static javax.jcr.Repository.OPTION_OBSERVATION_SUPPORTED;
+import static javax.jcr.Repository.OPTION_QUERY_SQL_SUPPORTED;
+import static javax.jcr.Repository.OPTION_RETENTION_SUPPORTED;
+import static javax.jcr.Repository.OPTION_SHAREABLE_NODES_SUPPORTED;
+import static javax.jcr.Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED;
+import static javax.jcr.Repository.OPTION_TRANSACTIONS_SUPPORTED;
+import static javax.jcr.Repository.OPTION_UNFILED_CONTENT_SUPPORTED;
+import static javax.jcr.Repository.OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED;
+import static javax.jcr.Repository.OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED;
+import static javax.jcr.Repository.OPTION_VERSIONING_SUPPORTED;
+import static javax.jcr.Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED;
+import static javax.jcr.Repository.OPTION_XML_EXPORT_SUPPORTED;
+import static javax.jcr.Repository.OPTION_XML_IMPORT_SUPPORTED;
+import static javax.jcr.Repository.QUERY_FULL_TEXT_SEARCH_SUPPORTED;
+import static javax.jcr.Repository.QUERY_JOINS;
+import static javax.jcr.Repository.QUERY_JOINS_NONE;
+import static javax.jcr.Repository.QUERY_LANGUAGES;
+import static javax.jcr.Repository.QUERY_STORED_QUERIES_SUPPORTED;
+import static javax.jcr.Repository.QUERY_XPATH_DOC_ORDER;
+import static javax.jcr.Repository.QUERY_XPATH_POS_INDEX;
+import static javax.jcr.Repository.REP_NAME_DESC;
+import static javax.jcr.Repository.REP_VENDOR_DESC;
+import static javax.jcr.Repository.REP_VENDOR_URL_DESC;
+import static javax.jcr.Repository.SPEC_NAME_DESC;
+import static javax.jcr.Repository.SPEC_VERSION_DESC;
+import static javax.jcr.Repository.WRITE_SUPPORTED;
+
+public class Descriptors {
+
+    private final Map<String, Descriptor> descriptors;
+
+    public Descriptors(ValueFactory valueFactory) {
+        descriptors = new HashMap<String, Descriptor>();
+        Value trueValue = valueFactory.createValue(true);
+        Value falseValue = valueFactory.createValue(true);
+
+        put(new Descriptor(
+                IDENTIFIER_STABILITY,
+                valueFactory.createValue(Repository.IDENTIFIER_STABILITY_INDEFINITE_DURATION), true, true));
+        put(new Descriptor(
+                LEVEL_1_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                LEVEL_2_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_INHERITANCE,
+                valueFactory.createValue(NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE), true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_PROPERTY_TYPES,
+                new Value[] {
+                    valueFactory.createValue(PropertyType.TYPENAME_STRING),
+                    valueFactory.createValue(PropertyType.TYPENAME_BINARY),
+                    valueFactory.createValue(PropertyType.TYPENAME_LONG),
+                    valueFactory.createValue(PropertyType.TYPENAME_LONG),
+                    valueFactory.createValue(PropertyType.TYPENAME_DOUBLE),
+                    valueFactory.createValue(PropertyType.TYPENAME_DECIMAL),
+                    valueFactory.createValue(PropertyType.TYPENAME_DATE),
+                    valueFactory.createValue(PropertyType.TYPENAME_BOOLEAN),
+                    valueFactory.createValue(PropertyType.TYPENAME_NAME),
+                    valueFactory.createValue(PropertyType.TYPENAME_PATH),
+                    valueFactory.createValue(PropertyType.TYPENAME_REFERENCE),
+                    valueFactory.createValue(PropertyType.TYPENAME_WEAKREFERENCE),
+                    valueFactory.createValue(PropertyType.TYPENAME_URI),
+                    valueFactory.createValue(PropertyType.TYPENAME_UNDEFINED)
+                }, false, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_ACCESS_CONTROL_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_JOURNALED_OBSERVATION_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_LIFECYCLE_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_LOCKING_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_OBSERVATION_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_QUERY_SQL_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_RETENTION_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_SHAREABLE_NODES_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_SIMPLE_VERSIONING_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_TRANSACTIONS_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_UNFILED_CONTENT_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_VERSIONING_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_WORKSPACE_MANAGEMENT_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_XML_EXPORT_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_XML_IMPORT_SUPPORTED,
+                trueValue, true, true));
+        put(new Descriptor(
+                OPTION_ACTIVITIES_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                OPTION_BASELINES_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                QUERY_FULL_TEXT_SEARCH_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                QUERY_JOINS,
+                valueFactory.createValue(QUERY_JOINS_NONE), true, true));
+        put(new Descriptor(
+                QUERY_LANGUAGES,
+                new Value[0], false, true));
+        put(new Descriptor(
+                QUERY_STORED_QUERIES_SUPPORTED,
+                falseValue, true, true));
+        put(new Descriptor(
+                QUERY_XPATH_DOC_ORDER,
+                falseValue, true, true));
+        put(new Descriptor(
+                QUERY_XPATH_POS_INDEX,
+                falseValue, true, true));
+        put(new Descriptor(
+                REP_NAME_DESC,
+                valueFactory.createValue("Apache Jackrabbit Microkernel JCR implementation"), true, true));
+        put(new Descriptor(
+                REP_VENDOR_DESC,
+                valueFactory.createValue("Apache Software Foundation"), true, true));
+        put(new Descriptor(
+                REP_VENDOR_URL_DESC,
+                valueFactory.createValue("http://www.apache.org/"), true, true));
+        put(new Descriptor(
+                SPEC_NAME_DESC,
+                valueFactory.createValue("Content Repository for Java Technology API"), true, true));
+        put(new Descriptor(
+                SPEC_VERSION_DESC,
+                valueFactory.createValue("2.0"), true, true));
+        put(new Descriptor(
+                WRITE_SUPPORTED,
+                trueValue, true, true));
+    }
+
+    public Descriptors(ValueFactory valueFactory, Iterable<Descriptor> descriptors) {
+        this(valueFactory);
+        
+        for (Descriptor d : descriptors) {
+            this.descriptors.put(d.name, d);
+        }
+    }
+
+    public String[] getKeys() {
+        return descriptors.keySet().toArray(new String[descriptors.size()]);
+    }
+
+    public boolean isStandardDescriptor(String key) {
+        return descriptors.containsKey(key) && descriptors.get(key).standard;
+    }
+
+    public boolean isSingleValueDescriptor(String key) {
+        return descriptors.containsKey(key) && descriptors.get(key).singleValued;
+    }
+
+    public Value getValue(String key) {
+        Descriptor d = descriptors.get(key);
+        return d == null || !d.singleValued ? null : d.values[0];
+    }
+
+    public Value[] getValues(String key) {
+        Descriptor d = descriptors.get(key);
+        return d == null ? null : d.values;
+    }
+
+    public static final class Descriptor {
+        private final String name;
+        private final Value[] values;
+        private final boolean singleValued;
+        private final boolean standard;
+
+        public Descriptor(String name, Value[] values, boolean singleValued, boolean standard) {
+            this.name = name;
+            this.values = values;
+            this.singleValued = singleValued;
+            this.standard = standard;
+        }
+
+        public Descriptor(String name, Value value, boolean singleValued, boolean standard) {
+            this(name, new Value[]{ value }, singleValued, standard);
+        }
+    }
+
+    //------------------------------------------< private >---
+
+    private void put(Descriptor descriptor) {
+        descriptors.put(descriptor.name, descriptor);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Descriptors.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,71 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.configuration.RepositoryConfiguration;
+import org.apache.jackrabbit.security.Authenticator;
+import org.apache.jackrabbit.security.AuthenticatorImpl;
+import org.apache.jackrabbit.utils.Unchecked;
+import org.apache.jackrabbit.commons.SimpleValueFactory;
+import org.apache.jackrabbit.mk.MicroKernelFactory;
+import org.apache.jackrabbit.mk.api.MicroKernel;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFactory;
+import java.util.HashMap;
+import java.util.Map;
+
+import static java.text.MessageFormat.format;
+
+/**
+ * Poor Java's dependency injection
+ */
+public class GlobalContext {
+    private final Map<Class<?>, Object> instances = new HashMap<Class<?>, Object>();
+    
+    public GlobalContext(RepositoryConfiguration repositoryConfiguration) throws RepositoryException {
+        put(ValueFactory.class, new SimpleValueFactory());  
+        put(RepositoryConfiguration.class, repositoryConfiguration);
+        put(MicroKernel.class, MicroKernelFactory.getInstance(repositoryConfiguration.getMicrokernelUrl()));
+        put(Repository.class, RepositoryImpl.create(this));
+        put(Authenticator.class, AuthenticatorImpl.INSTANCE);
+        put(SessionFactory.class, SessionImpl.FACTORY);
+    }
+
+    public <T> T getInstance(Class<T> forClass) {
+        T instance = Unchecked.<T>cast(instances.get(forClass));
+        if (instance == null) {
+            throw new IllegalStateException(format("Global context does not contain {0}", forClass));
+        }
+        return instance;
+    }
+
+    //------------------------------------------< private >---
+
+    private <T, I extends T> void put(Class<T> classType, I instance) {
+        if (instances.containsKey(classType)) {
+            throw new IllegalStateException(format("Global context already contains {0}", classType));
+        }
+
+        instances.put(classType, instance);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/GlobalContext.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,144 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.SessionImpl.Context;
+import org.apache.jackrabbit.state.NodeDelta;
+
+import javax.jcr.Item;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+abstract class ItemImpl implements Item {
+    protected final Context sessionContext;
+    protected final Path path;
+
+    protected String revision;
+
+    protected ItemImpl(Context sessionContext, Path path) {
+        this.sessionContext = sessionContext;
+        this.path = path;
+        revision = sessionContext.getRevision();
+    }
+
+    @Override
+    public String getPath() throws RepositoryException {
+        return path.getPath();
+    }
+
+    @Override
+    public String getName() throws RepositoryException {
+        return path.getName();
+    }
+
+    @Override
+    public Item getAncestor(int depth) throws RepositoryException {
+        Path parent = path.getAncestor(depth);
+        if (parent == null) {
+            throw new ItemNotFoundException("No ancestor of this depth");
+        }
+        
+        return NodeImpl.create(sessionContext, parent);
+    }
+
+    @Override
+    public Node getParent() throws RepositoryException {
+        Path parent = path.getParent();
+        if (parent == null) {
+            throw new ItemNotFoundException("Root has no parent");
+        }
+
+        else {
+            return NodeImpl.create(sessionContext, parent);
+        }
+    }
+
+    @Override
+    public int getDepth() throws RepositoryException {
+        return path.getDepth();
+    }
+
+    @Override
+    public Session getSession() throws RepositoryException {
+        return sessionContext.getSession();
+    }
+
+    @Override
+    public boolean isNew() {
+        return getNodeDelta().isNew();
+    }
+
+    @Override
+    public boolean isModified() {
+        return getNodeDelta().isModified();
+    }
+
+    @Override
+    public boolean isSame(Item otherItem) throws RepositoryException {
+        // The objects are either both Node objects or both Property objects.
+        if (isNode() != otherItem.isNode()) {
+            return false;
+        }
+
+        // Both objects were acquired through Session objects that were
+        // created by the same Repository object
+        if (getSession().getRepository() != otherItem.getSession().getRepository()) {
+            return false;
+        }
+
+        // Both objects were acquired through Session objects bound to the same repository workspace.
+        if (!getSession().getWorkspace().getName().equals(otherItem.getSession().getWorkspace().getName())) {
+            return false;
+        }
+
+        // If they are Node objects, they have the same identifier.
+        if (isNode() && ((Node) this).getIdentifier().equals(((Node) otherItem).getIdentifier())) {
+            return true;
+        }
+        // If they are Property objects they have identical names and isSame is true of their parent nodes.
+        else {
+            return getName().equals(otherItem.getName()) && getParent().isSame(otherItem.getParent());
+        }
+    }
+
+    @Override
+    public void save() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("Use Session#save");
+    }
+
+    @Override
+    public void refresh(boolean keepChanges) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("Use Session#refresh");
+    }
+
+    //------------------------------------------< internal >---
+
+    protected final boolean isStale() {
+        return !sessionContext.getRevision().equals(revision);
+    }
+    
+    protected final NodeDelta getNodeDelta() {
+        return sessionContext.getTransientSpace().getNodeDelta(path);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/ItemImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,706 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.SessionImpl.Context;
+import org.apache.jackrabbit.json.FullJsonParser;
+import org.apache.jackrabbit.json.JsonValue;
+import org.apache.jackrabbit.json.JsonValue.JsonObject;
+import org.apache.jackrabbit.json.JsonValue.Type;
+import org.apache.jackrabbit.json.UnescapingJsonTokenizer;
+import org.apache.jackrabbit.state.NodeDelta;
+import org.apache.jackrabbit.state.TransientSpace;
+import org.apache.jackrabbit.utils.Arrays;
+import org.apache.jackrabbit.utils.ChildItemCollector;
+import org.apache.jackrabbit.utils.NodeIteratorAdapter;
+import org.apache.jackrabbit.utils.PropertyIteratorAdapter;
+import org.apache.jackrabbit.utils.ValueConverter;
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.spi.commons.iterator.Iterators;
+import org.apache.jackrabbit.spi.commons.iterator.Transformer;
+
+import javax.jcr.Binary;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.Item;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemVisitor;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+public class NodeImpl extends ItemImpl implements Node {
+    private JsonObject node;
+
+    static boolean exist(Context sessionContext, Path path) {
+        return getNode(sessionContext, path) != null;
+    }
+
+    static Node create(Context sessionContext, Path path) throws RepositoryException {
+        JsonObject node = getNode(sessionContext, path);
+        if (node == null) {
+            throw new PathNotFoundException(path.toString());
+        }
+
+        return new NodeImpl(sessionContext, path, node);
+    }
+
+    static Node create(Context sessionContext, Path path, JsonObject node) {
+        return new NodeImpl(sessionContext, path, node);
+    }
+
+    private NodeImpl(Context sessionContext, Path path, JsonObject node) {
+        super(sessionContext, path);
+        this.node = node;
+    }
+
+    //------------------------------------------< Node >---
+
+    @Override
+    public Node addNode(String relPath) throws RepositoryException {
+        if (hasNode(relPath)) {
+            throw new ItemExistsException(relPath);
+        }
+
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        Path newPath = path.concat(relPath);
+        transientSpace.addNode(newPath.getParent(), newPath.getName());
+        return getNode(relPath);
+    }
+
+    @Override
+    public Node addNode(String relPath, String primaryNodeTypeName) throws RepositoryException {
+        if (hasNode(relPath)) {
+            throw new ItemExistsException(relPath);
+        }
+
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        Path newPath = path.concat(relPath);
+        transientSpace.addNode(newPath.getParent(), newPath.getName());
+        setPrimaryType(primaryNodeTypeName);
+        return getNode(relPath);
+    }
+
+    @Override
+    public void remove() throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        transientSpace.removeNode(path);
+    }
+
+    @Override
+    public Property setProperty(String name, Value value, int type) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        transientSpace.addProperty(path, name, ValueConverter.toJsonValue(value));
+        return getProperty(name);
+    }
+
+    @Override
+    public Property setProperty(String name, Value[] values, int type) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        transientSpace.addProperty(path, name, ValueConverter.toJsonValue(values));
+        return getProperty(name);
+    }
+
+    @Override
+    public void addMixin(String mixinName) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        Value value = valueFactory.createValue(mixinName);
+        Value[] values = getProperty("jcr:mixinTypes").getValues();
+        transientSpace.setMixin(path, ValueConverter.toJsonValue(Arrays.add(values, value)));
+    }
+
+    @Override
+    public void removeMixin(String mixinName) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        Value value = valueFactory.createValue(mixinName);
+        Value[] values = getProperty("jcr:mixinTypes").getValues();
+        transientSpace.setMixin(path, ValueConverter.toJsonValue(Arrays.remove(values, value)));
+    }
+
+    @Override
+    public void setPrimaryType(String nodeTypeName) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        Value value = valueFactory.createValue(nodeTypeName);
+        transientSpace.setPrimaryType(path, ValueConverter.toJsonValue(value));
+    }
+
+    
+    @Override
+    public void orderBefore(String srcChildRelPath, String destChildRelPath) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("orderBefore");
+    }
+
+    @Override
+    public Property setProperty(String name, Value value) throws RepositoryException {
+        return setProperty(name, value, value.getType());
+    }
+
+    @Override
+    public Property setProperty(String name, Value[] values) throws RepositoryException {
+        return setProperty(name, values, values.length > 0 ? values[0].getType() : PropertyType.STRING);
+    }
+
+    @Override
+    public Property setProperty(String name, String[] stringValues) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        
+        Value[] values = new Value[stringValues.length];
+        for (int k = 0; k < values.length; k++) {
+            values[k] = valueFactory.createValue(stringValues[k]);
+        }
+
+        return setProperty(name, values);
+    }
+
+    @Override
+    public Property setProperty(String name, String[] stringValues, final int type) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+
+        Value[] values = new Value[stringValues.length];
+        for (int k = 0; k < values.length; k++) {
+            values[k] = valueFactory.createValue(stringValues[k], type);
+        }
+
+        return setProperty(name, values);
+    }
+
+    @Override
+    public Property setProperty(String name, String value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, String value, int type) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value, type));
+    }
+
+    @Override
+    public Property setProperty(String name, InputStream value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, Binary value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, boolean value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, double value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, BigDecimal value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, long value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, Calendar value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public Property setProperty(String name, Node value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return setProperty(name, valueFactory.createValue(value));
+    }
+
+    @Override
+    public boolean hasNode(String relPath) throws RepositoryException {
+        return sessionContext.getSession().nodeExists(path.concat(relPath));
+    }
+
+    @Override
+    public Node getNode(String relPath) throws RepositoryException {
+        return create(sessionContext, path.concat(relPath));
+    }
+
+    @Override
+    public boolean hasNodes() throws RepositoryException {
+        return getNodes().hasNext();
+    }
+
+    @Override
+    public NodeIterator getNodes() throws RepositoryException {
+        final NodeDelta delta = getNodeDelta();
+
+        Iterator<Entry<String, JsonValue>> childItems =
+                Iterators.iteratorChain(getPersistedItems(this), getAddedNodes(delta));
+
+        return new NodeIteratorAdapter(new ChildItemCollector<Node>(childItems) {
+            @Override
+            protected boolean include(String name, JsonValue value) {
+                return value.type() == Type.OBJECT && !delta.hasRemovedNode(name);
+            }
+
+            @Override
+            protected Node createItem(String name, JsonValue value) {
+                return NodeImpl.create(sessionContext, path.concat(name), value.asObject());
+            }
+        }.iterator());
+    }
+
+    @Override
+    public NodeIterator getNodes(final String namePattern) throws RepositoryException {
+        final NodeDelta delta = getNodeDelta();
+
+        Iterator<Entry<String, JsonValue>> childItems =
+                Iterators.iteratorChain(getPersistedItems(this), getAddedNodes(delta));
+
+        return new NodeIteratorAdapter(new ChildItemCollector<Node>(childItems) {
+            @Override
+            protected boolean include(String name, JsonValue value) {
+                return value.type() == Type.OBJECT
+                        && ChildItemCollector.matches(name, namePattern)
+                        && !delta.hasRemovedNode(name);
+            }
+
+            @Override
+            protected Node createItem(String name, JsonValue value) {
+                return NodeImpl.create(sessionContext, path.concat(name), value.asObject());
+            }
+        }.iterator());
+    }
+
+    @Override
+    public NodeIterator getNodes(final String[] nameGlobs) throws RepositoryException {
+        final NodeDelta delta = getNodeDelta();
+
+        Iterator<Entry<String, JsonValue>> childItems =
+                Iterators.iteratorChain(getPersistedItems(this), getAddedNodes(delta));
+
+        return new NodeIteratorAdapter(new ChildItemCollector<Node>(childItems) {
+            @Override
+            protected boolean include(String name, JsonValue value) {
+                return value.type() == Type.OBJECT
+                        && ChildItemCollector.matches(name, nameGlobs)
+                        && !delta.hasRemovedNode(name);
+            }
+
+            @Override
+            protected Node createItem(String name, JsonValue value) {
+                return NodeImpl.create(sessionContext, path.concat(name), value.asObject());
+            }
+        }.iterator());
+    }
+
+    @Override
+    public boolean hasProperty(String relPath) throws RepositoryException {
+        return sessionContext.getSession().propertyExists(path.concat(relPath));
+    }
+
+    @Override
+    public Property getProperty(String relPath) throws RepositoryException {
+        return PropertyImpl.create(sessionContext, path.concat(relPath));
+    }
+
+    @Override
+    public boolean hasProperties() throws RepositoryException {
+        return getProperties().hasNext();
+    }
+
+    @Override
+    public PropertyIterator getProperties() throws RepositoryException {
+        final NodeDelta delta = getNodeDelta();
+
+        Iterator<Entry<String, JsonValue>> childItems =
+                Iterators.iteratorChain(getPersistedItems(this), getProperties(delta));
+
+        return new PropertyIteratorAdapter(new ChildItemCollector<Property>(childItems){
+            @Override
+            protected boolean include(String name, JsonValue value) {
+                return !name.startsWith(":")
+                        && value.type() != Type.OBJECT
+                        && !delta.hasRemovedProperty(name);
+            }
+
+            @Override
+            protected Property createItem(String name, JsonValue value) {
+                return PropertyImpl.create(sessionContext, path.concat(name), value);
+            }
+        }.iterator());
+    }
+
+    @Override
+    public PropertyIterator getProperties(final String namePattern) throws RepositoryException {
+        final NodeDelta delta = getNodeDelta();
+
+        Iterator<Entry<String, JsonValue>> childItems =
+                Iterators.iteratorChain(getPersistedItems(this), getProperties(delta));
+
+        return new PropertyIteratorAdapter(new ChildItemCollector<Property>(childItems){
+            @Override
+            protected boolean include(String name, JsonValue value) {
+                return !name.startsWith(":")
+                        && value.type() != Type.OBJECT
+                        && ChildItemCollector.matches(name, namePattern)
+                        && ! delta.hasRemovedProperty(name);
+            }
+
+            @Override
+            protected Property createItem(String name, JsonValue value) {
+                return PropertyImpl.create(sessionContext, path.concat(name), value);
+            }
+        }.iterator());
+    }
+
+    @Override
+    public PropertyIterator getProperties(final String[] nameGlobs) throws RepositoryException {
+        final NodeDelta delta = getNodeDelta();
+
+        Iterator<Entry<String, JsonValue>> childItems =
+                Iterators.iteratorChain(getPersistedItems(this), getProperties(delta));
+
+        return new PropertyIteratorAdapter(new ChildItemCollector<Property>(childItems){
+            @Override
+            protected boolean include(String name, JsonValue value) {
+                return !name.startsWith(":")
+                        && value.type() != Type.OBJECT
+                        && ChildItemCollector.matches(name, nameGlobs)
+                        && ! delta.hasRemovedProperty(name);
+            }
+
+            @Override
+            protected Property createItem(String name, JsonValue value) {
+                return PropertyImpl.create(sessionContext, path.concat(name), value);
+            }
+        }.iterator());
+    }
+
+    @Override
+    public Item getPrimaryItem() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getPrimaryItem");
+        // todo implement getPrimaryItem
+    }
+
+    @Override
+    public String getUUID() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getUUID");
+        // todo implement getUUID
+    }
+
+    @Override
+    public String getIdentifier() throws RepositoryException {
+        return path.getMkPath();
+        // todo implement getIdentifier
+    }
+
+    @Override
+    public int getIndex() throws RepositoryException {
+        // todo implement getIndex
+        return 0;
+    }
+
+    @Override
+    public PropertyIterator getReferences() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getReferences");
+        // todo implement getReferences
+    }
+
+    @Override
+    public PropertyIterator getReferences(String name) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getReferences");
+        // todo implement getReferences
+    }
+
+    @Override
+    public PropertyIterator getWeakReferences() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getWeakReferences");
+        // todo implement getWeakReferences
+    }
+
+    @Override
+    public PropertyIterator getWeakReferences(String name) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getWeakReferences");
+        // todo implement getWeakReferences
+    }
+
+    @Override
+    public NodeType getPrimaryNodeType() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getPrimaryNodeType");
+        // todo implement getPrimaryNodeType
+    }
+
+    @Override
+    public NodeType[] getMixinNodeTypes() throws RepositoryException {
+        // todo implement getMixinNodeTypes
+        return new NodeType[0];
+    }
+
+    @Override
+    public boolean isNodeType(String nodeTypeName) throws RepositoryException {
+        // todo implement isNodeType
+        return false;
+    }
+
+    @Override
+    public boolean canAddMixin(String mixinName) throws RepositoryException {
+        // todo implement canAddMixin
+        return false;
+    }
+
+    @Override
+    public NodeDefinition getDefinition() throws RepositoryException {
+        // todo implement getDefinition
+        throw new UnsupportedRepositoryOperationException("getDefinition");
+    }
+
+    @Override
+    public Version checkin() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("checkin");
+    }
+
+    @Override
+    public void checkout() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("checkout");
+    }
+
+    @Override
+    public void doneMerge(Version version) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("doneMerge");
+    }
+
+    @Override
+    public void cancelMerge(Version version) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("cancelMerge");
+    }
+
+    @Override
+    public void update(String srcWorkspace) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("update");
+    }
+
+    @Override
+    public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("merge");
+    }
+
+    @Override
+    public String getCorrespondingNodePath(String workspaceName) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getCorrespondingNodePath");
+    }
+
+    @Override
+    public NodeIterator getSharedSet() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getSharedSet");
+    }
+
+    @Override
+    public void removeSharedSet() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("removeSharedSet");
+    }
+
+    @Override
+    public void removeShare() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("removeShare");
+    }
+
+    @Override
+    public boolean isCheckedOut() throws RepositoryException {
+        return true;
+    }
+
+    @Override
+    public void restore(String versionName, boolean removeExisting) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("restore");
+    }
+
+    @Override
+    public void restore(Version version, boolean removeExisting) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("restore");
+    }
+
+    @Override
+    public void restore(Version version, String relPath, boolean removeExisting) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("restore");
+    }
+
+    @Override
+    public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("restoreByLabel");
+    }
+
+    @Override
+    public VersionHistory getVersionHistory() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getVersionHistory");
+    }
+
+    @Override
+    public Version getBaseVersion() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getBaseVersion");
+    }
+
+    @Override
+    public Lock lock(boolean isDeep, boolean isSessionScoped) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("lock");
+    }
+
+    @Override
+    public Lock getLock() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getLock");
+    }
+
+    @Override
+    public void unlock() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("unlock");
+    }
+
+    @Override
+    public boolean holdsLock() throws RepositoryException {
+        return false; 
+    }
+
+    @Override
+    public boolean isLocked() throws RepositoryException {
+        return false; 
+    }
+
+    @Override
+    public void followLifecycleTransition(String transition) throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("followLifecycleTransition");
+    }
+
+    @Override
+    public String[] getAllowedLifecycleTransistions() throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("getAllowedLifecycleTransitions");
+    }
+
+    @Override
+    public boolean isNode() {
+        return true;
+    }
+
+    @Override
+    public void accept(ItemVisitor visitor) throws RepositoryException {
+        visitor.visit(this);
+    }
+
+    //------------------------------------------< private >---
+
+    private JsonObject getNode() throws InvalidItemStateException {
+        if (isStale() || node.isEmpty() ) {
+            JsonObject n = getNode(sessionContext, path);
+            if (n == null) {
+                throw new InvalidItemStateException(path.toString());
+            }
+
+            node = n;
+            revision = sessionContext.getRevision();
+        }
+        return node;
+    }
+
+    private static JsonObject getNode(Context sessionContext, Path path) {
+        NodeDelta delta = sessionContext.getTransientSpace().getNodeDelta(path);
+        if (delta == null) {
+            return null;
+        }
+
+        Path persistedPath = delta.getPersistentPath();
+        if (persistedPath == null) {
+            return JsonObject.EMPTY;
+        }
+
+        MicroKernel microkernel = sessionContext.getMicrokernel();
+        String revision = sessionContext.getRevision();
+        if (!microkernel.nodeExists(persistedPath.getMkPath(), revision)) {
+            return null;
+        }
+
+        String nodeJson = microkernel.getNodes(persistedPath.getMkPath(), revision, 0, 0, -1);
+        return FullJsonParser.parseObject(new UnescapingJsonTokenizer(nodeJson));
+    }
+
+    private static Iterator<Entry<String, JsonValue>> getPersistedItems(NodeImpl node)
+            throws InvalidItemStateException {
+
+        return node.getNode().value().entrySet().iterator();
+    }
+
+    private static Iterator<Entry<String, JsonValue>> getAddedNodes(NodeDelta delta) {
+        return Iterators.transformIterator(delta.getAddedNodes().keySet().iterator(),
+                new Transformer<String, Entry<String, JsonValue>>() {
+
+                    @Override
+                    public Entry<String, JsonValue> transform(final String name) {
+                        return new Entry<String, JsonValue>() {
+                            @Override
+                            public String getKey() {
+                                return name;
+                            }
+
+                            @Override
+                            public JsonValue getValue() {
+                                return JsonObject.EMPTY;
+                            }
+
+                            @Override
+                            public JsonValue setValue(JsonValue value) {
+                        assert false;
+                        return null;
+                    }
+                };
+            }
+        });
+    }
+
+    private Iterator<? extends Entry<String, JsonValue>> getProperties(NodeDelta delta) {
+        return delta.getProperties().entrySet().iterator();
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,128 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.mk.util.PathUtils;
+
+public class Path {
+    private final String workspace;
+    private final String path;
+
+    private Path(String workspace, String path) {
+        this.workspace = workspace;
+        this.path = path;
+    }
+
+    public static Path create(String workspace) {
+        return create(workspace, "/");
+    }
+
+    public static Path create(String workspace, String path) {
+        if (!path.startsWith("/")) {
+            throw new IllegalArgumentException("Not an absolute path: " + path);
+        }
+        
+        return new Path(workspace, path);
+    }
+
+    public static String mkPath(String workspace, String path) {
+        if (!path.startsWith("/")) {
+            throw new IllegalArgumentException("Not an absolute path: " + path);
+        }
+
+        return buildMkPath(workspace, path);
+    }
+
+    public String getWorkspace() {
+        return workspace;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public String getMkPath() {
+        return buildMkPath(workspace, path);
+    }
+
+    public boolean isRoot() {
+        return "/".equals(path);
+    }
+
+    public Path concat(String relPath) {
+        if (relPath.isEmpty()) {
+            return this;
+        }
+        if (relPath.startsWith("/")) {
+            throw new IllegalArgumentException("Not a relative path: " + relPath);
+        }
+
+        return new Path(workspace, PathUtils.concat(path, relPath));
+    }
+
+    public Path getAncestor(int depth) {
+        if (depth == 0) {
+            return new Path(workspace, "/");
+        }
+
+        int pos = 0;
+        for (int k = 0; k < depth && pos >= 0; k++) {
+            pos = PathUtils.getNextSlash(path, pos + 1);
+        }
+
+        return pos > 0
+            ? new Path(workspace, path.substring(0, pos))
+            : null;
+    }
+
+    public Path getParent() {
+        return isRoot()
+            ? null
+            : new Path(workspace, PathUtils.getParentPath(path));
+    }
+
+    public String getName() {
+        return isRoot()
+            ? ""
+            : PathUtils.getName(path);
+    }
+
+    public String[] getNames() {
+        return PathUtils.split(path);
+    }
+
+    public int getDepth() {
+        return PathUtils.getDepth(path);
+    }
+
+    @Override
+    public String toString() {
+        return workspace + ':' + path;
+    }
+
+    //------------------------------------------< private >---
+
+    private static String buildMkPath(String workspace, String path) {
+        return '/' + ("/".equals(path)
+            ? workspace
+            : workspace + path);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/Path.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,352 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.SessionImpl.Context;
+import org.apache.jackrabbit.json.FullJsonParser;
+import org.apache.jackrabbit.json.JsonValue;
+import org.apache.jackrabbit.json.JsonValue.JsonObject;
+import org.apache.jackrabbit.json.JsonValue.Type;
+import org.apache.jackrabbit.json.UnescapingJsonTokenizer;
+import org.apache.jackrabbit.state.NodeDelta;
+import org.apache.jackrabbit.state.TransientSpace;
+import org.apache.jackrabbit.utils.ValueConverter;
+import org.apache.jackrabbit.mk.api.MicroKernel;
+
+import javax.jcr.Binary;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemVisitor;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.PropertyDefinition;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+public class PropertyImpl extends ItemImpl implements Property {
+    private JsonValue value;
+
+    public static boolean exist(Context sessionContext, Path path) {
+        return getProperty(sessionContext, path) != null;
+    }
+
+    static Property create(Context sessionContext, Path path) throws RepositoryException {
+        JsonValue value = getProperty(sessionContext, path);
+        if (value == null) {
+            throw new PathNotFoundException(path.toString());
+        }
+
+        return new PropertyImpl(sessionContext, path, value);
+    }
+
+    static Property create(Context sessionContext, Path path, JsonValue value) {
+        return new PropertyImpl(sessionContext, path, value);
+    }
+
+    private PropertyImpl(Context sessionContext, Path path, JsonValue value) {
+        super(sessionContext, path);
+        this.value = value;
+    }
+
+    @Override
+    public void remove() throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        transientSpace.removeProperty(path);
+    }
+
+    @Override
+    public void setValue(Value value) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        if (value == null) {
+            remove();
+        }
+        else {
+            transientSpace.setValue(path, ValueConverter.toJsonValue(value));
+        }
+    }
+
+    @Override
+    public void setValue(Value[] values) throws RepositoryException {
+        TransientSpace transientSpace = sessionContext.getTransientSpace();
+        transientSpace.setValue(path, ValueConverter.toJsonValue(values));
+    }
+
+    @Override
+    public void setValue(String value) throws RepositoryException {
+        if (value == null) {
+            remove();
+        }
+        else {
+            ValueFactory valueFactory = sessionContext.getValueFactory();
+            setValue(valueFactory.createValue(value));
+        }
+    }
+
+    @Override
+    public void setValue(String[] stringValues) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        Value[] values = new Value[stringValues.length];
+        for (int k = 0; k < values.length; k++) {
+            values[k] = valueFactory.createValue(stringValues[k]);
+        }
+        setValue(values);
+    }
+
+    @Override
+    public void setValue(InputStream value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(Binary value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(long value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(double value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(BigDecimal value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(Calendar value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(boolean value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public void setValue(Node value) throws RepositoryException {
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        setValue(valueFactory.createValue(value));
+    }
+
+    @Override
+    public Value getValue() throws RepositoryException {
+        JsonValue jsonValue = resolve();
+        if (jsonValue.type().compound()) {
+            throw new ValueFormatException(jsonValue.toJson());
+        }
+
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return ValueConverter.toValue(valueFactory, jsonValue.asAtom());
+    }
+
+    @Override
+    public Value[] getValues() throws RepositoryException {
+        JsonValue jsonValue = resolve();
+        if (jsonValue.type() != Type.ARRAY) {
+            throw new ValueFormatException(jsonValue.toJson());
+        }
+
+        ValueFactory valueFactory = sessionContext.getValueFactory();
+        return ValueConverter.toValue(valueFactory, jsonValue.asArray());
+    }
+
+    @Override
+    public String getString() throws RepositoryException {
+        return getValue().getString();
+    }
+
+    @Override
+    public InputStream getStream() throws RepositoryException {
+        return getValue().getStream();
+    }
+
+    @Override
+    public Binary getBinary() throws RepositoryException {
+        return getValue().getBinary();
+    }
+
+    @Override
+    public long getLong() throws RepositoryException {
+        return getValue().getLong();
+    }
+
+    @Override
+    public double getDouble() throws RepositoryException {
+        return getValue().getDouble();
+    }
+
+    @Override
+    public BigDecimal getDecimal() throws RepositoryException {
+        return getValue().getDecimal();
+    }
+
+    @Override
+    public Calendar getDate() throws RepositoryException {
+        return getValue().getDate();
+    }
+
+    @Override
+    public boolean getBoolean() throws RepositoryException {
+        return getValue().getBoolean();
+    }
+
+    @Override
+    public Node getNode() throws RepositoryException {
+        // todo implement getNode
+        throw new UnsupportedRepositoryOperationException("getNode");
+    }
+
+    @Override
+    public Property getProperty() throws RepositoryException {
+        // todo implement getProperty
+        throw new UnsupportedRepositoryOperationException("getProperty");
+    }
+
+    @Override
+    public long getLength() throws RepositoryException {
+        Value value  = getValue();
+        if (value.getType() == PropertyType.BINARY) {
+            return value.getBinary().getSize();
+        }
+        else {
+            return value.getString().length();
+        }
+    }
+
+    @Override
+    public long[] getLengths() throws RepositoryException {
+        Value[] values = getValues();
+        long[] lengths = new long[values.length];
+
+        for (int k = 0; k < values.length; k++) {
+            if (values[k].getType() == PropertyType.BINARY) {
+                lengths[k] = values[k].getBinary().getSize();
+            }
+            else {
+                lengths[k] = values[k].getString().length();
+            }
+        }
+
+        return lengths;
+    }
+
+    @Override
+    public PropertyDefinition getDefinition() throws RepositoryException {
+        // todo implement getDefinition
+        throw new UnsupportedRepositoryOperationException("getDefinition");
+    }
+
+    @Override
+    public int getType() throws RepositoryException {
+        if (isMultiple()) {
+            Value[] values = getValues();
+            if (values.length == 0) {
+                return PropertyType.UNDEFINED;
+            }
+            else {
+                return values[0].getType();
+            }
+        }
+        else {
+            return getValue().getType();
+        }
+    }
+
+    @Override
+    public boolean isMultiple() throws RepositoryException {
+        return resolve().type() == JsonValue.Type.ARRAY;
+    }
+
+    @Override
+    public boolean isNode() {
+        return false; 
+    }
+
+    @Override
+    public void accept(ItemVisitor visitor) throws RepositoryException {
+        visitor.visit(this);
+    }
+
+    //------------------------------------------< private >---
+
+    private JsonValue resolve() throws RepositoryException {
+        if (isStale()) {
+            JsonValue v = getProperty(sessionContext, path);
+            if (v == null) {
+                throw new InvalidItemStateException(path.toString());
+            }
+
+            value = v;
+            revision = sessionContext.getRevision();
+        }
+        return value;
+    }
+
+    private static JsonValue getProperty(Context sessionContext, Path path) {
+        Path parentPath = path.getParent();
+        NodeDelta delta = sessionContext.getTransientSpace().getNodeDelta(parentPath);
+        if (delta == null) {
+            return null;
+        }
+
+        String name = path.getName();
+        if (delta.hasRemovedProperty(name)) {
+            return null;
+        }
+        if (delta.hasAddedProperty(name)) {
+            return delta.getProperty(name);
+        }
+
+        Path persistedPath = delta.getPersistentPath();
+        if (persistedPath == null) {
+            return null;
+        }
+
+        MicroKernel microkernel = sessionContext.getMicrokernel();
+        String revision = sessionContext.getRevision();
+        if (!microkernel.nodeExists(persistedPath.getMkPath(), revision)) {
+            return null;
+        }
+
+        String nodeJson = microkernel.getNodes(persistedPath.getMkPath(), revision, 0, 0, -1);
+        JsonObject node = FullJsonParser.parseObject(new UnescapingJsonTokenizer(nodeJson));
+        return node.value().get(name);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.configuration.RepositoryConfigurationImpl;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.RepositoryFactory;
+import java.util.Map;
+
+public class RepositoryFactoryImpl implements RepositoryFactory {
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Repository getRepository(Map parameters) throws RepositoryException {
+        GlobalContext context = new GlobalContext(RepositoryConfigurationImpl.create(parameters));
+        return context.getInstance(Repository.class);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java?rev=1212018&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java Thu Dec  8 18:18:42 2011
@@ -0,0 +1,107 @@
+/*
+ * 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;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+
+public class RepositoryImpl implements Repository {
+    static final Logger log = LoggerFactory.getLogger(RepositoryImpl.class);
+
+    private final GlobalContext context;
+    private final Descriptors descriptors;
+
+    private RepositoryImpl(GlobalContext context) {
+        this.context = context;
+        descriptors = new Descriptors(context.getInstance(ValueFactory.class));
+    }
+
+    public static Repository create(GlobalContext context) {
+        return new RepositoryImpl(context);
+    }
+
+    @Override
+    public String[] getDescriptorKeys() {
+        return descriptors.getKeys();
+    }
+
+    @Override
+    public boolean isStandardDescriptor(String key) {
+        return descriptors.isStandardDescriptor(key);
+    }
+
+    @Override
+    public boolean isSingleValueDescriptor(String key) {
+        return descriptors.isSingleValueDescriptor(key);
+    }
+
+    @Override
+    public Value getDescriptorValue(String key) {
+        return descriptors.getValue(key);
+    }
+
+    @Override
+    public Value[] getDescriptorValues(String key) {
+        return descriptors.getValues(key);
+    }
+
+    @Override
+    public String getDescriptor(String key) {
+        try {
+            Value v = getDescriptorValue(key);
+            return v == null
+                ? null
+                : v.getString();
+        }
+        catch (RepositoryException e) {
+            log.debug("Error converting value for descriptor with key {} to string", key);
+            return null;
+        }
+    }
+    
+    @Override
+    public Session login(Credentials credentials, String workspaceName) throws RepositoryException {
+        SessionFactory sessionFactory = context.getInstance(SessionFactory.class);
+        return sessionFactory.createSession(context, credentials, workspaceName);
+    }
+
+    @Override
+    public Session login(Credentials credentials) throws RepositoryException {
+        return login(credentials, null);
+    }
+
+    @Override
+    public Session login(String workspaceName) throws RepositoryException {
+        return login(null, workspaceName);
+    }
+
+    @Override
+    public Session login() throws RepositoryException {
+        return login(null, null);
+    }
+
+}

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/RepositoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message