jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1364635 - in /jackrabbit/oak/trunk: oak-core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/ oak-core/src/main/resources/org/ oak-core/src/main/resources/org/apache/ oak-core/src/main/resources/org/apache/jackrabbit/ oak-co...
Date Mon, 23 Jul 2012 13:57:42 GMT
Author: jukka
Date: Mon Jul 23 13:57:41 2012
New Revision: 1364635

URL: http://svn.apache.org/viewvc?rev=1364635&view=rev
Log:
OAK-66: JCR Node Type Management

Switch to using the new content-base NodeTypeManagerImpl

Added:
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/type/
    jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/type/builtin_nodetypes.cnd
  (contents, props changed)
      - copied, changed from r1364630, jackrabbit/oak/trunk/oak-jcr/src/main/resources/org/apache/jackrabbit/oak/jcr/nodetype/builtin_nodetypes.cnd
Removed:
    jackrabbit/oak/trunk/oak-jcr/src/main/resources/org/apache/jackrabbit/oak/jcr/nodetype/builtin_nodetypes.cnd
Modified:
    jackrabbit/oak/trunk/oak-core/pom.xml
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeUtil.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/PropertyDefinitionImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java

Modified: jackrabbit/oak/trunk/oak-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/pom.xml?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-core/pom.xml Mon Jul 23 13:57:41 2012
@@ -44,6 +44,7 @@
               org.apache.jackrabbit.oak.util,
               org.apache.jackrabbit.oak.namepath,
               org.apache.jackrabbit.oak.plugins.name,
+              org.apache.jackrabbit.oak.plugins.type,
               org.apache.jackrabbit.oak.plugins.value,
               org.apache.jackrabbit.oak.spi.state,
               org.apache.jackrabbit.oak.spi.security.authentication,

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
Mon Jul 23 13:57:41 2012
@@ -51,7 +51,7 @@ class NodeDefinitionImpl extends ItemDef
 
     @Override
     public String[] getRequiredPrimaryTypeNames() {
-        return node.getNames("requiredPrimaryTypes", "nt:base");
+        return node.getNames("jcr:requiredPrimaryTypes", "nt:base");
     }
 
     @Override
@@ -71,7 +71,7 @@ class NodeDefinitionImpl extends ItemDef
 
     @Override
     public String getDefaultPrimaryTypeName() {
-        return node.getName("jcr:defaultPrimaryTypeName", null);
+        return node.getName("jcr:defaultPrimaryType", null);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
Mon Jul 23 13:57:41 2012
@@ -27,6 +27,7 @@ import java.util.Set;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
@@ -59,10 +60,14 @@ class NodeTypeImpl implements NodeType {
 
     private final NodeTypeManager manager;
 
+    private final ValueFactory factory;
+
     private final NodeUtil node;
 
-    public NodeTypeImpl(NodeTypeManager manager, NodeUtil node) {
+    public NodeTypeImpl(
+            NodeTypeManager manager, ValueFactory factory, NodeUtil node) {
         this.manager = manager;
+        this.factory = factory;
         this.node = node;
     }
 
@@ -107,43 +112,44 @@ class NodeTypeImpl implements NodeType {
 
     @Override
     public PropertyDefinition[] getDeclaredPropertyDefinitions() {
-        NodeUtil[] nodes = node.getNodes("jcr:propertyDefinition");
-        PropertyDefinition[] definitions = new PropertyDefinition[nodes.length];
-        for (int i = 0; i < nodes.length; i++) {
-            definitions[i] = new PropertyDefinitionImpl(this, nodes[i]);
+        List<NodeUtil> nodes = node.getNodes("jcr:propertyDefinition");
+        PropertyDefinition[] definitions = new PropertyDefinition[nodes.size()];
+        for (int i = 0; i < nodes.size(); i++) {
+            definitions[i] = new PropertyDefinitionImpl(
+                    this, factory, nodes.get(i));
         }
         return definitions;
     }
 
     @Override
     public NodeDefinition[] getDeclaredChildNodeDefinitions() {
-        NodeUtil[] nodes = node.getNodes("jcr:childNodeDefinition");
-        NodeDefinition[] definitions = new NodeDefinition[nodes.length];
-        for (int i = 0; i < nodes.length; i++) {
-            definitions[i] = new NodeDefinitionImpl(manager, this, nodes[i]);
+        List<NodeUtil> nodes = node.getNodes("jcr:childNodeDefinition");
+        NodeDefinition[] definitions = new NodeDefinition[nodes.size()];
+        for (int i = 0; i < nodes.size(); i++) {
+            definitions[i] = new NodeDefinitionImpl(manager, this, nodes.get(i));
         }
         return definitions;
     }
 
     @Override
     public NodeType[] getSupertypes() {
-        try {
-            Collection<NodeType> types = new ArrayList<NodeType>();
-            Set<String> added = new HashSet<String>();
-            Queue<String> queue = new LinkedList<String>(Arrays.asList(
-                    getDeclaredSupertypeNames()));
-            while (!queue.isEmpty()) {
-                String name = queue.remove();
-                if (added.add(name)) {
+        Collection<NodeType> types = new ArrayList<NodeType>();
+        Set<String> added = new HashSet<String>();
+        Queue<String> queue = new LinkedList<String>(Arrays.asList(
+                getDeclaredSupertypeNames()));
+        while (!queue.isEmpty()) {
+            String name = queue.remove();
+            if (added.add(name)) {
+                try {
                     NodeType type = manager.getNodeType(name);
                     types.add(type);
                     queue.addAll(Arrays.asList(type.getDeclaredSupertypeNames()));
+                } catch (RepositoryException e) {
+                    throw new IllegalStateException("Inconsistent node type: " + this, e);
                 }
             }
-            return types.toArray(new NodeType[types.size()]);
-        } catch (RepositoryException e) {
-            throw new IllegalStateException("Inconsistent node type: " + this, e);
         }
+        return types.toArray(new NodeType[types.size()]);
     }
 
     @Override
@@ -152,7 +158,8 @@ class NodeTypeImpl implements NodeType {
         List<NodeType> types = new ArrayList<NodeType>(names.length);
         for (int i = 0; i < names.length; i++) {
             try {
-                types.add(manager.getNodeType(names[i]));
+                NodeType type = manager.getNodeType(names[i]);
+                types.add(type);
             } catch (RepositoryException e) {
                 log.warn("Unable to access declared supertype "
                         + names[i] + " of " + getName(), e);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
Mon Jul 23 13:57:41 2012
@@ -50,6 +50,7 @@ import org.apache.jackrabbit.oak.core.De
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 
 public class NodeTypeManagerImpl implements NodeTypeManager {
 
@@ -65,23 +66,54 @@ public class NodeTypeManagerImpl impleme
         this.mapper = mapper;
         this.factory = factory;
 
-        try {
-            InputStream stream = NodeTypeManagerImpl.class.getResourceAsStream(
-                    "builtin_nodetypes.cnd");
+        if (session.getCurrentRoot().getTree("/jcr:system/jcr:nodeTypes") == null) {
             try {
-                CompactNodeTypeDefReader<NodeTypeTemplate, Map<String, String>>
reader =
-                        new CompactNodeTypeDefReader<NodeTypeTemplate, Map<String,
String>>(
-                                new InputStreamReader(stream, "UTF-8"), null, new DefBuilderFactory());
-                registerNodeTypes(reader.getNodeTypeDefinitions().toArray(
-                        new NodeTypeTemplate[0]), true);
-            } finally {
-                stream.close();
+                InputStream stream = NodeTypeManagerImpl.class.getResourceAsStream(
+                        "builtin_nodetypes.cnd");
+                try {
+                    CompactNodeTypeDefReader<NodeTypeTemplate, Map<String, String>>
reader =
+                            new CompactNodeTypeDefReader<NodeTypeTemplate, Map<String,
String>>(
+                                    new InputStreamReader(stream, "UTF-8"), null, new DefBuilderFactory());
+                    Map<String, NodeTypeTemplate> templates = Maps.newHashMap();
+                    for (NodeTypeTemplate template : reader.getNodeTypeDefinitions()) {
+                        templates.put(template.getName(), template);
+                    }
+                    for (NodeTypeTemplate template : templates.values()) {
+                        if (!template.isMixin()
+                                && !"nt:base".equals(template.getName())) {
+                            String[] supertypes =
+                                    template.getDeclaredSupertypeNames();
+                            if (supertypes.length == 0) {
+                                template.setDeclaredSuperTypeNames(
+                                        new String[] { "nt:base" });
+                            } else {
+                                // Check whether we need to add the implicit "nt:base" supertype
+                                boolean needsNtBase = true;
+                                for (String name : supertypes) {
+                                    if (!templates.get(name).isMixin()) {
+                                        needsNtBase = false;
+                                    }
+                                }
+                                if (needsNtBase) {
+                                    String[] withBase = new String[supertypes.length + 1];
+                                    withBase[0] = "nt:base";
+                                    System.arraycopy(supertypes, 0, withBase, 1, supertypes.length);
+                                    template.setDeclaredSuperTypeNames(withBase);
+                                }
+                            }
+                        }
+                    }
+                    registerNodeTypes(templates.values().toArray(
+                            new NodeTypeTemplate[templates.size()]), true);
+                } finally {
+                    stream.close();
+                }
+            } catch (Exception e) {
+                throw new IllegalStateException(
+                        "Unable to load built-in node types", e);
             }
-        } catch (Exception e) {
-            throw new IllegalStateException(
-                    "Unable to load built-in node types", e);
         }
-}
+    }
 
     protected String getOakName(String name) throws RepositoryException {
         return name; // TODO
@@ -114,7 +146,7 @@ public class NodeTypeManagerImpl impleme
         if (types != null) {
             Tree type = types.getChild(mapper.getOakName(name));
             if (type != null) {
-                return new NodeTypeImpl(this, new NodeUtil(
+                return new NodeTypeImpl(this, factory, new NodeUtil(
                         session.getCoreValueFactory(), mapper, type));
             }
         }
@@ -128,7 +160,7 @@ public class NodeTypeManagerImpl impleme
                 "/jcr:system/jcr:nodeTypes");
         if (types != null) {
             for (Tree type : types.getChildren()) {
-                list.add(new NodeTypeImpl(this, new NodeUtil(
+                list.add(new NodeTypeImpl(this, factory, new NodeUtil(
                         session.getCoreValueFactory(), mapper, type)));
                 
             }
@@ -243,28 +275,32 @@ public class NodeTypeManagerImpl impleme
             node.setName("jcr:primaryItemName", primaryItemName);
         }
 
-        Tree props = type.addChild("jcr:propertyDefinition");
+        int pdn = 1;
         for (PropertyDefinition pd : ntd.getDeclaredPropertyDefinitions()) {
-            Tree def = props.addChild(mapper.getOakName(pd.getName()));
+            Tree def = type.addChild("jcr:propertyDefinition" + pdn++);
             internalRegisterPropertyDefinition(
                     new NodeUtil(factory, mapper, def), pd);
         }
 
-        Tree nodes = type.addChild("jcr:childNodeDefinition");
+        int ndn = 1;
         for (NodeDefinition nd : ntd.getDeclaredChildNodeDefinitions()) {
-            Tree def = nodes.addChild(mapper.getOakName(nd.getName()));
+            Tree def = type.addChild("jcr:childNodeDefinition" + ndn++);
             internalRegisterNodeDefinition(
                     new NodeUtil(factory, mapper, def), nd);
         }
 
-        return new NodeTypeImpl(this, node);
+        return new NodeTypeImpl(this, this.factory, node);
     }
 
     private void internalRegisterItemDefinition(
             NodeUtil node, ItemDefinition def) {
-        node.setName("jcr:name", def.getName());
+        String name = def.getName();
+        if (!"*".equals(name)) {
+            node.setName("jcr:name", name);
+        }
         node.setBoolean("jcr:autoCreated", def.isAutoCreated());
         node.setBoolean("jcr:mandatory", def.isMandatory());
+        node.setBoolean("jcr:protected", def.isProtected());
         node.setString(
                 "jcr:onParentVersion",
                 OnParentVersionAction.nameFromValue(def.getOnParentVersion()));
@@ -290,7 +326,7 @@ public class NodeTypeManagerImpl impleme
 
         Value[] values = def.getDefaultValues();
         if (values != null) {
-            // TODO: convert to CoreValues
+            node.setValues("jcr:defaultValues", values);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
Mon Jul 23 13:57:41 2012
@@ -32,6 +32,7 @@ import javax.jcr.nodetype.PropertyDefini
 import javax.jcr.nodetype.PropertyDefinitionTemplate;
 
 import org.apache.jackrabbit.commons.cnd.DefinitionBuilderFactory.AbstractNodeTypeDefinitionBuilder;
+import org.apache.jackrabbit.value.ValueFactoryImpl;
 
 class NodeTypeTemplateImpl
     extends AbstractNodeTypeDefinitionBuilder<NodeTypeTemplate>
@@ -57,7 +58,7 @@ class NodeTypeTemplateImpl
     }
 
     public NodeTypeTemplateImpl() {
-        this(null, null);
+        this(null, ValueFactoryImpl.getInstance());
     }
 
     public NodeTypeTemplateImpl(
@@ -117,11 +118,7 @@ class NodeTypeTemplateImpl
             @Override
             protected Value createValue(String value)
                     throws RepositoryException {
-                if (factory != null) {
-                    return factory.createValue(value);
-                } else {
-                    return super.createValue(value);
-                }
+                return factory.createValue(value);
             }
             @Override
             public void build() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeUtil.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeUtil.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeUtil.java
Mon Jul 23 13:57:41 2012
@@ -20,18 +20,28 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
+import org.apache.jackrabbit.value.ValueFactoryImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
 
 /**
  * Utility class for accessing typed content of a node.
  */
 class NodeUtil {
 
+    private static final Logger log = LoggerFactory.getLogger(NodeUtil.class);
+
     private final CoreValueFactory factory;
 
     private final NameMapper mapper;
@@ -135,15 +145,43 @@ class NodeUtil {
         tree.setProperty(name, cvs);
     }
 
-    public NodeUtil[] getNodes(String name) {
-        List<NodeUtil> nodes = new ArrayList<NodeUtil>();
-        Tree child = tree.getChild(name);
-        if (child != null) {
-            for (Tree tree : child.getChildren()) {
-                nodes.add(new NodeUtil(factory, mapper, tree));
+    public List<NodeUtil> getNodes(String namePrefix) {
+        List<NodeUtil> nodes = Lists.newArrayList();
+        for (Tree child : tree.getChildren()) {
+            if (child.getName().startsWith(namePrefix)) {
+                nodes.add(new NodeUtil(factory, mapper, child));
+            }
+        }
+        return nodes;
+    }
+
+    public void setValues(String name, Value[] values) {
+        List<CoreValue> cvs = Lists.newArrayList();
+        for (Value value : values) {
+            try {
+                cvs.add(factory.createValue(value.getString(), value.getType()));
+            } catch (RepositoryException e) {
+                log.warn("Unable to convert a default value", e);
+            }
+        }
+        tree.setProperty(name, cvs);
+    }
+
+    public Value[] getValues(String name, ValueFactory vf) {
+        PropertyState property = tree.getProperty(name);
+        if (property != null) {
+            List<Value> values = Lists.newArrayList();
+            for (CoreValue value : property.getValues()) {
+                try {
+                    values.add(vf.createValue(value.getString(), value.getType()));
+                } catch (RepositoryException e) {
+                    log.warn("Unable to convert a default value", e);
+                }
             }
+            return values.toArray(new Value[values.size()]);
+        } else {
+            return null;
         }
-        return nodes.toArray(new NodeUtil[nodes.size()]);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/PropertyDefinitionImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/PropertyDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/PropertyDefinitionImpl.java
Mon Jul 23 13:57:41 2012
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.plugin
 
 import javax.jcr.PropertyType;
 import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.query.qom.QueryObjectModelConstants;
@@ -47,8 +48,11 @@ class PropertyDefinitionImpl extends Ite
     private static final Logger log =
             LoggerFactory.getLogger(PropertyDefinitionImpl.class);
 
-    public PropertyDefinitionImpl(NodeType type, NodeUtil node) {
+    private final ValueFactory factory;
+
+    public PropertyDefinitionImpl(NodeType type, ValueFactory factory, NodeUtil node) {
         super(type, node);
+        this.factory = factory;
     }
 
     @Override
@@ -70,7 +74,7 @@ class PropertyDefinitionImpl extends Ite
 
     @Override
     public Value[] getDefaultValues() {
-        return new Value[0]; // TODO
+        return node.getValues("jcr:defaultValues", factory);
     }
 
     @Override

Copied: jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/type/builtin_nodetypes.cnd
(from r1364630, jackrabbit/oak/trunk/oak-jcr/src/main/resources/org/apache/jackrabbit/oak/jcr/nodetype/builtin_nodetypes.cnd)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/type/builtin_nodetypes.cnd?p2=jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/type/builtin_nodetypes.cnd&p1=jackrabbit/oak/trunk/oak-jcr/src/main/resources/org/apache/jackrabbit/oak/jcr/nodetype/builtin_nodetypes.cnd&r1=1364630&r2=1364635&rev=1364635&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-core/src/main/resources/org/apache/jackrabbit/oak/plugins/type/builtin_nodetypes.cnd
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Mon Jul 23 13:57:41 2012
@@ -47,6 +47,9 @@ org.apache.jackrabbit.test.api.NodeTest#
 org.apache.jackrabbit.test.api.NodeTest#testMixinTypesProtected<!--OAK-66-->
 org.apache.jackrabbit.test.api.NodeUUIDTest#testSaveReferentialIntegrityException<!--OAK-66-->
 org.apache.jackrabbit.test.api.NodeUUIDTest#testSaveMovedRefNode<!--OAK-66-->
+org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetUUID<!-- OAK-66 -->
+org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUID<!-- OAK-66 -->
+org.apache.jackrabbit.test.api.ExportSysViewTest<!-- OAK-66 -->
 org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforeUnsupportedRepositoryOperationException<!--OAK-169-->
 org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforePlaceAtEndParentSave<!--OAK-169-->
 org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest#testOrderBeforePlaceAtEndSessionSave<!--OAK-169-->

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Mon Jul 23 13:57:41 2012
@@ -46,7 +46,6 @@ public class RepositoryImpl implements R
 
     private final Descriptors descriptors = new Descriptors(new SimpleValueFactory());
     private final ContentRepository contentRepository;
-    private final NodeTypeManagerDelegate nodeTypeManagerDelegate;
 
     private final LazyValue<Timer> observationTimer = new LazyValue<Timer>()
{
         @Override
@@ -57,12 +56,6 @@ public class RepositoryImpl implements R
 
     public RepositoryImpl(ContentRepository contentRepository) {
         this.contentRepository = contentRepository;
-        try {
-            nodeTypeManagerDelegate = new NodeTypeManagerDelegate();
-        }
-        catch (RepositoryException ex) {
-            throw new RuntimeException(ex);
-        }
     }
 
     /**
@@ -139,7 +132,7 @@ public class RepositoryImpl implements R
         // TODO: needs complete refactoring
         try {
             ContentSession contentSession = contentRepository.login(credentials, workspaceName);
-            return new SessionDelegate(this, nodeTypeManagerDelegate, observationTimer, contentSession).getSession();
+            return new SessionDelegate(this, observationTimer, contentSession).getSession();
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage());
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Mon Jul 23 13:57:41 2012
@@ -51,7 +51,6 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.DefaultConflictHandler;
-import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerDelegate;
 import org.apache.jackrabbit.oak.jcr.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.oak.jcr.util.LazyValue;
 import org.apache.jackrabbit.oak.jcr.value.ValueFactoryImpl;
@@ -67,7 +66,6 @@ public class SessionDelegate {
 
     private final NamePathMapper namePathMapper = new NamePathMapperImpl(new SessionNameMapper());
     private final Repository repository;
-    private final NodeTypeManagerDelegate nodeTypeManagerDelegate;
     private final LazyValue<Timer> observationTimer;
     private final ContentSession contentSession;
     private final ValueFactoryImpl valueFactory;
@@ -79,13 +77,12 @@ public class SessionDelegate {
     private ObservationManagerImpl observationManager;
     private boolean isAlive = true;
 
-    SessionDelegate(Repository repository, NodeTypeManagerDelegate nodeTypeManagerDelegate,
LazyValue<Timer> observationTimer, ContentSession contentSession)
+    SessionDelegate(Repository repository, LazyValue<Timer> observationTimer, ContentSession
contentSession)
             throws RepositoryException {
         assert repository != null;
         assert contentSession != null;
 
         this.repository = repository;
-        this.nodeTypeManagerDelegate = nodeTypeManagerDelegate;
         this.observationTimer = observationTimer;
         this.contentSession = contentSession;
         this.valueFactory = new ValueFactoryImpl(contentSession.getCoreValueFactory(), namePathMapper);
@@ -114,11 +111,6 @@ public class SessionDelegate {
         return repository;
     }
 
-    @Nonnull
-    public NodeTypeManagerDelegate getNodeTypeManagerDelegate() {
-        return nodeTypeManagerDelegate;
-    }
-
     public void logout() {
         if (!isAlive) {
             // ignore

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1364635&r1=1364634&r2=1364635&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Mon Jul 23 13:57:41 2012
@@ -34,11 +34,10 @@ import org.apache.jackrabbit.api.Jackrab
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.lock.LockManagerImpl;
-import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerDelegate;
-import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
 import org.apache.jackrabbit.oak.jcr.security.privilege.PrivilegeManagerImpl;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceRegistryImpl;
+import org.apache.jackrabbit.oak.plugins.type.NodeTypeManagerImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -55,7 +54,6 @@ public class WorkspaceImpl implements Ja
     private static final Logger log = LoggerFactory.getLogger(WorkspaceImpl.class);
 
     private final SessionDelegate sessionDelegate;
-    private final NodeTypeManager nodeTypeManager;
     private final QueryManagerImpl queryManager;
 
     private final LockManager lockManager;
@@ -63,7 +61,6 @@ public class WorkspaceImpl implements Ja
     public WorkspaceImpl(SessionDelegate sessionDelegate)
             throws RepositoryException {
         this.sessionDelegate = sessionDelegate;
-        this.nodeTypeManager = new NodeTypeManagerImpl(sessionDelegate, sessionDelegate.getNodeTypeManagerDelegate());
         this.queryManager = new QueryManagerImpl(sessionDelegate);
         this.lockManager = new LockManagerImpl(sessionDelegate.getSession());
     }
@@ -157,7 +154,10 @@ public class WorkspaceImpl implements Ja
 
     @Override
     public NodeTypeManager getNodeTypeManager() {
-        return nodeTypeManager;
+        return new NodeTypeManagerImpl(
+                sessionDelegate.getContentSession(),
+                sessionDelegate.getNamePathMapper(),
+                sessionDelegate.getValueFactory());
     }
 
     @Override



Mime
View raw message