Author: mreutegg
Date: Thu Nov 14 12:41:36 2013
New Revision: 1541892

URL: http://svn.apache.org/r1541892
Log:
OAK-1126: Same node and property name support
- revert changes. they introduce a dependency from oak-jcr to an internal 
oak-core package

Added:
    
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/Descriptors.java
      - copied unchanged from r1541781, 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/Descriptors.java
Removed:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Descriptors.java
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/DescriptorsImpl.java
    
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/JcrDescriptorsImpl.java
    
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/SameNamePropertyNodeTest.java
Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/RepositoryImpl.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java?rev=1541892&r1=1541891&r2=1541892&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentRepository.java
 Thu Nov 14 12:41:36 2013
@@ -83,12 +83,4 @@ public interface ContentRepository {
     ContentSession login(@Nullable Credentials credentials, @Nullable String 
workspaceName)
             throws LoginException, NoSuchWorkspaceException;
 
-    /**
-     * Returns the repository descriptors which contain all or a subset of the 
descriptors defined in
-     * {@link javax.jcr.Repository}.
-     *
-     * @return the repository descriptors
-     */
-    @Nonnull
-    Descriptors getDescriptors();
 }

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1541892&r1=1541891&r2=1541892&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
 Thu Nov 14 12:41:36 2013
@@ -16,25 +16,16 @@
  */
 package org.apache.jackrabbit.oak.core;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.jcr.Credentials;
 import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.PropertyType;
-import javax.jcr.Repository;
-import javax.jcr.Value;
-import javax.jcr.ValueFactory;
 import javax.security.auth.login.LoginException;
 
-import org.apache.jackrabbit.commons.SimpleValueFactory;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.Descriptors;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
@@ -44,59 +35,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import 
org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-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.REP_VERSION_DESC;
-import static javax.jcr.Repository.SPEC_NAME_DESC;
-import static javax.jcr.Repository.SPEC_VERSION_DESC;
-import static javax.jcr.Repository.WRITE_SUPPORTED;
-
 /**
  * {@code MicroKernel}-based implementation of
  * the {@link ContentRepository} interface.
@@ -109,8 +47,6 @@ public class ContentRepositoryImpl imple
     private final SecurityProvider securityProvider;
     private final QueryIndexProvider indexProvider;
 
-    private DescriptorsImpl descriptors;
-    
     /**
      * Creates an content repository instance based on the given, already
      * initialized components.
@@ -158,222 +94,4 @@ public class ContentRepositoryImpl imple
         return nodeStore;
     }
 
-    @Nonnull
-    @Override
-    public Descriptors getDescriptors() {
-        if (descriptors == null) {
-            descriptors = createDescriptors();
-        }
-        return descriptors;
-    }
-    
-    @SuppressWarnings("deprecation")
-    @Nonnull
-    protected DescriptorsImpl createDescriptors() {
-        final ValueFactory valueFactory = new SimpleValueFactory();
-        final Value trueValue = valueFactory.createValue(true);
-        final Value falseValue = valueFactory.createValue(false);
-        DescriptorsImpl d = new DescriptorsImpl();
-        d.put(new DescriptorsImpl.Descriptor(
-                IDENTIFIER_STABILITY,
-                
valueFactory.createValue(Repository.IDENTIFIER_STABILITY_METHOD_DURATION), 
true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                LEVEL_1_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                LEVEL_2_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_INHERITANCE,
-                
valueFactory.createValue(NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE), true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.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));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_ACCESS_CONTROL_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_JOURNALED_OBSERVATION_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_LIFECYCLE_SUPPORTED,
-                falseValue, true, true));
-        // locking support added via JCR layer
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_LOCKING_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_OBSERVATION_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED,
-                supportsSameNameNodeAndProperties() ? trueValue : falseValue, 
true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_QUERY_SQL_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_RETENTION_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_SHAREABLE_NODES_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_SIMPLE_VERSIONING_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_TRANSACTIONS_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_UNFILED_CONTENT_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_VERSIONING_SUPPORTED,
-                trueValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_WORKSPACE_MANAGEMENT_SUPPORTED,
-                trueValue, true, true));
-        // xml export support added via JCR layer
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_XML_EXPORT_SUPPORTED,
-                falseValue, true, true));
-        // xml import support added via JCR layer
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_XML_IMPORT_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_ACTIVITIES_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                OPTION_BASELINES_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                QUERY_FULL_TEXT_SEARCH_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                QUERY_JOINS,
-                valueFactory.createValue(QUERY_JOINS_NONE), true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                QUERY_LANGUAGES,
-                new Value[0], false, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                QUERY_STORED_QUERIES_SUPPORTED,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                QUERY_XPATH_DOC_ORDER,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                QUERY_XPATH_POS_INDEX,
-                falseValue, true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                REP_NAME_DESC,
-                valueFactory.createValue("Apache Jackrabbit Oak"), true, 
true));
-        d.put(new DescriptorsImpl.Descriptor(
-                REP_VERSION_DESC,
-                valueFactory.createValue(getVersion()), true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                REP_VENDOR_DESC,
-                valueFactory.createValue("The Apache Software Foundation"), 
true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                REP_VENDOR_URL_DESC,
-                valueFactory.createValue("http://www.apache.org/";), true, 
true));
-        d.put(new DescriptorsImpl.Descriptor(
-                SPEC_NAME_DESC,
-                valueFactory.createValue("Content Repository for Java 
Technology API"), true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                SPEC_VERSION_DESC,
-                valueFactory.createValue("2.0"), true, true));
-        d.put(new DescriptorsImpl.Descriptor(
-                WRITE_SUPPORTED,
-                trueValue, true, true));
-
-        return d;
-    }
-
-    /**
-     * Checks if this repository supports same name node and properties. 
currently this is tied to the underlying
-     * node store implementation class.
-     *
-     * @return {@code true} if this repository supports SNNP.
-     */
-    private boolean supportsSameNameNodeAndProperties() {
-        return !(nodeStore instanceof KernelNodeStore);
-    }
-
-    /**
-     * Returns the version of this repository implementation.
-     * @return the version
-     */
-    @Nonnull
-    private static String getVersion() {
-        InputStream stream = ContentRepositoryImpl.class.getResourceAsStream(
-                
"/META-INF/maven/org.apache.jackrabbit/oak-core/pom.properties");
-        if (stream != null) {
-            try {
-                try {
-                    Properties properties = new Properties();
-                    properties.load(stream);
-                    return properties.getProperty("version");
-                } finally {
-                    stream.close();
-                }
-            } catch (IOException e) {
-                // ignore
-            }
-        }
-        return "SNAPSHOT";
-    }
 }

Modified: 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/RepositoryImpl.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/RepositoryImpl.java?rev=1541892&r1=1541891&r2=1541892&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/RepositoryImpl.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/RepositoryImpl.java
 Thu Nov 14 12:41:36 2013
@@ -37,8 +37,6 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.commons.SimpleValueFactory;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.Descriptors;
-import org.apache.jackrabbit.oak.core.DescriptorsImpl;
 import org.apache.jackrabbit.oak.jcr.session.RefreshStrategy;
 import org.apache.jackrabbit.oak.jcr.session.RefreshStrategy.LogOnce;
 import org.apache.jackrabbit.oak.jcr.session.RefreshStrategy.Once;
@@ -69,7 +67,7 @@ public class RepositoryImpl implements J
      */
     public static final String REFRESH_INTERVAL = "oak.refresh-interval";
 
-    protected final DescriptorsImpl descriptors;
+    private final Descriptors descriptors;
     private final ContentRepository contentRepository;
     protected final Whiteboard whiteboard;
     private final SecurityProvider securityProvider;
@@ -241,8 +239,8 @@ public class RepositoryImpl implements J
      * by the subclasses to add more values to the descriptor
      * @return  repository descriptor
      */
-    protected DescriptorsImpl determineDescriptors() {
-        return new JcrDescriptorsImpl(contentRepository.getDescriptors(), new 
SimpleValueFactory());
+    protected Descriptors determineDescriptors() {
+        return new Descriptors(new SimpleValueFactory());
     }
 
     /**


Reply via email to