jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1170865 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype: EffectiveNodeType.java EffectiveNodeTypeImpl.java ItemDefinitionProviderImpl.java NodeTypeRegistryImpl.java
Date Wed, 14 Sep 2011 22:00:34 GMT
Author: mduerig
Date: Wed Sep 14 22:00:33 2011
New Revision: 1170865

URL: http://svn.apache.org/viewvc?rev=1170865&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: remove EffectiveNodeType interface

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
      - copied, changed from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
(from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java&r1=1170856&r2=1170865&rev=1170865&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
Wed Sep 14 22:00:33 2011
@@ -43,8 +43,8 @@ import java.util.TreeSet;
  * <p/>
  * Instances of {@code EffectiveNodeType} are immutable.
  */
-public class EffectiveNodeTypeImpl implements EffectiveNodeType {
-    private static final Logger log = LoggerFactory.getLogger(EffectiveNodeTypeImpl.class);
+public class EffectiveNodeType {
+    private static final Logger log = LoggerFactory.getLogger(EffectiveNodeType.class);
 
     /** list of explicitly aggregated {i.e. merged) node types */
     private final TreeSet<Name> mergedNodeTypes = new TreeSet<Name>();
@@ -64,9 +64,9 @@ public class EffectiveNodeTypeImpl imple
     /** (optional) set of additional mixins supported on node type */
     private Set<Name> supportedMixins;
 
-    EffectiveNodeTypeImpl(TreeSet<Name> mergedNodeTypes, TreeSet<Name> inheritedNodeTypes,
TreeSet<Name> allNodeTypes,
-            Map<Name, List<QItemDefinition>> namedItemDefs, List<QItemDefinition>
unnamedItemDefs,
-            Set<Name> supportedMixins) {
+    EffectiveNodeType(TreeSet<Name> mergedNodeTypes, TreeSet<Name> inheritedNodeTypes,
TreeSet<Name> allNodeTypes,
+                      Map<Name, List<QItemDefinition>> namedItemDefs, List<QItemDefinition>
unnamedItemDefs,
+                      Set<Name> supportedMixins) {
 
         this.mergedNodeTypes.addAll(mergedNodeTypes);
         this.inheritedNodeTypes.addAll(inheritedNodeTypes);
@@ -84,22 +84,18 @@ public class EffectiveNodeTypeImpl imple
 
     //--------------------------------------------------< EffectiveNodeType >---
 
-    @Override
     public Name[] getInheritedNodeTypes() {
         return inheritedNodeTypes.toArray(new Name[inheritedNodeTypes.size()]);
     }
 
-    @Override
     public Name[] getAllNodeTypes() {
         return allNodeTypes.toArray(new Name[allNodeTypes.size()]);
     }
 
-    @Override
     public Name[] getMergedNodeTypes() {
         return mergedNodeTypes.toArray(new Name[mergedNodeTypes.size()]);
     }
 
-    @Override
     public QNodeDefinition[] getAllQNodeDefinitions() {
         if (namedItemDefs.isEmpty() && unnamedItemDefs.isEmpty()) {
             return QNodeDefinition.EMPTY_ARRAY;
@@ -124,7 +120,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QNodeDefinition[defs.size()]);
     }
 
-    @Override
     public QPropertyDefinition[] getAllQPropertyDefinitions() {
         if (namedItemDefs.isEmpty() && unnamedItemDefs.isEmpty()) {
             return QPropertyDefinition.EMPTY_ARRAY;
@@ -148,7 +143,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QPropertyDefinition[defs.size()]);
     }
 
-    @Override
     public QNodeDefinition[] getAutoCreateQNodeDefinitions() {
         // since auto-create items must have a name,
         // we're only searching the named item definitions
@@ -169,7 +163,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QNodeDefinition[defs.size()]);
     }
 
-    @Override
     public QPropertyDefinition[] getAutoCreateQPropertyDefinitions() {
         // since auto-create items must have a name,
         // we're only searching the named item definitions
@@ -190,7 +183,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QPropertyDefinition[defs.size()]);
     }
 
-    @Override
     public QPropertyDefinition[] getMandatoryQPropertyDefinitions() {
         // since mandatory items must have a name,
         // we're only searching the named item definitions
@@ -211,7 +203,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QPropertyDefinition[defs.size()]);
     }
 
-    @Override
     public QNodeDefinition[] getMandatoryQNodeDefinitions() {
         // since mandatory items must have a name,
         // we're only searching the named item definitions
@@ -232,7 +223,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QNodeDefinition[defs.size()]);
     }
 
-    @Override
     public QNodeDefinition[] getNamedQNodeDefinitions(Name name) {
         List<QItemDefinition> list = namedItemDefs.get(name);
         if (list == null || list.isEmpty()) {
@@ -250,7 +240,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QNodeDefinition[defs.size()]);
     }
 
-    @Override
     public QNodeDefinition[] getUnnamedQNodeDefinitions() {
         if (unnamedItemDefs.isEmpty()) {
             return QNodeDefinition.EMPTY_ARRAY;
@@ -267,7 +256,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QNodeDefinition[defs.size()]);
     }
 
-    @Override
     public QPropertyDefinition[] getNamedQPropertyDefinitions(Name name) {
         List<QItemDefinition> list = namedItemDefs.get(name);
         if (list == null || list.isEmpty()) {
@@ -285,7 +273,6 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QPropertyDefinition[defs.size()]);
     }
 
-    @Override
     public QPropertyDefinition[] getUnnamedQPropertyDefinitions() {
         if (unnamedItemDefs.isEmpty()) {
             return QPropertyDefinition.EMPTY_ARRAY;
@@ -302,22 +289,46 @@ public class EffectiveNodeTypeImpl imple
         return defs.toArray(new QPropertyDefinition[defs.size()]);
     }
 
-    @Override
+    /**
+     * Determines whether this effective node type representation includes
+     * (either through inheritance or aggregation) the given node type.
+     *
+     * @param nodeTypeName name of node type
+     * @return {@code true} if the given node type is included, otherwise
+     *         {@code false}
+     */
     public boolean includesNodeType(Name nodeTypeName) {
         return allNodeTypes.contains(nodeTypeName);
     }
 
-    @Override
+    /**
+     * Determines whether this effective node type representation includes
+     * (either through inheritance or aggregation) all of the given node types.
+     *
+     * @param nodeTypeNames array of node type names
+     * @return {@code true} if all of the given node types are included,
+     *         otherwise {@code false}
+     */
     public boolean includesNodeTypes(Name[] nodeTypeNames) {
         return allNodeTypes.containsAll(Arrays.asList(nodeTypeNames));
     }
 
-    @Override
+    /**
+     * Determines whether this effective node type supports adding
+     * the specified mixin.
+     * @param mixin name of mixin type
+     * @return {@code true} if the mixin type is supported, otherwise
+     *         {@code false}
+     */
     public boolean supportsMixin(Name mixin) {
         return supportedMixins == null || supportedMixins.contains(mixin);
     }
 
-    @Override
+    /**
+     * @param name
+     * @param definitionProvider
+     * @throws ConstraintViolationException
+     */
     public void checkAddNodeConstraints(Name name, ItemDefinitionProvider definitionProvider)
             throws ConstraintViolationException {
         try {
@@ -329,7 +340,11 @@ public class EffectiveNodeTypeImpl imple
         }
     }
 
-    @Override
+    /**
+     * @param name
+     * @param nodeTypeDefinition
+     *@param definitionProvider  @throws ConstraintViolationException  @throws NoSuchNodeTypeException
+     */
     public void checkAddNodeConstraints(Name name, QNodeTypeDefinition nodeTypeDefinition,
             ItemDefinitionProvider definitionProvider)
 
@@ -349,13 +364,27 @@ public class EffectiveNodeTypeImpl imple
         }
     }
 
-    @Override
+    /**
+     * Returns {@code true} if a single node definition matching the
+     * specified {@code nodeName} is either mandatory or protected.
+     *
+     * @param nodeName
+     * @return {@code true} if a single node definition matching the
+     * specified {@code nodeName} is either mandatory or protected.
+     */
     public boolean hasRemoveNodeConstraint(Name nodeName) {
         QNodeDefinition[] defs = getNamedQNodeDefinitions(nodeName);
         return hasRemoveConstraint(defs);
     }
 
-    @Override
+    /**
+     * Returns {@code true} if a single property definition matching the
+     * specified {@code propertyName} is either mandatory or protected.
+     *
+     * @param propertyName
+     * @return {@code true} if a single property definition matching the
+     * specified {@code propertyName} is either mandatory or protected.
+     */
     public boolean hasRemovePropertyConstraint(Name propertyName) {
         QPropertyDefinition[] defs = getNamedQPropertyDefinitions(propertyName);
         return hasRemoveConstraint(defs);
@@ -416,10 +445,10 @@ public class EffectiveNodeTypeImpl imple
      * @return
      * @throws ConstraintViolationException
      */
-    EffectiveNodeTypeImpl merge(EffectiveNodeTypeImpl other) throws ConstraintViolationException
{
+    EffectiveNodeType merge(EffectiveNodeType other) throws ConstraintViolationException
{
         // create a copy of this instance and perform the merge on the copy to avoid a potentially
         // inconsistent state of this instance if an exception is thrown during the merge.
-        EffectiveNodeTypeImpl copy = new EffectiveNodeTypeImpl(mergedNodeTypes, inheritedNodeTypes,
allNodeTypes,
+        EffectiveNodeType copy = new EffectiveNodeType(mergedNodeTypes, inheritedNodeTypes,
allNodeTypes,
                 namedItemDefs, unnamedItemDefs, supportedMixins);
 
         copy.internalMerge(other, false);
@@ -439,7 +468,7 @@ public class EffectiveNodeTypeImpl imple
      *                  the merge is the result of an explicit aggregation
      * @throws ConstraintViolationException
      */
-    synchronized void internalMerge(EffectiveNodeTypeImpl other, boolean supertype)
+    synchronized void internalMerge(EffectiveNodeType other, boolean supertype)
             throws ConstraintViolationException {
         Name[] nta = other.getAllNodeTypes();
         int includedCount = 0;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java?rev=1170865&r1=1170864&r2=1170865&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
Wed Sep 14 22:00:33 2011
@@ -16,17 +16,11 @@
  */
 package org.apache.jackrabbit.jcr2spi.nodetype;
 
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.PropertyId;
-import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.RepositoryService;
@@ -34,6 +28,11 @@ import org.apache.jackrabbit.spi.Session
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+
 /**
  * {@code ItemDefinitionManagerImpl}...
  */

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java?rev=1170865&r1=1170864&r2=1170865&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java
Wed Sep 14 22:00:33 2011
@@ -358,14 +358,14 @@ public class NodeTypeRegistryImpl implem
         }
 
         // create empty effective node type instance
-        EffectiveNodeTypeImpl ent = new EffectiveNodeTypeImpl(mergedNodeTypes,
+        EffectiveNodeType ent = new EffectiveNodeType(mergedNodeTypes,
                 inheritedNodeTypes, allNodeTypes, namedItemDefs,
                 unnamedItemDefs, supportedMixins);
 
         // resolve supertypes recursively
         Name[] supertypes = ntd.getSupertypes();
         if (supertypes.length > 0) {
-            EffectiveNodeTypeImpl effSuperType = (EffectiveNodeTypeImpl) getEffectiveNodeType(supertypes,
ntdMap);
+            EffectiveNodeType effSuperType = getEffectiveNodeType(supertypes, ntdMap);
             ent.internalMerge(effSuperType, true);
         }
         return ent;
@@ -438,14 +438,14 @@ public class NodeTypeRegistryImpl implem
 
         // 3. build aggregate
         EffectiveNodeTypeCache.Key requested = key;
-        EffectiveNodeTypeImpl result = null;
+        EffectiveNodeType result = null;
         synchronized (entCache) {
             // build list of 'best' existing sub-aggregates
             while (key.getNames().length > 0) {
                 // find the (sub) key that matches the current key the best
                 EffectiveNodeTypeCache.Key subKey = entCache.findBest(key);
                 if (subKey != null) {
-                    EffectiveNodeTypeImpl ent = (EffectiveNodeTypeImpl) entCache.get(subKey);
+                    EffectiveNodeType ent = entCache.get(subKey);
                     if (result == null) {
                         result = ent;
                     } else {
@@ -464,9 +464,9 @@ public class NodeTypeRegistryImpl implem
                         // store new effective node type
                         entCache.put(ent);
                         if (result == null) {
-                            result = (EffectiveNodeTypeImpl) ent;
+                            result = ent;
                         } else {
-                            result = result.merge((EffectiveNodeTypeImpl) ent);
+                            result = result.merge(ent);
                             // store intermediate result (sub-aggregate)
                             entCache.put(result);
                         }



Mime
View raw message