Index: .
===================================================================
--- .	(revision 1358133)
+++ .	(working copy)

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /jackrabbit/trunk:r1353920
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/EntryCollector.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/EntryCollector.java	(revision 1358133)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/EntryCollector.java	(working copy)
@@ -134,7 +134,7 @@
             }
             next = getParentId(next);
         }
-        
+
         List<AccessControlEntry> entries = new ArrayList<AccessControlEntry>(userAces.size() + groupAces.size());
         entries.addAll(userAces);
         entries.addAll(groupAces);
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ACLProvider.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ACLProvider.java	(revision 1358133)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ACLProvider.java	(working copy)
@@ -328,19 +328,15 @@
     }
 
     /**
-     * Test if the given node is access controlled. The node is access
-     * controlled if it is of node type
-     * {@link AccessControlConstants#NT_REP_ACCESS_CONTROLLABLE "rep:AccessControllable"}
-     * and if it has a child node named
-     * {@link AccessControlConstants#N_POLICY "rep:ACL"}.
+     * Test if the given node is access controlled.
      *
      * @param node the node to be tested
-     * @return <code>true</code> if the node is access controlled and has a
-     * rep:policy child; <code>false</code> otherwise.
+     * @return <code>true</code> if the node is access controlled.
      * @throws RepositoryException if an error occurs
+     * @see org.apache.jackrabbit.core.NodeImpl#isAccessControllable()
      */
     static boolean isAccessControlled(NodeImpl node) throws RepositoryException {
-        return node.hasNode(N_POLICY) && node.isNodeType(NT_REP_ACCESS_CONTROLLABLE);
+        return node.isAccessControllable();
     }
 
     /**
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ACLTemplate.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ACLTemplate.java	(revision 1358133)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ACLTemplate.java	(working copy)
@@ -38,7 +38,6 @@
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
-import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.security.authorization.AbstractACLTemplate;
 import org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl;
 import org.apache.jackrabbit.core.security.authorization.Permission;
@@ -129,7 +128,7 @@
      */
     ACLTemplate(NodeImpl aclNode, PrivilegeRegistry privilegeRegistry) throws RepositoryException {
         super((aclNode != null) ? aclNode.getParent().getPath() : null, (aclNode != null) ? aclNode.getSession().getValueFactory() : null);
-        if (aclNode == null || !NT_REP_ACL.equals(((NodeTypeImpl)aclNode.getPrimaryNodeType()).getQName())) {
+        if (aclNode == null || !NT_REP_ACL.equals(aclNode.getPrimaryNodeTypeName())) {
             throw new IllegalArgumentException("Node must be of type 'rep:ACL'");
         }
         SessionImpl sImpl = (SessionImpl) aclNode.getSession();
@@ -164,11 +163,8 @@
                     restrictions = Collections.singletonMap(jcrRepGlob, aceNode.getProperty(P_GLOB).getValue());
                 }
                 // create a new ACEImpl (omitting validation check)
-                Entry ace = createEntry(
-                        princ,
-                        privs,
-                        NT_REP_GRANT_ACE.equals(((NodeTypeImpl) aceNode.getPrimaryNodeType()).getQName()),
-                        restrictions);
+                boolean isAllow = NT_REP_GRANT_ACE.equals(aceNode.getPrimaryNodeTypeName());
+                Entry ace = createEntry(princ, privs, isAllow, restrictions);
                 // add the entry
                 internalAdd(ace);
             } catch (RepositoryException e) {
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java	(revision 1358133)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java	(working copy)
@@ -594,8 +594,7 @@
     protected void removeChildNode(NodeId childId) throws RepositoryException {
         // modify the state of 'this', i.e. the parent node
         NodeState thisState = (NodeState) getOrCreateTransientItemState();
-        ChildNodeEntry entry =
-                thisState.getChildNodeEntry(childId);
+        ChildNodeEntry entry = thisState.getChildNodeEntry(childId);
         if (entry == null) {
             String msg = "failed to remove child " + childId + " of " + this;
             log.debug(msg);
@@ -921,9 +920,6 @@
      *         otherwise <code>false</code>
      */
     public boolean isNodeType(Name ntName) throws RepositoryException {
-        // check state of this instance
-        sanityCheck();
-
         // first do trivial checks without using type hierarchy
         Name primary = data.getNodeState().getNodeTypeName();
         if (ntName.equals(primary)) {
@@ -1357,6 +1353,33 @@
     }
 
     /**
+     * Returns the name of the primary node type as exposed on the node state
+     * without retrieving the node type.
+     *
+     * @return the name of the primary node type.
+     */
+    public Name getPrimaryNodeTypeName() {
+        return data.getNodeState().getNodeTypeName();
+    }
+
+    /**
+     * Test if the given node is access controlled. The node is access
+     * controlled if it is of node type
+     * {@link org.apache.jackrabbit.core.security.authorization.AccessControlConstants#NT_REP_ACCESS_CONTROLLABLE "rep:AccessControllable"}
+     * and if it has a child node named
+     * {@link org.apache.jackrabbit.core.security.authorization.AccessControlConstants#N_POLICY}.
+     *
+     * @param node the node to be tested
+     * @return <code>true</code> if the node is access controlled and has a
+     * rep:policy child; <code>false</code> otherwise.
+     * @throws RepositoryException if an error occurs
+     */
+    public boolean isAccessControllable() throws RepositoryException {
+        return data.getNodeState().hasChildNodeEntry(NameConstants.REP_POLICY, 1)
+                    && isNodeType(NameConstants.REP_ACCESS_CONTROLLABLE);
+    }
+
+    /**
      * Same as <code>{@link Node#orderBefore(String, String)}</code> except that
      * this method takes a <code>Path.Element</code> arguments instead of
      * <code>String</code>s.
@@ -2261,6 +2284,9 @@
      * {@inheritDoc}
      */
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
+        // check state of this instance
+        sanityCheck();
+
         try {
             return isNodeType(sessionContext.getQName(nodeTypeName));
         } catch (NameException e) {
