You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2009/06/11 11:34:27 UTC

svn commit: r783710 - in /jackrabbit/trunk/jackrabbit-core: pom.xml src/main/java/org/apache/jackrabbit/core/NodeImpl.java

Author: angela
Date: Thu Jun 11 09:34:26 2009
New Revision: 783710

URL: http://svn.apache.org/viewvc?rev=783710&view=rev
Log:
JCR-1104: JSR 283 support

- fix Name.equals(String)
- make canAddMixin symmetric to addMixin and rm. known issue 
   from pom
- replace usage of deprecated JCR methods
- javadoc

Modified:
    jackrabbit/trunk/jackrabbit-core/pom.xml
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/pom.xml?rev=783710&r1=783709&r2=783710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-core/pom.xml Thu Jun 11 09:34:26 2009
@@ -88,7 +88,6 @@
               <name>known.issues</name>
               <value>
                 org.apache.jackrabbit.core.xml.DocumentViewTest#testMultiValue
-                org.apache.jackrabbit.test.api.NodeCanAddMixinTest#testAddMixinTwice
                 org.apache.jackrabbit.test.api.ShareableNodeTest#testSharedNodePath
               </value>
             </property>

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=783710&r1=783709&r2=783710&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Thu Jun 11 09:34:26 2009
@@ -2859,7 +2859,7 @@
         // the version storage jcr:versionManagement privilege is required
         // in addition.
         if (NameConstants.MIX_VERSIONABLE.equals(ntName)
-                || NameConstants.MIX_SIMPLE_VERSIONABLE.equals(mixinName)) {
+                || NameConstants.MIX_SIMPLE_VERSIONABLE.equals(ntName)) {
             permissions |= Permission.VERSION_MNGMT;
         }
         if (!session.getValidator().canModify(this, options, permissions)) {
@@ -2870,7 +2870,8 @@
 
         NodeTypeImpl primaryType = ntMgr.getNodeType(primaryTypeName);
         if (primaryType.isDerivedFrom(ntName)) {
-            return false;
+            // mixin already inherited -> addMixin is allowed but has no effect.
+            return true;
         }
 
         // build effective node type of mixins & primary type
@@ -2884,7 +2885,9 @@
             // build effective node type representing primary type including existing mixin's
             entExisting = ntReg.getEffectiveNodeType(primaryTypeName, mixins);
             if (entExisting.includesNodeType(ntName)) {
-                return false;
+                // the existing mixins already include the mixin to be added.
+                // addMixin would succeed without modifying the node.
+                return true;
             }
 
             // add new mixin
@@ -3017,7 +3020,7 @@
             // if root is common ancestor, corresponding path is same as ours
             if (m1.getDepth() == 0) {
                 // check existence
-                if (!srcSession.getItemManager().itemExists(getPrimaryPath())) {
+                if (!srcSession.getItemManager().nodeExists(getPrimaryPath())) {
                     throw new ItemNotFoundException("Node not found: " + this);
                 } else {
                     return getPath();
@@ -3427,6 +3430,9 @@
         return new LazyItemIterator(itemMgr, failedIds);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void cancelMerge(Version version)
             throws VersionException, InvalidItemStateException,
             UnsupportedRepositoryOperationException, RepositoryException {
@@ -3651,8 +3657,7 @@
      *         node exists.
      * @throws RepositoryException If another error occurs.
      */
-    private NodeImpl getCorrespondingNode(SessionImpl srcSession)
-            throws AccessDeniedException, RepositoryException {
+    private NodeImpl getCorrespondingNode(SessionImpl srcSession) throws RepositoryException {
 
         // search nearest ancestor that is referenceable
         NodeImpl m1 = this;