jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r650514 - in /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ nodetype/ state/ xml/
Date Tue, 22 Apr 2008 13:15:49 GMT
Author: angela
Date: Tue Apr 22 06:15:43 2008
New Revision: 650514

URL: http://svn.apache.org/viewvc?rev=650514&view=rev
Log:
JCR-1547: JCR2SPI: remove dependency to state-package within nodetype package

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Tue Apr 22 06:15:43 2008
@@ -1262,7 +1262,7 @@
         throws ItemExistsException, NoSuchNodeTypeException, VersionException,
         ConstraintViolationException, LockException, RepositoryException {
 
-        QNodeDefinition definition = session.getItemDefinitionProvider().getQNodeDefinition(getNodeState(),
nodeName, nodeTypeName);
+        QNodeDefinition definition = session.getItemDefinitionProvider().getQNodeDefinition(getNodeState().getAllNodeTypeNames(),
nodeName, nodeTypeName);
         if (nodeTypeName == null) {
             // use default node type
             nodeTypeName = definition.getDefaultPrimaryType();
@@ -1555,7 +1555,7 @@
             }
         } catch (PathNotFoundException e) {
             // item does not exist -> ignore and return null
-        } catch (org.apache.jackrabbit.spi.commons.conversion.NameException e) {
+        } catch (NameException e) {
             String msg = "Invalid relative path: " + relPath;
             log.debug(msg);
             throw new RepositoryException(msg, e);
@@ -1598,7 +1598,7 @@
                     // ignore -> return null;
                 }
             }
-        } catch (org.apache.jackrabbit.spi.commons.conversion.NameException e) {
+        } catch (NameException e) {
             String msg = "failed to resolve property path " + relPath + " relative to " +
safeGetJCRPath();
             log.debug(msg);
             throw new RepositoryException(msg, e);
@@ -1622,6 +1622,6 @@
                                                                 int type,
                                                                 boolean multiValued)
             throws ConstraintViolationException, RepositoryException {
-        return session.getItemDefinitionProvider().getQPropertyDefinition(getNodeState(),
propertyName, type, multiValued);
+        return session.getItemDefinitionProvider().getQPropertyDefinition(getNodeState().getAllNodeTypeNames(),
propertyName, type, multiValued);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java
Tue Apr 22 06:15:43 2008
@@ -18,9 +18,9 @@
 
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.NodeId;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -43,17 +43,22 @@
     /**
      * Returns the <code>QNodeDefinition</code> for the specified node state.
      *
-     * @param nodeState
+     * @param parentNodeTypeNames
+     * @param nodeName
+     * @param ntName
+     * @param nodeId
      * @return the <code>QNodeDefinition</code> for the specified node state.
      * @throws RepositoryException
      */
-    public QNodeDefinition getQNodeDefinition(NodeState nodeState) throws RepositoryException;
+    public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames,
+                                              Name nodeName, Name ntName,
+                                              NodeId nodeId) throws RepositoryException;
 
     /**
      * Returns the applicable child node definition for a child node with the
      * specified name and node type.
      *
-     * @param parentState
+     * @param parentNodeTypeNames
      * @param name
      * @param nodeTypeName
      * @return
@@ -61,7 +66,8 @@
      * @throws ConstraintViolationException if no applicable child node definition
      * could be found
      */
-    public QNodeDefinition getQNodeDefinition(NodeState parentState, Name name, Name nodeTypeName)
+    public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames,
+                                              Name name, Name nodeTypeName)
             throws NoSuchNodeTypeException, ConstraintViolationException;
 
     /**
@@ -76,7 +82,8 @@
      * @throws ConstraintViolationException if no applicable child node definition
      * could be found
      */
-    public QNodeDefinition getQNodeDefinition(EffectiveNodeType ent, Name name, Name nodeTypeName)
+    public QNodeDefinition getQNodeDefinition(EffectiveNodeType ent,
+                                              Name name, Name nodeTypeName)
             throws NoSuchNodeTypeException, ConstraintViolationException;
 
     /**
@@ -85,7 +92,23 @@
      * @return the <code>QPropertyDefinition</code> for the specified property
state.
      * @throws RepositoryException
      */
-    public QPropertyDefinition getQPropertyDefinition(PropertyState propertyState) throws
RepositoryException;
+    /**
+     * Returns the <code>QPropertyDefinition</code> for the specified parameters.
+     *
+     * @param parentNodeTypeNames
+     * @param propertyName
+     * @param propertType
+     * @param isMultiValued
+     * @param propertyId Used to retrieve the definition from the persistent
+     * layer if it cannot be determined from the information present.
+     * @return
+     * @throws RepositoryException
+     */
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
+                                                      Name propertyName,
+                                                      int propertType,
+                                                      boolean isMultiValued,
+                                                      PropertyId propertyId) throws RepositoryException;
 
     /**
      * Returns the applicable property definition for a property with the
@@ -118,7 +141,7 @@
      * with required type UNDEFINED</li>
      * </ul>
      *
-     * @param parentState
+     * @param parentNodeTypeNames
      * @param name
      * @param type
      * @param multiValued
@@ -126,7 +149,7 @@
      * @throws ConstraintViolationException if no applicable property definition
      * could be found.
      */
-    public QPropertyDefinition getQPropertyDefinition(NodeState parentState,
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
                                                       Name name, int type,
                                                       boolean multiValued)
             throws ConstraintViolationException, NoSuchNodeTypeException;
@@ -135,7 +158,7 @@
      * Returns the applicable property definition for a property with the
      * specified name and type. The multiValued flag is not taken into account
      * in the selection algorithm. Other than
-     * <code>{@link #getQPropertyDefinition(NodeState, Name, int, boolean)}</code>
+     * <code>{@link #getQPropertyDefinition(Name[], Name, int, boolean)}</code>
      * this method does not take the multiValued flag into account in the
      * selection algorithm. If there more than one applicable definitions then
      * the following rules are applied:
@@ -146,14 +169,14 @@
      * <li>single-value definitions are preferred to multiple-value definitions</li>
      * </ul>
      *
-     * @param parentState
+     * @param parentNodeTypeNames
      * @param name
      * @param type
      * @return
      * @throws ConstraintViolationException if no applicable property definition
      *                                      could be found
      */
-    public QPropertyDefinition getQPropertyDefinition(NodeState parentState,
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
                                                       Name name, int type)
             throws ConstraintViolationException, NoSuchNodeTypeException;
 }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
Tue Apr 22 06:15:43 2008
@@ -23,10 +23,9 @@
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.QItemDefinition;
-import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.NodeId;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.PropertyType;
@@ -67,27 +66,19 @@
     /**
      * @inheritDoc
      */
-    public QNodeDefinition getQNodeDefinition(NodeState nodeState) throws RepositoryException
{
-        if (nodeState.getHierarchyEntry().getParent() == null) {
+    public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames,
+                                              Name nodeName, Name ntName,
+                                              NodeId nodeId) throws RepositoryException {
+        if (parentNodeTypeNames == null) {
             return getRootNodeDefinition();
         }
         QNodeDefinition definition;
         try {
-            /*
-             Don't use 'getEffectiveNodeType(NodeState.getAllNodeTypeNames()) here:
-             for NEW-states the definition is always set upon creation.
-             for all other states the definion must be retrieved only taking
-             the effective nodetypes present on the parent into account
-             any kind of transiently added mixins must not have an effect
-             on the definition retrieved for an state that has been persisted
-             before. The effective NT must be evaluated as if it had been
-             evaluated upon creating the workspace state.
-             */
-            EffectiveNodeType ent = entProvider.getEffectiveNodeType(nodeState.getParent().getNodeTypeNames());
-            EffectiveNodeType entTarget = getEffectiveNodeType(nodeState.getNodeTypeName());
-            definition = getQNodeDefinition(ent, entTarget, nodeState.getName());
+            EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
+            EffectiveNodeType entTarget = getEffectiveNodeType(ntName);
+            definition = getQNodeDefinition(ent, entTarget, nodeName);
         } catch (RepositoryException e) {
-            definition = service.getNodeDefinition(sessionInfo, nodeState.getNodeEntry().getWorkspaceId());
+            definition = service.getNodeDefinition(sessionInfo, nodeId);
         }
         return definition;
     }
@@ -95,9 +86,9 @@
    /**
      * @inheritDoc
      */
-    public QNodeDefinition getQNodeDefinition(NodeState parentState, Name name, Name nodeTypeName)
+   public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames, Name name, Name
nodeTypeName)
             throws NoSuchNodeTypeException, ConstraintViolationException {
-       EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentState.getAllNodeTypeNames());
+       EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
        EffectiveNodeType entTarget = getEffectiveNodeType(nodeTypeName);
        return getQNodeDefinition(ent, entTarget, name);
     }
@@ -113,23 +104,17 @@
     /**
      * @inheritDoc
      */
-    public QPropertyDefinition getQPropertyDefinition(PropertyState propertyState) throws
RepositoryException {
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
+                                                      Name propertyName,
+                                                      int propertType,
+                                                      boolean isMultiValued,
+                                                      PropertyId propertyId) throws RepositoryException
{
         QPropertyDefinition definition;
         try {
-            /*
-             Don't use 'getEffectiveNodeType(NodeState) here:
-             for NEW-states the definition is always set upon creation.
-             for all other states the definion must be retrieved only taking
-             the effective nodetypes present on the parent into account
-             any kind of transiently added mixins must not have an effect
-             on the definition retrieved for an state that has been persisted
-             before. The effective NT must be evaluated as if it had been
-             evaluated upon creating the workspace state.
-             */
-            EffectiveNodeType ent = entProvider.getEffectiveNodeType(propertyState.getParent().getNodeTypeNames());
-            definition = getQPropertyDefinition(ent, propertyState.getName(), propertyState.getType(),
propertyState.isMultiValued(), true);
+            EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
+            definition = getQPropertyDefinition(ent, propertyName, propertType, isMultiValued,
true);
         } catch (RepositoryException e) {
-            definition = service.getPropertyDefinition(sessionInfo, ((PropertyEntry) propertyState.getHierarchyEntry()).getWorkspaceId());
+            definition = service.getPropertyDefinition(sessionInfo, propertyId);
         }
         return definition;
     }
@@ -147,21 +132,21 @@
     /**
      * @inheritDoc
      */
-    public QPropertyDefinition getQPropertyDefinition(NodeState parentState,
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
                                                       Name name, int type,
                                                       boolean multiValued)
             throws ConstraintViolationException, NoSuchNodeTypeException {
-        EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentState.getAllNodeTypeNames());
+        EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
         return getQPropertyDefinition(ent, name, type, multiValued, false);
     }
 
     /**
      * @inheritDoc
      */
-    public QPropertyDefinition getQPropertyDefinition(NodeState parentState,
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
                                                       Name name, int type)
             throws ConstraintViolationException, NoSuchNodeTypeException {
-        EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentState.getAllNodeTypeNames());
+        EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
         return getQPropertyDefinition(ent, name, type);
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
Tue Apr 22 06:15:43 2008
@@ -590,7 +590,7 @@
             try {
                 NodeState conflictingState = parentState.getChildNodeState(nodeName, Path.INDEX_DEFAULT);
                 QNodeDefinition conflictDef = conflictingState.getDefinition();
-                QNodeDefinition newDef = mgrProvider.getItemDefinitionProvider().getQNodeDefinition(parentState,
nodeName, nodeTypeName);
+                QNodeDefinition newDef = mgrProvider.getItemDefinitionProvider().getQNodeDefinition(parentState.getAllNodeTypeNames(),
nodeName, nodeTypeName);
 
                 // check same-name sibling setting of both target and existing node
                 if (!(conflictDef.allowsSameNameSiblings() && newDef.allowsSameNameSiblings()))
{

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Tue Apr 22 06:15:43 2008
@@ -164,7 +164,7 @@
         // TODO: ev. reset the 'markModified' flag
         if (StateUtility.isMovedState(this)) {
             try {
-                QNodeDefinition def = definitionProvider.getQNodeDefinition(this);
+                QNodeDefinition def = retrieveDefinition();
                 if (!def.equals(definition)) {
                     definition = def;
                     return true;
@@ -428,7 +428,7 @@
      */
     public QNodeDefinition getDefinition() throws RepositoryException {
         if (definition == null) {
-            definition = definitionProvider.getQNodeDefinition(this);
+            definition = retrieveDefinition();
         }
         return definition;
     }
@@ -558,6 +558,25 @@
         childState.markModified();
     }
 
+    private QNodeDefinition retrieveDefinition() throws RepositoryException {
+        QNodeDefinition def;
+        if (isRoot()) {
+            def = definitionProvider.getRootNodeDefinition();
+        } else {
+            /*
+             Don't use getAllNodeTypeNames() to retrieve the definition:
+             for NEW-states the definition is always set upon creation.
+             for all other states the definion must be retrieved only taking
+             the effective nodetypes present on the parent into account
+             any kind of transiently added mixins must not have an effect
+             on the definition retrieved for an state that has been persisted
+             before. The effective NT must be evaluated as if it had been
+             evaluated upon creating the workspace state.
+             */
+            def = definitionProvider.getQNodeDefinition(getParent().getNodeTypeNames(), getName(),
getNodeTypeName(), getNodeEntry().getWorkspaceId());
+        }
+        return def;
+    }
     /**
      *
      * @param childState

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
Tue Apr 22 06:15:43 2008
@@ -215,7 +215,17 @@
      */
     public QPropertyDefinition getDefinition() throws RepositoryException {
         if (definition == null) {
-            definition = definitionProvider.getQPropertyDefinition(this);
+            /*
+            Don't pass 'all-nodetypes from parent':
+            for NEW-states the definition is always set upon creation.
+            for all other states the definion must be retrieved only taking
+            the effective nodetypes present on the parent into account
+            any kind of transiently added mixins must not have an effect
+            on the definition retrieved for an state that has been persisted
+            before. The effective NT must be evaluated as if it had been
+            evaluated upon creating the workspace state.
+            */
+            definition = definitionProvider.getQPropertyDefinition(getParent().getNodeTypeNames(),
getName(), getType(), multiValued, ((PropertyEntry) getHierarchyEntry()).getWorkspaceId());
         }
         return definition;
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
Tue Apr 22 06:15:43 2008
@@ -261,7 +261,7 @@
 
         NodeState parent = operation.getParentState();
         ItemDefinitionProvider defProvider = mgrProvider.getItemDefinitionProvider();
-        QNodeDefinition def = defProvider.getQNodeDefinition(parent, operation.getNodeName(),
operation.getNodeTypeName());
+        QNodeDefinition def = defProvider.getQNodeDefinition(parent.getAllNodeTypeNames(),
operation.getNodeName(), operation.getNodeTypeName());
         addNodeState(parent, operation.getNodeName(), operation.getNodeTypeName(), operation.getUuid(),
def, options);
 
         transientStateMgr.addOperation(operation);
@@ -317,7 +317,7 @@
 
         // retrieve applicable definition at the new place
         ItemDefinitionProvider defProvider = mgrProvider.getItemDefinitionProvider();
-        QNodeDefinition newDefinition = defProvider.getQNodeDefinition(destParent, operation.getDestinationName(),
srcState.getNodeTypeName());
+        QNodeDefinition newDefinition = defProvider.getQNodeDefinition(destParent.getAllNodeTypeNames(),
operation.getDestinationName(), srcState.getNodeTypeName());
 
         // perform the move (modifying states)
         srcParent.moveChildNodeEntry(destParent, srcState, operation.getDestinationName(),
newDefinition);
@@ -365,7 +365,7 @@
             } else {
                 // create new jcr:mixinTypes property
                 ItemDefinitionProvider defProvider = mgrProvider.getItemDefinitionProvider();
-                QPropertyDefinition pd = defProvider.getQPropertyDefinition(nState, NameConstants.JCR_MIXINTYPES,
PropertyType.NAME, true);
+                QPropertyDefinition pd = defProvider.getQPropertyDefinition(nState.getAllNodeTypeNames(),
NameConstants.JCR_MIXINTYPES, PropertyType.NAME, true);
                 QValue[] mixinValue = getQValues(mixinNames, qValueFactory);
                 int options = ItemStateValidator.CHECK_LOCK | ItemStateValidator.CHECK_VERSIONING;
                 addPropertyState(nState, pd.getName(), pd.getRequiredType(), mixinValue,
pd, options);

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=650514&r1=650513&r2=650514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
Tue Apr 22 06:15:43 2008
@@ -397,6 +397,7 @@
      * @throws RepositoryException
      */
     private NodeState importNode(NodeInfo nodeInfo, NodeState parent) throws ConstraintViolationException,
ItemNotFoundException, RepositoryException {
+        Name[] parentNtNames = parent.getAllNodeTypeNames();                
         if (parent.hasPropertyName(nodeInfo.getName())) {
             /**
              * a property with the same name already exists; if this property
@@ -406,7 +407,7 @@
              *
              * see http://issues.apache.org/jira/browse/JCR-61
              */
-                PropertyState conflicting = parent.getPropertyState(nodeInfo.getName());
+            PropertyState conflicting = parent.getPropertyState(nodeInfo.getName());
             if (conflicting.getStatus() == Status.NEW) {
                 // assume this property has been imported as well;
                 // rename conflicting property
@@ -421,14 +422,14 @@
                     // could be single- or multi-valued (n == 1)
                     try {
                         // try single-valued
-                        propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), false);
+                        propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames,
newName, conflicting.getType(), false);
                     } catch (ConstraintViolationException cve) {
                         // try multi-valued
-                        propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), true);
+                        propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames,
newName, conflicting.getType(), true);
                     }
                 } else {
                     // can only be multi-valued (n == 0 || n > 1)
-                    propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), true);
+                    propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames,
newName, conflicting.getType(), true);
                 }
 
                 Operation ap = AddProperty.create(parent, newName, conflicting.getType(),
propDef, conflicting.getValues());
@@ -439,7 +440,7 @@
         }
 
         // do create new nodeState
-        QNodeDefinition def = session.getItemDefinitionProvider().getQNodeDefinition(parent,
nodeInfo.getName(), nodeInfo.getNodeTypeName());
+        QNodeDefinition def = session.getItemDefinitionProvider().getQNodeDefinition(parentNtNames,
nodeInfo.getName(), nodeInfo.getNodeTypeName());
         if (def.isProtected()) {
             log.debug("Skipping protected nodeState (" + nodeInfo.getName() + ")");
             return null;
@@ -473,7 +474,7 @@
      *
      * @param pi
      * @param parentState
-     * @param nsResolver
+     * @param resolver
      * @throws RepositoryException
      * @throws ConstraintViolationException
      */
@@ -511,21 +512,22 @@
             }
         }
 
-       if (def == null) {
-           // there's no property with that name, find applicable definition
-           if (tva.length == 1) {
-               // could be single- or multi-valued (n == 1)
-               def = session.getItemDefinitionProvider().getQPropertyDefinition(parentState,
propName, infoType);
-           } else {
-               // can only be multi-valued (n == 0 || n > 1)
-               def = session.getItemDefinitionProvider().getQPropertyDefinition(parentState,
propName, infoType, true);
-           }
-           if (def.isProtected()) {
-               // skip protected property
-               log.debug("skipping protected property " + propName);
-               return;
-           }
-       }
+        Name[] parentNtNames = parentState.getAllNodeTypeNames();
+        if (def == null) {
+            // there's no property with that name, find applicable definition
+            if (tva.length == 1) {
+                // could be single- or multi-valued (n == 1)
+                def = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames,
propName, infoType);
+            } else {
+                // can only be multi-valued (n == 0 || n > 1)
+                def = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames,
propName, infoType, true);
+            }
+            if (def.isProtected()) {
+                // skip protected property
+                log.debug("skipping protected property " + propName);
+                return;
+            }
+        }
 
         // retrieve the target property type needed for creation of QValue(s)
         // including an eventual conversion. the targetType is then needed for



Mime
View raw message