jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1420887 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype: NodeTypeImpl.java ReadOnlyNodeTypeManager.java ReadWriteNodeTypeManager.java
Date Wed, 12 Dec 2012 17:53:03 GMT
Author: angela
Date: Wed Dec 12 17:53:02 2012
New Revision: 1420887

URL: http://svn.apache.org/viewvc?rev=1420887&view=rev
Log:
OAK-494 : Cleanup ReadOnlyNodeTypeManager  (Work in Progress)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java?rev=1420887&r1=1420886&r2=1420887&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
Wed Dec 12 17:53:02 2012
@@ -98,7 +98,7 @@ class NodeTypeImpl implements NodeType {
 
     @Override
     public String[] getDeclaredSupertypeNames() {
-        return node.getNames(JCR_SUPERTYPES);
+        return node.getNames(JCR_SUPERTYPES, new String[0]);
     }
 
     @Override
@@ -151,8 +151,7 @@ class NodeTypeImpl implements NodeType {
     public NodeType[] getSupertypes() {
         Collection<NodeType> types = new ArrayList<NodeType>();
         Set<String> added = new HashSet<String>();
-        Queue<String> queue = new LinkedList<String>(Arrays.asList(
-                getDeclaredSupertypeNames()));
+        Queue<String> queue = new LinkedList<String>(Arrays.asList(getDeclaredSupertypeNames()));
         while (!queue.isEmpty()) {
             String name = queue.remove();
             if (added.add(name)) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java?rev=1420887&r1=1420886&r2=1420887&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Wed Dec 12 17:53:02 2012
@@ -25,7 +25,6 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.Node;
 import javax.jcr.Property;
-import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
@@ -64,7 +63,6 @@ import static org.apache.jackrabbit.JcrC
 import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.RESIDUAL_NAME;
 
 /**
  * Base implementation of a {@link NodeTypeManager} with support for reading
@@ -459,18 +457,6 @@ public abstract class ReadOnlyNodeTypeMa
             }
         }
 
-        // FIXME: Shouldn't be needed
-        for (NodeType nt : effectiveNodeType.getAllNodeTypes()) {
-            for (PropertyDefinition def : nt.getDeclaredPropertyDefinitions()) {
-                // FIXME: compares oak propertyName with JCR name exposed by def.getName()
-                String defName = def.getName();
-                if ((propertyName.equals(defName) || RESIDUAL_NAME.equals(defName))
-                        && type == PropertyType.STRING
-                        && isMultiple == def.isMultiple()) {
-                    return def;
-                }
-            }
-        }
         throw new ConstraintViolationException("No matching property definition found for
" + propertyName);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java?rev=1420887&r1=1420886&r2=1420887&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
Wed Dec 12 17:53:02 2012
@@ -251,7 +251,10 @@ public abstract class ReadWriteNodeTypeM
         NodeUtil node = new NodeUtil(type, getNamePathMapper());
         node.setName(JCR_PRIMARYTYPE, NT_NODETYPE);
         node.setName(JCR_NODETYPENAME, jcrName);
-        node.setNames(JCR_SUPERTYPES, ntd.getDeclaredSupertypeNames());
+        String[] superTypeNames = ntd.getDeclaredSupertypeNames();
+        if (superTypeNames != null && superTypeNames.length > 0) {
+            node.setNames(JCR_SUPERTYPES, ntd.getDeclaredSupertypeNames());
+        }
         node.setBoolean(JCR_IS_ABSTRACT, ntd.isAbstract());
         node.setBoolean(JCR_IS_QUERYABLE, ntd.isQueryable());
         node.setBoolean(JCR_ISMIXIN, ntd.isMixin());



Mime
View raw message