jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r712984 - in /jackrabbit/trunk: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/ jackrabbit-core/src/tes...
Date Tue, 11 Nov 2008 08:16:38 GMT
Author: angela
Date: Tue Nov 11 00:16:38 2008
New Revision: 712984

URL: http://svn.apache.org/viewvc?rev=712984&view=rev
Log:
JCR-1588: JSR 283 Access Control
JCR-1104: JSR 283 support
          > add implemented methods to jsr283.Node.java, 
          > add jsr283.Session.java,
          > let SessionImpl implement jsr283.Session
          > add Session.removeItem

Added:
    jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/EvaluationTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/EvaluationTest.java

Modified: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java?rev=712984&r1=712983&r2=712984&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java (original)
+++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java Tue Nov 11 00:16:38 2008
@@ -18,8 +18,10 @@
 
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
+import javax.jcr.PropertyIterator;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
 
 /**
@@ -29,7 +31,108 @@
  * @since JCR 2.0
  */
 public interface Node extends javax.jcr.Node {
-  
+
+    /**
+     * Returns the identifier of this node. Applies to both referenceable and
+     * non-referenceable nodes.
+     * <p/>
+     * A <code>RepositoryException</code> is thrown if an error occurs.
+     *
+     * @return the identifier of this node
+     * @throws RepositoryException If an error occurs.
+     * @since JCR 2.0
+     */
+    public String getIdentifier() throws RepositoryException;
+
+    /**
+     * This method returns all <code>REFERENCE</code> properties that refer to
+     * this node, have the specified <code>name</code> and that are accessible
+     * through the current <code>Session</code>.
+     * <p/>
+     * If the <code>name</code> parameter is <code>null</code> then all
+     * referring <code>REFERENCES</code> are returned regardless of name.
+     * <p/>
+     * Some level 2 implementations may only return properties that have been
+     * saved (in a transactional setting this includes both those properties
+     * that have been saved but not yet committed, as well as properties that
+     * have been committed). Other level 2 implementations may additionally
+     * return properties that have been added within the current <code>Session</code>
+     * but are not yet saved.
+     * <p/>
+     * In implementations that support versioning, this method does not return
+     * properties that are part of the frozen state of a version in version
+     * storage.
+     * <p/>
+     * If this node has no referring properties with the specified name,
+     * an empty iterator is returned.
+     *
+     * @param name name of referring <code>REFERENCE</code> properties to be
+     *             returned; if <code>null</code> then all referring <code>REFERENCE</code>s
+     *             are returned
+     * @return A <code>PropertyIterator</code>.
+     * @throws RepositoryException if an error occurs
+     * @since JCR 2.0
+     */
+    public PropertyIterator getReferences(String name) throws RepositoryException;
+
+    /**
+     * Changes the primary node type of this node to <code>nodeTypeName</code>.
+     * Also immediately changes this node's <code>jcr:primaryType</code> property
+     * appropriately. Semantically, the new node type may take effect
+     * immediately and <i>must</i> take effect on <code>save</code>. Whichever
+     * behavior is adopted it must be the same as the behavior adopted for
+     * <code>addMixin()</code> (see below) and the behavior that occurs when a
+     * node is first created.
+     * <p/>
+     * If the presence of an existing property or child node would cause an
+     * incompatibility with the new node type a <code>ConstraintViolationException</code>
+     * is thrown either immediately or on <code>save</code>.
+     * <p/>
+     * If the new node type would cause this node to be incompatible with the
+     * node type of its parent then a <code>ConstraintViolationException</code>
+     * is thrown either immediately or on <code>save</code>.
+     * <p/>
+     * A <code>ConstraintViolationException</code> is also thrown either
+     * immediately or on <code>save</code> if a conflict with an already
+     * assigned mixin occurs.
+     * <p/>
+     * A <code>ConstraintViolationException</code> may also be thrown either
+     * immediately or on <code>save</code> if the attempted change violates
+     * implementation-specific node type transition rules. A repository that
+     * disallows all primary node type changes would simple throw this
+     * exception in all cases.
+     * <p/>
+     * If the specified node type is not recognized a
+     * <code>NoSuchNodeTypeException</code> is thrown either immediately
+     * or on <code>save</code>.
+     * <p/>
+     * A <code>VersionException</code> is thrown either immediately or on
+     * <code>save</code> if this node is versionable and checked-in, or is
+     * non-versionable but its nearest versionable ancestor is checked-in.
+     * <p/>
+     * A <code>LockException</code> is thrown either immediately or on
+     * <code>save</code> if a lock prevents the change of node type.
+     * <p/>
+     * A <code>RepositoryException</code> will be thrown if another error occurs.
+     *
+     * @param nodeTypeName the name of the new node type.
+     * @throws ConstraintViolationException If the specified primary node type
+     *                                      is prevented from being assigned.
+     * @throws NoSuchNodeTypeException      If the specified <code>nodeTypeName</code>
+     *                                      is not recognized and this implementation performs this validation
+     *                                      immediately instead of waiting until <code>save</code>.
+     * @throws VersionException             if this node is versionable and checked-in or is
+     *                                      non-versionable but its nearest versionable ancestor is checked-in and this
+     *                                      implementation performs this validation immediately instead of waiting until
+     *                                      <code>save</code>.
+     * @throws LockException                if a lock prevents the change of the primary node type
+     *                                      and this implementation performs this validation immediately instead of
+     *                                      waiting until <code>save</code>.
+     * @throws RepositoryException          if another error occurs.
+     * @since JCR 2.0
+     */
+    public void setPrimaryType(String nodeTypeName) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException;
+
     /**
      * Returns an iterator over all nodes that are in the shared set of this
      * node. If this node is not shared then the returned iterator contains

Added: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java?rev=712984&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java (added)
+++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java Tue Nov 11 00:16:38 2008
@@ -0,0 +1,351 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jsr283;
+
+import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
+import org.apache.jackrabbit.api.jsr283.retention.RetentionManager;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.Item;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.lock.LockException;
+import javax.jcr.version.VersionException;
+import java.util.Map;
+
+/**
+ * This interface holds extensions made in JCR 2.0 while work
+ * is in progress implementing JCR 2.0.
+ *
+ * @since JCR 2.0
+ */
+public interface Session extends javax.jcr.Session {
+
+        /**
+     * A constant representing the <code>read</code> action string, used to
+     * determine if this <code>Session</code> has permission to retrieve an
+     * item (and read the value, in the case of a property).
+     *
+     * @see #hasPermission(String, String)
+     * @see #checkPermission(String, String)
+     * @since JCR 2.0
+     */
+    public static final String ACTION_READ = "read";
+
+    /**
+     * A constant representing the <code>add_node</code> action string, used to
+     * determine if this <code>Session</code> has permission to add a new node.
+     *
+     * @see #hasPermission(String, String)
+     * @see #checkPermission(String, String)
+     * @since JCR 2.0
+     */
+    public static final String ACTION_ADD_NODE = "add_node";
+
+    /**
+     * A constant representing the <code>set_property</code> action string,
+     * used to determine if this <code>Session</code> has permission to set
+     * (add or modify) a property.
+     *
+     * @see #hasPermission(String, String)
+     * @see #checkPermission(String, String)
+     * @since JCR 2.0
+     */
+    public static final String ACTION_SET_PROPERTY = "set_property";
+
+    /**
+     * A constant representing the <code>remove</code> action string,
+     * used to determine if this <code>Session</code> has permission to remove
+     * an item.
+     *
+     * @see #hasPermission(String, String)
+     * @see #checkPermission(String, String)
+     * @since JCR 2.0
+     */
+    public static final String ACTION_REMOVE = "remove";
+
+    /**
+     * Returns the node specified by the given identifier. Applies to both
+     * referenceable and non-referenceable nodes.
+     * <p/>
+     * An <code>ItemNotFoundException</code> is thrown if no node with the
+     * specified identifier exists. This exception is also thrown if this
+     * <code>Session<code> does not have read access to the node with the
+     * specified identifier.
+     * <p/>
+     * A <code>RepositoryException</code> is thrown if another error occurs.
+     *
+     * @param id An identifier.
+     * @return A <code>Node</code>.
+     * @throws ItemNotFoundException if the specified identifier is not found.
+     * @throws RepositoryException if another error occurs.
+     * @since JCR 2.0
+     */
+    public javax.jcr.Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException;
+
+    /**
+     * Returns the node at the specified absolute path in the workspace.
+     * If no node exists, then a <code>PathNotFoundException</code> is thrown.
+     *
+     * @param absPath An absolute path.
+     * @return the specified <code>Node</code>.
+     * @throws PathNotFoundException If no node exists.
+     * @throws RepositoryException If another error occurs.
+     * @since JCR 2.0
+     */
+    public javax.jcr.Node getNode(String absPath) throws PathNotFoundException, RepositoryException;
+
+    /**
+     * Returns the property at the specified absolute path in the workspace.
+     * If no property exists, then a <code>PathNotFoundException</code> is thrown.
+     *
+     * @param absPath An absolute path.
+     * @return the specified <code>Property</code>.
+     * @throws PathNotFoundException If no property exists.
+     * @throws RepositoryException if another error occurs.
+     * @since JCR 2.0
+     */
+    public Property getProperty(String absPath) throws PathNotFoundException, RepositoryException;
+
+    /**
+     * Returns <code>true</code> if a node exists at <code>absPath</code>
+     * and this <code>Session</code> has read access to it; otherwise returns
+     * <code>false</code>.
+     * <p/>
+     * Throws a <code>RepositoryException</code> if <code>absPath</code>
+     * is not a well-formed absolute path.
+     *
+     * @param absPath An absolute path.
+     * @return a <code>boolean</code>
+     * @throws RepositoryException if <code>absPath</code> is not a well-formed
+     *         absolute path.
+     * @since JCR 2.0
+     */
+    public boolean nodeExists(String absPath) throws RepositoryException;
+
+    /**
+     * Returns <code>true</code> if a property exists at <code>absPath</code>
+     * and this <code>Session</code> has read access to it; otherwise returns
+     * <code>false</code>.
+     * <p/>
+     * Throws a <code>RepositoryException</code> if <code>absPath</code>
+     * is not a well-formed absolute path.
+     *
+     * @param absPath An absolute path.
+     * @return a <code>boolean</code>
+     * @throws RepositoryException if <code>absPath</code> is not a well-formed
+     *         absolute path.
+     * @since JCR 2.0
+     */
+    boolean propertyExists(String absPath) throws RepositoryException;
+
+    /**
+     * Removes the specified item (and its subtree).
+     * <p/>
+     * To persist a removal, a <code>save</code> must be
+     * performed.
+     * <p/>
+     * If a node with same-name siblings is removed, this decrements by one the
+     * indices of all the siblings with indices greater than that of the removed
+     * node. In other words, a removal compacts the array of same-name siblings
+     * and causes the minimal re-numbering required to maintain the original
+     * order but leave no gaps in the numbering.
+     * <p/>
+     * A <code>ReferentialIntegrityException</code> will be thrown on <code>save</code>
+     * if the specified item or an item in its subtree is currently the target of a <code>REFERENCE</code>
+     * property located in this workspace but outside the specified item's subtree and the current <code>Session</code>
+     * has read access to that <code>REFERENCE</code> property.
+     * <p/>
+     * An <code>AccessDeniedException</code> will be thrown on <code>save</code>
+     * if the specified item or an item in its subtree is currently the target of a <code>REFERENCE</code>
+     * property located in this workspace but outside the specified item's subtree and the current <code>Session</code>
+     * <i>does not</i> have read access to that <code>REFERENCE</code> property.
+     * <p/>
+     * A <code>ConstraintViolationException</code> will be thrown either immediately
+     * or on <code>save</code>, if removing the specified item would violate a node type or implementation-specific
+     * constraint. Implementations may differ on when this validation is performed.
+     * <p/>
+     * A <code>VersionException</code> will be thrown either immediately
+     * or on <code>save</code>, if the parent node of the specified item is versionable and checked-in
+     * or is non-versionable but its nearest versionable ancestor is checked-in. Implementations
+     * may differ on when this validation is performed.
+     * <p/>
+     * A <code>LockException</code> will be thrown either immediately or on <code>save</code>
+     * if a lock prevents the removal of the specified item. Implementations may differ on when this validation is performed.
+     *
+     * @param absPath the absolute path of the item to be removed.
+     * @throws VersionException if the parent node of the item at absPath is versionable and checked-in
+     * or is non-versionable but its nearest versionable ancestor is checked-in and this
+     * implementation performs this validation immediately instead of waiting until <code>save</code>.
+     * @throws LockException if a lock prevents the removal of the specified item and this
+     * implementation performs this validation immediately instead of waiting until <code>save</code>.
+     * @throws ConstraintViolationException if removing the specified item would violate a node type or
+     * implementation-specific constraint and this implementation performs this validation immediately
+     * instead of waiting until <code>save</code>.
+     * @throws RepositoryException if another error occurs.
+     * @see Item#remove()
+     * @since JCR 2.0
+     */
+    public void removeItem(String absPath) throws VersionException, LockException, ConstraintViolationException, RepositoryException;
+
+    /**
+     * Returns <code>true</code> if this <code>Session</code> has permission to
+     * perform the specified actions at the specified <code>absPath</code> and
+     * <code>false</code> otherwise.
+     * <p/>
+     * The <code>actions</code> parameter is a comma separated list of action strings.
+     * The following action strings are defined:
+     * <ul>
+     * <li>
+     * {@link #ACTION_ADD_NODE <code>add_node</code>}: If
+     * <code>hasPermission(path, "add_node")</code> returns <code>true</code>,
+     * then this <code>Session</code> has permission to add a node at
+     * <code>path</code>.
+     * </li>
+     * <li>
+     * {@link #ACTION_SET_PROPERTY <code>set_property</code>}: If
+     * <code>hasPermission(path, "set_property")</code>
+     * returns <code>true</code>, then this <code>Session</code> has permission
+     * to set (add or change) a property at <code>path</code>.
+     * </li>
+     * <li>
+     * {@link #ACTION_REMOVE <code>remove</code>}: If
+     * <code>hasPermission(path, "remove")</code> returns <code>true</code>,
+     * then this <code>Session</code> has permission to remove an item at
+     * <code>path</code>.
+     * </li>
+     * <li>
+     * {@link #ACTION_READ <code>read</code>}: If
+     * <code>hasPermission(path, "read")</code> returns <code>true</code>, then
+     * this <code>Session</code> has permission to retrieve (and read the value
+     * of, in the case of a property) an item at <code>path</code>.
+     * </li>
+     * </ul>
+     * When more than one action is specified in the <code>actions</code>
+     * parameter, this method will only return <code>true</code> if this
+     * <code>Session</code> has permission to perform <i>all</i> of the listed
+     * actions at the specified path.
+     * <p/>
+     * The information returned through this method will only reflect the access
+     * control status (both JCR defined and implementation-specific) and not other
+     * restrictions that may exist, such as node type constraints. For example,
+     * even though <code>hasPermission</code> may indicate that a particular
+     * <code>Session</code> may add a property at <code>/A/B/C</code>,
+     * the node type of the node at <code>/A/B</code> may prevent the addition
+     * of a property called <code>C</code>.
+     *
+     * @param absPath an absolute path.
+     * @param actions a comma separated list of action strings.
+     * @return boolean <code>true</code> if this <code>Session</code> has permission to
+     * perform the specified actions at the specified <code>absPath</code>.
+     * @throws RepositoryException if an error occurs.
+     * @since JCR 2.0
+     */
+    public boolean hasPermission(String absPath, String actions) throws RepositoryException;
+
+    /**
+     * Checks whether an operation can be performed given as much context as can be determined
+     * by the repsoitory, including:
+     * <ul>
+     * <li>
+     * Target object (reflecting the current selection in the application) and its current state
+     * (locks etc.).
+     * </li>
+     * <li>
+     * Current user (the current session).
+     * </li>
+     * <li>
+     * Access control rules (permissions granted to the current user).
+     * </li>
+     * <li>
+     * Repository capabilities.
+     * </li>
+     * <li>
+     * Schema information (rules embodied in the node type structure or more
+     * repository specific rules).
+     * </li>
+     * </ul>
+     *
+     * The implementation of this method is best effort: returning <code>false</code> guarantees
+     * that the operation cannot be performed, but returning <code>true</code> does not guarantee
+     * the opposite. The repository implementation should use this to give priority to
+     * performance over completeness. An exception should be thrown only for important
+     * failures such as loss of connectivity to the back-end.
+     *
+     * The <code>methodType</code> parameter identifies the operation using the method event
+     * constants defined for {@link javax.jcr.observation.Event#getMethod}.
+     *
+     * The <code>target</code> parameter identifies the object on which the specified method is
+     * called. For example, for method <code>Node.addNode</code>, <code>target</code> would identify
+     * the <code>Node</code> object. The <code>target</code> is an optional parameter, but must be
+     * supplied if the specified method is defined on javax.jcr.Item or any of its subtypes.
+     * To not supply a <code>target</code>, a <code>null</code> is passed as the second parameter.
+     *
+     * The <code>arguments</code> parameter contains method arguments as defined for
+     * {@link javax.jcr.observation.Event#getMethodInfo}. The <code>arguments</code> parameter is
+     * optional, and even when specified, not all arguments to the corresponding operation need to
+     * be specified. In such a case, the repository should check whether there exists a
+     * set of arguments for which the operation could succeed. To not supply <code>arguments</code>,
+     * either a <code>null</code> or an empty <code>Map</code> is passed as the third parameter.
+     * @param methodType the operation.
+     * @param target the target object of the operation.
+     * @param arguments the arguments of the operation.
+     * @return boolean <code>false</code> if the operation cannot be performed,
+     * <code>true</code> if the operation can be performed or if the repository
+     * cannot determine whether the operation can be performed.
+     * @throws RepositoryException if an error occurs
+     * @since JCR 2.0
+     */
+    public boolean checkCapability(String methodType, Object target, Map arguments) throws RepositoryException;
+
+    /**
+     * Returns the access control manager for this <code>Session</code>.
+     * <p/>
+     * An <code>UnsupportedRepositoryOperationException</code> is thrown if
+     * access control is not supported.
+     * <p/>
+     * A <code>RepositoryException</code> is thrown if another error occurs.
+     *
+     * @return the access control manager for this <code>Session</code>
+     * @throws UnsupportedRepositoryOperationException if access control
+     *         is not supported.
+     * @throws RepositoryException if another error occurs.
+     * @since JCR 2.0
+     */
+    public AccessControlManager getAccessControlManager()
+            throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * Returns the retention and hold manager for this <code>Session</code>.
+     * <p/>
+     * An <code>UnsupportedRepositoryOperationException</code> is thrown if
+     * retention and hold are not supported.
+     * <p/>
+     * A <code>RepositoryException</code> is thrown if another error occurs.
+     *
+     * @return the retention manager for this <code>Session</code>.
+     * @throws UnsupportedRepositoryOperationException if retention and hold
+     * are not supported.
+     * @throws RepositoryException if another error occurs.
+     * @since JCR 2.0
+     */
+    public RetentionManager getRetentionManager()
+            throws UnsupportedRepositoryOperationException, RepositoryException;    
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Session.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

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=712984&r1=712983&r2=712984&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 Tue Nov 11 00:16:38 2008
@@ -4587,13 +4587,7 @@
 
     //--------------------------------------------------< new JSR 283 methods >
     /**
-     * Returns the identifier of this node. Applies to both referenceable and
-     * non-referenceable nodes.
-     * <p/>
-     * A <code>RepositoryException</code> is thrown if an error occurs.
-     *
-     * @return the identifier of this node
-     * @throws RepositoryException If an error occurs.
+     * @see org.apache.jackrabbit.api.jsr283.Node#getIdentifier()
      * @since JCR 2.0
      */
     public String getIdentifier() throws RepositoryException {
@@ -4601,32 +4595,7 @@
     }
 
     /**
-     * This method returns all <code>REFERENCE</code> properties that refer to
-     * this node, have the specified <code>name</code> and that are accessible
-     * through the current <code>Session</code>.
-     * <p/>
-     * If the <code>name</code> parameter is <code>null</code> then all
-     * referring <code>REFERENCES</code> are returned regardless of name.
-     * <p/>
-     * Some level 2 implementations may only return properties that have been
-     * saved (in a transactional setting this includes both those properties
-     * that have been saved but not yet committed, as well as properties that
-     * have been committed). Other level 2 implementations may additionally
-     * return properties that have been added within the current <code>Session</code>
-     * but are not yet saved.
-     * <p/>
-     * In implementations that support versioning, this method does not return
-     * properties that are part of the frozen state of a version in version
-     * storage.
-     * <p/>
-     * If this node has no referring properties with the specified name,
-     * an empty iterator is returned.
-     *
-     * @param name name of referring <code>REFERENCE</code> properties to be
-     *        returned; if <code>null</code> then all referring <code>REFERENCE</code>s
-     *        are returned
-     * @return A <code>PropertyIterator</code>.
-     * @throws RepositoryException if an error occurs
+     * @see org.apache.jackrabbit.api.jsr283.Node#getReferences(String)
      * @since JCR 2.0
      */
     public PropertyIterator getReferences(String name)
@@ -4669,59 +4638,7 @@
     }
 
     /**
-     * Changes the primary node type of this node to <code>nodeTypeName</code>.
-     * Also immediately changes this node's <code>jcr:primaryType</code> property
-     * appropriately. Semantically, the new node type may take effect
-     * immediately and <i>must</i> take effect on <code>save</code>. Whichever
-     * behavior is adopted it must be the same as the behavior adopted for
-     * <code>addMixin()</code> (see below) and the behavior that occurs when a
-     * node is first created.
-     * <p/>
-     * If the presence of an existing property or child node would cause an
-     * incompatibility with the new node type a <code>ConstraintViolationException</code>
-     * is thrown either immediately or on <code>save</code>.
-     * <p/>
-     * If the new node type would cause this node to be incompatible with the
-     * node type of its parent then a <code>ConstraintViolationException</code>
-     * is thrown either immediately or on <code>save</code>.
-     * <p/>
-     * A <code>ConstraintViolationException</code> is also thrown either
-     * immediately or on <code>save</code> if a conflict with an already
-     * assigned mixin occurs.
-     * <p/>
-     * A <code>ConstraintViolationException</code> may also be thrown either
-     * immediately or on <code>save</code> if the attempted change violates
-     * implementation-specific node type transition rules. A repository that
-     * disallows all primary node type changes would simple throw this
-     * exception in all cases.
-     * <p/>
-     * If the specified node type is not recognized a
-     * <code>NoSuchNodeTypeException</code> is thrown either immediately
-     * or on <code>save</code>.
-     * <p/>
-     * A <code>VersionException</code> is thrown either immediately or on
-     * <code>save</code> if this node is versionable and checked-in, or is
-     * non-versionable but its nearest versionable ancestor is checked-in.
-     * <p/>
-     * A <code>LockException</code> is thrown either immediately or on
-     * <code>save</code> if a lock prevents the change of node type.
-     * <p/>
-     * A <code>RepositoryException</code> will be thrown if another error occurs.
-     *
-     * @param nodeTypeName the name of the new node type.
-     * @throws ConstraintViolationException If the specified primary node type
-     * is prevented from being assigned.
-     * @throws NoSuchNodeTypeException If the specified <code>nodeTypeName</code>
-     * is not recognized and this implementation performs this validation
-     * immediately instead of waiting until <code>save</code>.
-     * @throws VersionException if this node is versionable and checked-in or is
-     * non-versionable but its nearest versionable ancestor is checked-in and this
-     * implementation performs this validation immediately instead of waiting until
-     * <code>save</code>.
-     * @throws LockException if a lock prevents the change of the primary node type
-     * and this implementation performs this validation immediately instead of
-     * waiting until <code>save</code>.
-     * @throws RepositoryException  if another error occurs.
+     * @see org.apache.jackrabbit.api.jsr283.Node#setPrimaryType(String) 
      * @since JCR 2.0
      */
     public void setPrimaryType(String nodeTypeName)

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=712984&r1=712983&r2=712984&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Tue Nov 11 00:16:38 2008
@@ -107,29 +107,29 @@
  * A <code>SessionImpl</code> ...
  */
 public class SessionImpl extends AbstractSession
-        implements JackrabbitSession, NamespaceResolver, NamePathResolver, Dumpable {
+        implements org.apache.jackrabbit.api.jsr283.Session, JackrabbitSession, NamespaceResolver, NamePathResolver, Dumpable {
 
     private static Logger log = LoggerFactory.getLogger(SessionImpl.class);
 
     /**
-     * TODO deprecate as soon as present with Session interface (JSR 283)
+     * @deprecated Use {@link org.apache.jackrabbit.api.jsr283.Session#ACTION_READ} instead.
      */
-    public static final String READ_ACTION = "read";
+    public static final String READ_ACTION = org.apache.jackrabbit.api.jsr283.Session.ACTION_READ;
 
     /**
-     * TODO deprecate as soon as present with Session interface (JSR 283)
+     * @deprecated Use {@link org.apache.jackrabbit.api.jsr283.Session#ACTION_REMOVE} instead.
      */
-    public static final String REMOVE_ACTION = "remove";
+    public static final String REMOVE_ACTION = org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE;
 
     /**
-     * TODO deprecate as soon as present with Session interface (JSR 283)
+     * @deprecated Use {@link org.apache.jackrabbit.api.jsr283.Session#ACTION_ADD_NODE} instead.
      */
-    public static final String ADD_NODE_ACTION = "add_node";
+    public static final String ADD_NODE_ACTION = org.apache.jackrabbit.api.jsr283.Session.ACTION_ADD_NODE;
 
     /**
-     * TODO deprecate as soon as present with Session interface (JSR 283)
+     * @deprecated Use {@link org.apache.jackrabbit.api.jsr283.Session#ACTION_SET_PROPERTY} instead.
      */
-    public static final String SET_PROPERTY_ACTION = "set_property";
+    public static final String SET_PROPERTY_ACTION = org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY;
 
     /**
      * flag indicating whether this session is alive
@@ -1315,20 +1315,7 @@
 
     //--------------------------------------------------< new JSR 283 methods >
     /**
-     * Returns the node specified by the given identifier. Applies to both
-     * referenceable and non-referenceable nodes.
-     * <p/>
-     * An <code>ItemNotFoundException</code> is thrown if no node with the
-     * specified identifier exists. This exception is also thrown if this
-     * <code>Session<code> does not have read access to the node with the
-     * specified identifier.
-     * <p/>
-     * A <code>RepositoryException</code> is thrown if another error occurs.
-     *
-     * @param id An identifier.
-     * @return A <code>Node</code>.
-     * @throws ItemNotFoundException if the specified identifier is not found.
-     * @throws RepositoryException if another error occurs.
+     * @see org.apache.jackrabbit.api.jsr283.Session#getNodeByIdentifier(String) 
      * @since JCR 2.0
      */
     public Node getNodeByIdentifier(String id)
@@ -1343,13 +1330,7 @@
     }
 
     /**
-     * Returns the node at the specified absolute path in the workspace.
-     * If no node exists, then a <code>PathNotFoundException</code> is thrown.
-     *
-     * @param absPath An absolute path.
-     * @return the specified <code>Node</code>.
-     * @throws PathNotFoundException If no node exists.
-     * @throws RepositoryException If another error occurs.
+     * @see org.apache.jackrabbit.api.jsr283.Session#getNode(String)
      * @since JCR 2.0
      */
     public Node getNode(String absPath)
@@ -1373,13 +1354,7 @@
     }
 
     /**
-     * Returns the property at the specified absolute path in the workspace.
-     * If no property exists, then a <code>PathNotFoundException</code> is thrown.
-     *
-     * @param absPath An absolute path.
-     * @return the specified <code>Property</code>.
-     * @throws PathNotFoundException If no property exists.
-     * @throws RepositoryException if another error occurs.
+     * @see org.apache.jackrabbit.api.jsr283.Session#getProperty(String)
      * @since JCR 2.0
      */
     public Property getProperty(String absPath)
@@ -1403,17 +1378,7 @@
     }
 
     /**
-     * Returns <code>true</code> if a node exists at <code>absPath</code>
-     * and this <code>Session</code> has read access to it; otherwise returns
-     * <code>false</code>.
-     * <p/>
-     * Throws a <code>RepositoryException</code> if <code>absPath</code>
-     * is not a well-formed absolute path.
-     *
-     * @param absPath An absolute path.
-     * @return a <code>boolean</code>
-     * @throws RepositoryException if <code>absPath</code> is not a well-formed
-     *         absolute path.
+     * @see org.apache.jackrabbit.api.jsr283.Session#nodeExists(String)
      * @since JCR 2.0
      */
     public boolean nodeExists(String absPath) throws RepositoryException {
@@ -1434,17 +1399,7 @@
     }
 
     /**
-     * Returns <code>true</code> if a property exists at <code>absPath</code>
-     * and this <code>Session</code> has read access to it; otherwise returns
-     * <code>false</code>.
-     * <p/>
-     * Throws a <code>RepositoryException</code> if <code>absPath</code>
-     * is not a well-formed absolute path.
-     *
-     * @param absPath An absolute path.
-     * @return a <code>boolean</code>
-     * @throws RepositoryException if <code>absPath</code> is not a well-formed
-     *         absolute path.
+     * @see org.apache.jackrabbit.api.jsr283.Session#propertyExists(String)
      * @since JCR 2.0
      */
     public boolean propertyExists(String absPath) throws RepositoryException {
@@ -1465,7 +1420,32 @@
     }
 
     /**
-     * @see Session#hasPermission(String, String)
+     * @see org.apache.jackrabbit.api.jsr283.Session#removeItem(String)
+     * @since JCR 2.0
+     */
+    public void removeItem(String absPath) throws VersionException,
+            LockException, ConstraintViolationException, RepositoryException {
+        // check sanity of this session
+        sanityCheck();
+        Item item;
+        try {
+            Path p = getQPath(absPath).getNormalizedPath();
+            if (!p.isAbsolute()) {
+                throw new RepositoryException("not an absolute path: " + absPath);
+            }
+            item = getItemManager().getItem(p);
+        } catch (AccessDeniedException e) {
+            throw new PathNotFoundException(absPath);
+        } catch (NameException e) {
+            String msg = "invalid path:" + absPath;
+            log.debug(msg);
+            throw new RepositoryException(msg, e);
+        }
+        item.remove();
+    }
+
+    /**
+     * @see org.apache.jackrabbit.api.jsr283.Session#hasPermission(String, String)
      * @since 2.0
      */
     public boolean hasPermission(String absPath, String actions) throws RepositoryException {
@@ -1479,16 +1459,16 @@
 
         Set s = new HashSet(Arrays.asList(actions.split(",")));
         int permissions = 0;
-        if (s.remove(SessionImpl.READ_ACTION)) {
+        if (s.remove(ACTION_READ)) {
             permissions |= Permission.READ;
         }
-        if (s.remove(SessionImpl.ADD_NODE_ACTION)) {
+        if (s.remove(ACTION_ADD_NODE)) {
             permissions |= Permission.ADD_NODE;
         }
-        if (s.remove(SessionImpl.SET_PROPERTY_ACTION)) {
+        if (s.remove(ACTION_SET_PROPERTY)) {
             permissions |= Permission.SET_PROPERTY;
         }
-        if (s.remove(SessionImpl.REMOVE_ACTION)) {
+        if (s.remove(ACTION_REMOVE)) {
             if (nodeExists(absPath)) {
                 permissions |= (propertyExists(absPath)) ?
                         (Permission.REMOVE_NODE | Permission.REMOVE_PROPERTY) :
@@ -1515,7 +1495,17 @@
     }
 
     /**
-     * @see Session#getAccessControlManager()
+     * @see org.apache.jackrabbit.api.jsr283.Session#checkCapability(String, Object, Map)
+     * @since JCR 2.0
+     */
+    public boolean checkCapability(String methodType, Object target, Map arguments)
+            throws RepositoryException {
+        //TODO
+        throw new UnsupportedRepositoryOperationException("Not yet implemented");
+    }
+
+    /**
+     * @see org.apache.jackrabbit.api.jsr283.Session#getAccessControlManager()
      * @since JCR 2.0
      */
     public AccessControlManager getAccessControlManager()
@@ -1528,7 +1518,7 @@
     }
 
     /**
-     * @see Session#getRetentionManager()
+     * @see org.apache.jackrabbit.api.jsr283.Session#getRetentionManager()
      * @since JCR 2.0
      */
     public synchronized RetentionManager getRetentionManager()

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java?rev=712984&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java Tue Nov 11 00:16:38 2008
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jsr283;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Property;
+import javax.jcr.version.VersionException;
+import javax.jcr.lock.LockException;
+
+/** <code>SessionRemoveItemTest</code>... */
+public class SessionRemoveItemTest extends AbstractJCRTest {
+
+    private static Logger log = LoggerFactory.getLogger(SessionRemoveItemTest.class);
+
+    private Session adminSession;
+    private Session readOnlySession;
+
+    private javax.jcr.Node removeNode;
+    private String nPath;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // TODO: rm casts once jsr283 is released
+        if (superuser instanceof Session) {
+            adminSession = (Session) superuser;
+        } else {
+            throw new NotExecutableException("org.apache.jackrabbit.api.jsr283.Session expected.");
+        }
+
+        javax.jcr.Session s = helper.getReadOnlySession();
+        if (s instanceof Session) {
+            readOnlySession = (Session) s;
+        } else {
+            throw new NotExecutableException("org.apache.jackrabbit.api.jsr283.Session expected.");
+        }
+
+        removeNode = testRootNode.addNode(nodeName1, testNodeType);
+        testRootNode.save();
+        nPath = removeNode.getPath();
+    }
+
+    protected void tearDown() throws Exception {
+        if (readOnlySession != null) {
+            readOnlySession.logout();
+        }
+        super.tearDown();
+    }
+
+    public void testRemoveItem() throws RepositoryException {
+        adminSession.removeItem(nPath);
+        assertFalse(adminSession.nodeExists(nPath));
+    }
+
+    public void testRemoveItem2() throws RepositoryException {
+        adminSession.removeItem(nPath);
+        try {
+            removeNode.getParent();
+            fail("Cannot retrieve the parent from a transiently removed item.");
+        } catch (InvalidItemStateException e) {
+            // success
+        }
+    }
+
+    public void testRemoveItem3() throws RepositoryException {
+        adminSession.removeItem(nPath);
+
+        // node must still exist for another session.
+        assertTrue(readOnlySession.nodeExists(nPath));
+    }
+
+    public void testRemoveItem4() throws RepositoryException {
+        try {
+            readOnlySession.removeItem(nPath);
+            readOnlySession.save();
+            fail("A read-only session must not be allowed to remove an item");
+        } catch (AccessDeniedException e) {
+            // success
+        }
+    }
+
+    public void testRemoveLockedNode() throws RepositoryException, NotExecutableException {
+        if (!removeNode.isNodeType(mixLockable)) {
+            if (removeNode.canAddMixin(mixLockable)) {
+                removeNode.addMixin(mixLockable);
+                removeNode.save();
+            } else {
+                throw new NotExecutableException("Cannot make test node lockable.");
+            }
+        }
+
+        // make sure the test node is locked.
+        removeNode.lock(true, true);
+        Session testSession = null;
+        try {
+            testSession = (Session) helper.getReadWriteSession();
+            // removal of the locked node is a alteration of the parent, which
+            // isn't locked -> must succeed.
+            testSession.removeItem(nPath);
+            testSession.save();
+        } finally {
+            if (testSession != null) {
+                testSession.logout();
+            }
+        }
+    }
+
+    public void testRemoveLockedChildItem() throws RepositoryException, NotExecutableException {
+        // add a child property and a child node to test deep lock effect.
+        javax.jcr.Node childN = removeNode.addNode(nodeName2);
+        Property childP = removeNode.setProperty(propertyName2, "propvalue2");
+        removeNode.save();
+
+        if (!removeNode.isNodeType(mixLockable)) {
+            if (removeNode.canAddMixin(mixLockable)) {
+                removeNode.addMixin(mixLockable);
+                removeNode.save();
+            } else {
+                throw new NotExecutableException("Cannot make test node lockable.");
+            }
+        }
+
+        // make sure the test node is locked.
+        removeNode.lock(true, true);
+        Session testSession = null;
+
+        try {
+            testSession = (Session) helper.getReadWriteSession();
+            try {
+                testSession.removeItem(childN.getPath());
+                testSession.save();
+                fail("Locked child node cannot be removed by another session.");
+            } catch (LockException e) {
+                // success
+            }
+            try {
+                testSession.removeItem(childP.getPath());
+                testSession.save();
+                fail("Locked child node cannot be removed by another session.");
+            } catch (LockException e) {
+                // success
+            }
+        } finally {
+            if (testSession != null) {
+                testSession.logout();
+            }
+            removeNode.unlock();
+        }
+    }
+
+    public void testRemoveCheckedInItem() throws RepositoryException, NotExecutableException {
+        // add a child property and a child node to test deep lock effect.
+        javax.jcr.Node childN = removeNode.addNode(nodeName2);
+        Property childP = removeNode.setProperty(propertyName2, "propvalue2");
+        removeNode.save();
+
+        if (!removeNode.isNodeType(mixVersionable)) {
+            if (removeNode.canAddMixin(mixVersionable)) {
+                removeNode.addMixin(mixVersionable);
+                removeNode.save();
+            } else {
+                throw new NotExecutableException("Cannot make test node versionable.");
+            }
+        }
+
+        removeNode.checkin();
+        try {
+            adminSession.removeItem(childP.getPath());
+            adminSession.save();
+            fail("child property of a checked-in node cannot be removed.");
+        } catch (VersionException e) {
+            // success
+        }
+        try {
+            adminSession.removeItem(childN.getPath());
+            adminSession.save();
+            fail("child node of a checked-in node cannot be removed.");
+        } catch (VersionException e) {
+            // success
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/SessionRemoveItemTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java?rev=712984&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java Tue Nov 11 00:16:38 2008
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.api.jsr283;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** <code>TestAll</code>... */
+public class TestAll extends TestCase {
+
+    private static Logger log = LoggerFactory.getLogger(TestAll.class);
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("org.apache.jackrabbit.api.jsr283 tests");
+
+        suite.addTestSuite(SessionRemoveItemTest.class);
+
+        return suite;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/TestAll.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java?rev=712984&r1=712983&r2=712984&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java Tue Nov 11 00:16:38 2008
@@ -497,9 +497,9 @@
          - add-node
          - remove.
          */
-        String aActions = SessionImpl.SET_PROPERTY_ACTION + "," + SessionImpl.READ_ACTION;
+        String aActions = org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY + "," + org.apache.jackrabbit.api.jsr283.Session.ACTION_READ;
         assertTrue(testSession.hasPermission(childNPath, aActions));
-        String dActions = SessionImpl.REMOVE_ACTION + "," + SessionImpl.ADD_NODE_ACTION;
+        String dActions = org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE + "," + org.apache.jackrabbit.api.jsr283.Session.ACTION_ADD_NODE;
         assertFalse(testSession.hasPermission(childNPath, dActions));
 
         /*
@@ -544,8 +544,8 @@
          - neither node at path nor at childNPath can be removed since
            REMOVE_NODE privilege is missing.
          */
-        assertFalse(testSession.hasPermission(path, SessionImpl.REMOVE_ACTION));
-        assertFalse(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
+        assertFalse(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
     }
 
     public void testRemovePermission2() throws NotExecutableException, RepositoryException {
@@ -566,8 +566,8 @@
          - neither node at path nor at childNPath can be removed permission
            due to missing remove_child_nodes privilege.
          */
-        assertFalse(testSession.hasPermission(path, SessionImpl.REMOVE_ACTION));
-        assertFalse(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
+        assertFalse(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
     }
 
    public void testRemovePermission3() throws NotExecutableException, RepositoryException {
@@ -594,8 +594,8 @@
          - privileges: both at path and at childNPath 'remove_node' and
            'remove_child_nodes' are present.
         */
-       assertFalse(testSession.hasPermission(path, SessionImpl.REMOVE_ACTION));
-       assertTrue(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+       assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
+       assertTrue(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
 
        assertTrue(testAcMgr.hasPrivileges(path, privs));
        assertTrue(testAcMgr.hasPrivileges(childNPath, privs));
@@ -624,8 +624,8 @@
          - remove-permission present for node at childNPath
          - both remove_node and remove_childNodes privilege present at childNPath
          */
-        assertFalse(testSession.hasPermission(path, SessionImpl.REMOVE_ACTION));
-        assertTrue(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
+        assertTrue(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
         assertTrue(testAcMgr.hasPrivileges(childNPath, new Privilege[] {rmChildNodes[0], rmNode[0]}));
     }
 
@@ -646,7 +646,7 @@
          expected result:
          - node at childNPath can't be removed since REMOVE_CHILD_NODES is missing.
          */
-        assertFalse(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
     }
 
     public void testRemovePermission6() throws NotExecutableException, RepositoryException {
@@ -674,8 +674,8 @@
          - no remove_node privilege at childNPath
          - read, remove_child_nodes privilege at childNPath
          */
-        assertFalse(testSession.hasPermission(path, SessionImpl.REMOVE_ACTION));
-        assertFalse(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
+        assertFalse(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
         assertTrue(testAcMgr.hasPrivileges(childNPath, privilegesFromNames(new String[] {Privilege.JCR_READ, Privilege.JCR_REMOVE_CHILD_NODES})));
         assertFalse(testAcMgr.hasPrivileges(childNPath, privilegesFromName(Privilege.JCR_REMOVE_NODE)));
     }
@@ -701,7 +701,7 @@
          expected result:
          - node at childNPath can't be removed.
          */
-        assertFalse(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
 
         // additionally add remove_child_nodes priv at 'childNPath'
         givePrivileges(childNPath, rmChildNodes, getRestrictions(childNPath));
@@ -710,7 +710,7 @@
          - node at childNPath still can't be removed.
          - but both privileges (remove_node, remove_child_nodes) are present.
          */
-        assertFalse(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
         assertTrue(testAcMgr.hasPrivileges(childNPath, new Privilege[] {rmChildNodes[0], rmNode[0]}));
     }
 
@@ -737,7 +737,7 @@
          expected result:
          - remove permission must be granted at childNPath
          */
-        assertTrue(testSession.hasPermission(childNPath, SessionImpl.REMOVE_ACTION));
+        assertTrue(testSession.hasPermission(childNPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
         assertTrue(testAcMgr.hasPrivileges(childNPath, new Privilege[] {rmChildNodes[0], rmNode[0]}));
     }
 
@@ -758,7 +758,7 @@
         /* testuser must get the permissions/privileges inherited from
            the group it is member of.
          */
-        String actions = SessionImpl.SET_PROPERTY_ACTION + "," + SessionImpl.READ_ACTION;
+        String actions = org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY + "," + org.apache.jackrabbit.api.jsr283.Session.ACTION_READ;
         assertTrue(testSession.hasPermission(path, actions));
         Privilege[] privs = privilegesFromName(Privilege.JCR_MODIFY_PROPERTIES);
         assertTrue(testAcMgr.hasPrivileges(path, privs));
@@ -783,7 +783,7 @@
          since user-permissions overrule the group permissions, testuser must
          not have set_property action / modify_properties privilege.
          */
-        String actions = SessionImpl.SET_PROPERTY_ACTION;
+        String actions = org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY;
         assertFalse(testSession.hasPermission(path, actions));
         assertFalse(testAcMgr.hasPrivileges(path, privilegesFromName(Privilege.JCR_MODIFY_PROPERTIES)));
     }
@@ -808,7 +808,7 @@
         String childPath = n.getPath();
         Privilege[] privs = testAcMgr.getPrivileges(childPath);
         assertTrue(PrivilegeRegistry.READ == PrivilegeRegistry.getBits(privs));
-        testSession.checkPermission(childPath, SessionImpl.READ_ACTION);
+        testSession.checkPermission(childPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_READ);
     }
 
     public void testNonExistingItem() throws RepositoryException, NotExecutableException {
@@ -819,7 +819,7 @@
         */
         String rootPath = getTestSession().getRootNode().getPath();
         checkReadOnly(rootPath);
-        testSession.checkPermission(rootPath + "nonExistingItem", SessionImpl.READ_ACTION);
+        testSession.checkPermission(rootPath + "nonExistingItem", org.apache.jackrabbit.api.jsr283.Session.ACTION_READ);
     }
 
     public void testACItemsAreProtected() throws NotExecutableException, RepositoryException {
@@ -893,10 +893,10 @@
            - testSession cannot add child-nodes at 'path'
            - testSession can add child-nodes below path
          */
-        assertFalse(testSession.hasPermission(path, SessionImpl.ADD_NODE_ACTION));
-        assertTrue(testSession.hasPermission(path+"/anychild", SessionImpl.ADD_NODE_ACTION));
+        assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_ADD_NODE));
+        assertTrue(testSession.hasPermission(path+"/anychild", org.apache.jackrabbit.api.jsr283.Session.ACTION_ADD_NODE));
         String childPath = n.getPath();
-        assertTrue(testSession.hasPermission(childPath, SessionImpl.ADD_NODE_ACTION));
+        assertTrue(testSession.hasPermission(childPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_ADD_NODE));
     }
 
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/EvaluationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/EvaluationTest.java?rev=712984&r1=712983&r2=712984&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/EvaluationTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/EvaluationTest.java Tue Nov 11 00:16:38 2008
@@ -170,7 +170,7 @@
            content that requires jcr:modifyAccessControl privilege instead.
          */
         String policyPath = childNPath + "/rep:policy";
-        assertFalse(testSession.hasPermission(policyPath, SessionImpl.REMOVE_ACTION));
+        assertFalse(testSession.hasPermission(policyPath, org.apache.jackrabbit.api.jsr283.Session.ACTION_REMOVE));
         assertTrue(testAcMgr.hasPrivileges(policyPath, new Privilege[] {rmChildNodes[0], rmNode[0]}));
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/EvaluationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/EvaluationTest.java?rev=712984&r1=712983&r2=712984&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/EvaluationTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/EvaluationTest.java Tue Nov 11 00:16:38 2008
@@ -149,7 +149,7 @@
          - nodebased wins over principalbased -> READ is denied
          */
         assertFalse(testSession.itemExists(path));
-        assertFalse(testSession.hasPermission(path, SessionImpl.READ_ACTION));
+        assertFalse(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_READ));
         assertFalse(testAcMgr.hasPrivileges(path, readPrivs));
 
         // remove the nodebased policy
@@ -162,7 +162,7 @@
          - READ privilege is present again.
          */
         assertTrue(testSession.itemExists(path));
-        assertTrue(testSession.hasPermission(path, SessionImpl.READ_ACTION));
+        assertTrue(testSession.hasPermission(path, org.apache.jackrabbit.api.jsr283.Session.ACTION_READ));
         assertTrue(testAcMgr.hasPrivileges(path, readPrivs));
 
         // nodebased: add WRITE privilege for 'testUser' at 'path'
@@ -175,7 +175,7 @@
          expected result:
          - MODIFY_PROPERTIES privilege still present
          */
-        assertTrue(testSession.hasPermission(path+"/anyproperty", SessionImpl.SET_PROPERTY_ACTION));
+        assertTrue(testSession.hasPermission(path+"/anyproperty", org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY));
         assertTrue(testAcMgr.hasPrivileges(path, wrtPrivileges));
 
         // nodebased: deny MODIFY_PROPERTIES privileges for 'testUser'
@@ -186,10 +186,10 @@
          - MODIFY_PROPERTIES privilege still present at 'path'
          - no-MODIFY_PROPERTIES privilege at 'childNPath'
          */
-        assertTrue(testSession.hasPermission(path+"/anyproperty", SessionImpl.SET_PROPERTY_ACTION));
+        assertTrue(testSession.hasPermission(path+"/anyproperty", org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY));
         assertTrue(testAcMgr.hasPrivileges(path, modPropPrivs));
 
-        assertFalse(testSession.hasPermission(childNPath+"/anyproperty", SessionImpl.SET_PROPERTY_ACTION));
+        assertFalse(testSession.hasPermission(childNPath+"/anyproperty", org.apache.jackrabbit.api.jsr283.Session.ACTION_SET_PROPERTY));
         assertFalse(testAcMgr.hasPrivileges(childNPath, modPropPrivs));
     }
 }
\ No newline at end of file



Mime
View raw message