jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: rev 55516 - in incubator/jackrabbit/trunk: lib src/java/org/apache/jackrabbit/core src/java/org/apache/jackrabbit/core/jndi src/java/org/apache/jackrabbit/core/nodetype src/java/org/apache/jackrabbit/core/observation src/java/org/apache/jackrabbit/core/search/lucene src/java/org/apache/jackrabbit/core/state/tx src/java/org/apache/jackrabbit/core/version src/java/org/apache/jackrabbit/core/xml src/test/org/apache/jackrabbit/test src/test/org/apache/jackrabbit/test/observation
Date Mon, 25 Oct 2004 17:49:43 GMT
Author: stefan
Date: Mon Oct 25 10:49:43 2004
New Revision: 55516

Added:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManager.java   (contents, props changed)
Removed:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AbstractAccessManager.java
Modified:
   incubator/jackrabbit/trunk/lib/jcr.jar
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManagerImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropertyDefImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/XASessionImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeWrapper.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java
Log:
migrating to v0.15 of the jsr 170 spec

Modified: incubator/jackrabbit/trunk/lib/jcr.jar
==============================================================================
Binary files. No diff available.

Added: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManager.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManager.java	Mon Oct 25 10:49:43 2004
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.core;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
+
+/**
+ * The <code>AccessManager</code> can be queried to determines whether permission
+ * is granted to perform a specific action on a specific item.
+ */
+public interface AccessManager {
+
+    /** READ permission constant */
+    public static final int READ = 1;
+    /** WRITE permission constant */
+    public static final int WRITE = 2;
+
+    /**
+     * Determines whether the specified <code>permissions</code> are granted
+     * on the item with the specified <code>id</code> (i.e. the <i>target</i> item).
+     *
+     * @param id the id of the target item
+     * @param permissions A combination of one or more of the following constants
+     * encoded as a bitmask value:
+     * <ul>
+     * <li><code>READ</code></li>
+     * <li><code>WRITE</code></li>
+     * </ul>
+     *
+     * @throws AccessDeniedException if permission is denied
+     * @throws ItemNotFoundException if the target item does not exist
+     * @throws RepositoryException it an error occurs
+     */
+    public void checkPermission(ItemId id, int permissions)
+            throws AccessDeniedException, ItemNotFoundException, RepositoryException;
+
+    /**
+     * Determines whether the specified <code>permissions</code> are granted
+     * on the item with the specified <code>id</code> (i.e. the <i>target</i> item).
+     *
+     * @param id the id of the target item
+     * @param permissions A combination of one or more of the following constants
+     * @return <code>true</code> if permission is granted; otherwise <code>false</code>
+     * @throws ItemNotFoundException if the target item does not exist
+     * @throws RepositoryException it an error occurs
+     */
+    public boolean isGranted(ItemId id, int permissions)
+            throws ItemNotFoundException, RepositoryException;
+}

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManagerImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManagerImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/AccessManagerImpl.java	Mon Oct 25 10:49:43 2004
@@ -17,72 +17,47 @@
 
 import org.apache.log4j.Logger;
 
+import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
-import javax.jcr.access.AccessManager;
+import javax.jcr.ItemNotFoundException;
 
 /**
  * <code>AccessManagerImpl</code> ...
  */
-public class AccessManagerImpl extends AbstractAccessManager {
+public class AccessManagerImpl implements AccessManager {
 
     private static Logger log = Logger.getLogger(AccessManagerImpl.class);
 
+    /** hierarchy manager used for ACL-based access control model */
     protected final HierarchyManager hierMgr;
-    protected final NamespaceResolver nsResolver;
 
     /**
      * Package private constructor
      *
      * @param credentials
      * @param hierMgr
-     * @param nsReg
      */
-    AccessManagerImpl(Credentials credentials, HierarchyManager hierMgr, NamespaceResolver nsReg) {
+    AccessManagerImpl(Credentials credentials, HierarchyManager hierMgr) {
         this.hierMgr = hierMgr;
-        this.nsResolver = nsReg;
-    }
-
-    /**
-     * Copy constructor
-     */
-    AccessManagerImpl(AccessManagerImpl other) {
-        this.hierMgr = other.hierMgr;
-        this.nsResolver = other.nsResolver;
-    }
-
-    /**
-     * @param id
-     * @param permissions
-     * @return
-     */
-    public boolean isGranted(ItemId id, long permissions) throws ItemNotFoundException, RepositoryException {
-        return (getPermissions(id) & permissions) == permissions;
     }
 
+    //--------------------------------------------------------< AccessManager >
     /**
-     * @param id
-     * @return
+     * @see AccessManager#checkPermission(ItemId, int)
      */
-    public long getPermissions(ItemId id) throws ItemNotFoundException, RepositoryException {
-        // @todo implement resource-based access control
-
-        return PermissionImpl.ALL_VALUES;
+    public void checkPermission(ItemId id, int permissions)
+            throws AccessDeniedException, ItemNotFoundException,
+            RepositoryException {
+        // @todo implement access control
     }
 
-    //--------------------------------------------------------< AccessManager >
     /**
-     * @see AccessManager#getPermissions(String)
+     * @see AccessManager#isGranted(ItemId, int)
      */
-    public long getPermissions(String absPath) throws PathNotFoundException, RepositoryException {
-        try {
-            return getPermissions(hierMgr.resolvePath(Path.create(absPath, nsResolver, true)));
-        } catch (MalformedPathException mpe) {
-            String msg = "failed to check permissions for " + absPath;
-            log.warn(msg, mpe);
-            throw new RepositoryException(msg, mpe);
-        }
+    public boolean isGranted(ItemId id, int permissions)
+            throws ItemNotFoundException, RepositoryException {
+        // @todo implement access control
+        return true;
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	Mon Oct 25 10:49:43 2004
@@ -28,13 +28,12 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
-import javax.jcr.access.Permission;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
 import java.util.*;
 
@@ -449,13 +448,13 @@
          * - if it is 'new', check that its node type satisfies the
          *   'required node type' constraint specified in its definition
          * - if new child nodes have been added to the node in question,
-         *   check the ADD_NODE permission
+         *   check the WRITE permission
          * - if child items have been removed from the node in question,
-         *   check the REMOVE_ITEM permission
+         *   check the WRITE permission
          * - check if 'mandatory' child items exist
          *
          * for every transient property:
-         * - check the SET_PROPERTY permission
+         * - check the WRITE permission
          * - check if the property value satisfies the value constraints specified
          *   in the property's definition
          *
@@ -496,8 +495,8 @@
 
                 // check child removals
                 if (!nodeState.getRemovedChildNodeEntries().isEmpty() || !nodeState.getRemovedPropertyEntries().isEmpty()) {
-                    // check REMOVE_ITEM permission
-                    if (!accessMgr.isGranted(id, Permission.REMOVE_ITEM)) {
+                    // check WRITE permission
+                    if (!accessMgr.isGranted(id, AccessManager.WRITE)) {
                         String msg = node.safeGetJCRPath() + ": not allowed to remove a child item";
                         log.error(msg);
                         throw new AccessDeniedException(msg);
@@ -515,8 +514,8 @@
                     Node childNode = (Node) itemMgr.getItem(new NodeId(entry.getUUID()));
                     NodeDef childDef = childNode.getDefinition();
                     if (!childDef.isAutoCreate()) {
-                        // check ADD_NODE permission
-                        if (!accessMgr.isGranted(id, Permission.ADD_NODE)) {
+                        // check WRITE permission
+                        if (!accessMgr.isGranted(id, AccessManager.WRITE)) {
                             String msg = node.safeGetJCRPath() + ": not allowed to add node " + childNode.getName();
                             log.error(msg);
                             throw new AccessDeniedException(msg);
@@ -552,12 +551,20 @@
                 PropertyDefImpl def = (PropertyDefImpl) prop.getDefinition();
 
                 if (!def.isAutoCreate()) {
-                    // check SET_PROPERTY permission
-                    if (!accessMgr.isGranted(nodeId, Permission.SET_PROPERTY)) {
+                    // check WRITE permission on property
+                    if (!accessMgr.isGranted(propId, AccessManager.WRITE)) {
                         String msg = itemMgr.safeGetJCRPath(nodeId) + ": not allowed to set property " + prop.getName();
                         log.error(msg);
                         throw new AccessDeniedException(msg);
                     }
+                    if (propState.getOverlayedState() == null) {
+                        // property has been added, check WRITE permission on parent
+                        if (!accessMgr.isGranted(nodeId, AccessManager.WRITE)) {
+                            String msg = itemMgr.safeGetJCRPath(nodeId) + ": not allowed to set property " + prop.getName();
+                            log.error(msg);
+                            throw new AccessDeniedException(msg);
+                        }
+                    }
                 }
 
                 // check value constraints
@@ -565,7 +572,7 @@
                 // as those are set by the implementation only, i.e. they
                 // cannot be set by the user through the api)
                 if (!def.isProtected()) {
-                    if (def.getValueConstraint() != null) {
+                    if (def.getValueConstraints() != null) {
                         InternalValue[] values = propState.getValues();
                         try {
                             NodeTypeImpl.checkSetPropertyValueConstraints(def, values);
@@ -586,7 +593,7 @@
 
     private void checkReferences(Iterator iterDirty, Iterator iterRemoved,
                                  ReferenceManager refMgr)
-            throws ConstraintViolationException, RepositoryException {
+            throws ReferentialIntegrityException, RepositoryException {
         // map of target (node) id's and modified NodeReferences objects
         HashMap dirtyNodeRefs = new HashMap();
 
@@ -628,7 +635,7 @@
                             String msg = itemMgr.safeGetJCRPath(propState.getId())
                                     + ": target node of REFERENCE property does not exist";
                             log.warn(msg);
-                            throw new ConstraintViolationException(msg);
+                            throw new ReferentialIntegrityException(msg);
                         }
                         // target is a new (unsaved) node; make sure that it is
                         // within the scope of the current save operation
@@ -640,7 +647,7 @@
                                     String msg = itemMgr.safeGetJCRPath(propState.getId())
                                             + ": target node of REFERENCE property is a new node and must therefore either be saved first or be within the scope of the current save operation.";
                                     log.warn(msg);
-                                    throw new ConstraintViolationException(msg);
+                                    throw new ReferentialIntegrityException(msg);
                                 }
                             } catch (MalformedPathException mpe) {
                                 // should never get here...
@@ -715,7 +722,7 @@
                 String msg = nodeState.getId()
                         + ": the node cannot be removed because it is being referenced.";
                 log.warn(msg);
-                throw new ConstraintViolationException(msg);
+                throw new ReferentialIntegrityException(msg);
             }
         }
 
@@ -953,12 +960,66 @@
     }
 
     /**
+     * @see Item#remove
+     */
+    public void remove() throws RepositoryException {
+        // check state of this instance
+        checkItemState();
+
+        Path.PathElement thisName = getPrimaryPath().getNameElement();
+
+        // check if protected
+        if (isNode()) {
+            NodeImpl node = (NodeImpl) this;
+            NodeDef def = node.getDefinition();
+            // check protected flag
+            if (def.isProtected()) {
+                String msg = safeGetJCRPath() + ": cannot remove a protected node";
+                log.error(msg);
+                throw new ConstraintViolationException(msg);
+            }
+        } else {
+            PropertyImpl prop = (PropertyImpl) this;
+            PropertyDef def = prop.getDefinition();
+            // check protected flag
+            if (def.isProtected()) {
+                String msg = safeGetJCRPath() + ": cannot remove a protected property";
+                log.error(msg);
+                throw new ConstraintViolationException(msg);
+            }
+        }
+
+        NodeImpl parentNode = (NodeImpl) getParent();
+
+        // check if versioning allows write
+        if (!parentNode.safeIsCheckedOut()) {
+            String msg = parentNode.safeGetJCRPath() + ": cannot remove a child of a checked-in node";
+            log.error(msg);
+            throw new VersionException(msg);
+        }
+
+        // check protected flag of parent node
+        if (parentNode.getDefinition().isProtected()) {
+            String msg = parentNode.safeGetJCRPath() + ": cannot remove a child of a protected node";
+            log.error(msg);
+            throw new ConstraintViolationException(msg);
+        }
+
+        // delegate the removal of the child item to the parent node
+        if (isNode()) {
+            parentNode.removeChildNode(thisName.getName(), thisName.getIndex());
+        } else {
+            parentNode.removeChildProperty(thisName.getName());
+        }
+    }
+
+    /**
      * @see Item#save
      */
     public synchronized void save()
             throws AccessDeniedException, LockException,
             ConstraintViolationException, InvalidItemStateException,
-            RepositoryException {
+            ReferentialIntegrityException, RepositoryException {
         // check state of this instance
         checkItemState();
 
@@ -1241,40 +1302,6 @@
      */
     public Session getSession() throws RepositoryException {
         return session;
-    }
-
-    /**
-     * @see Item#isGranted
-     */
-    public boolean isGranted(long permissions)
-            throws UnsupportedRepositoryOperationException, RepositoryException {
-        checkItemState();
-
-        try {
-            // check state of this instance
-            checkItemState();
-
-            Permission[] perms = session.getAccessManager().getSupportedPermissions();
-            // check each permission separately
-            AccessManagerImpl accessMgr = session.getAccessManager();
-            for (int i = 0; i < perms.length; i++) {
-                Permission perm = perms[i];
-                if ((permissions & perm.getValue()) == perm.getValue()) {
-                    if (!accessMgr.isGranted(id, perm.getValue())) {
-                        return false;
-                    }
-                }
-                permissions &= ~perm.getValue();
-            }
-            if (permissions > 0) {
-                log.warn("unsupported/unknown permissions: " + permissions);
-            }
-            return true;
-        } catch (PathNotFoundException pnfe) {
-            String msg = "failed to check permissions on " + safeGetJCRPath();
-            log.error(msg, pnfe);
-            throw new RepositoryException(msg, pnfe);
-        }
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java	Mon Oct 25 10:49:43 2004
@@ -21,8 +21,6 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
-import javax.jcr.access.Permission;
 import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.PropertyDef;
 import java.io.PrintStream;
@@ -207,7 +205,7 @@
     public synchronized ItemImpl getItem(ItemId id)
             throws ItemNotFoundException, AccessDeniedException, RepositoryException {
         // check privileges
-        if (!session.getAccessManager().isGranted(id, Permission.READ_ITEM)) {
+        if (!session.getAccessManager().isGranted(id, AccessManager.READ)) {
             // clear cache
             if (isCached(id)) {
                 evictItem(id);
@@ -239,7 +237,7 @@
     synchronized NodeIterator getChildNodes(NodeId parentId)
             throws ItemNotFoundException, AccessDeniedException, RepositoryException {
         // check privileges
-        if (!session.getAccessManager().isGranted(parentId, Permission.READ_ITEM)) {
+        if (!session.getAccessManager().isGranted(parentId, AccessManager.READ)) {
             // clear cache
             ItemImpl item = retrieveItem(parentId);
             if (item != null) {
@@ -295,7 +293,7 @@
     synchronized PropertyIterator getChildProperties(NodeId parentId)
             throws ItemNotFoundException, AccessDeniedException, RepositoryException {
         // check privileges
-        if (!session.getAccessManager().isGranted(parentId, Permission.READ_ITEM)) {
+        if (!session.getAccessManager().isGranted(parentId, AccessManager.READ)) {
             ItemImpl item = retrieveItem(parentId);
             if (item != null) {
                 evictItem(parentId);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	Mon Oct 25 10:49:43 2004
@@ -24,7 +24,6 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
 import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.*;
@@ -1033,92 +1032,6 @@
 
     //-----------------------------------------------------------------< Node >
     /**
-     * @see Node#remove(String)
-     */
-    public synchronized void remove(String relPath)
-            throws PathNotFoundException, RepositoryException {
-        // check state of this instance
-        checkItemState();
-
-        Path targetPath;
-        Path.PathElement targetName;
-        Path parentPath;
-        try {
-            targetPath = Path.create(getPrimaryPath(), relPath, session.getNamespaceResolver(), true);
-            targetName = targetPath.getNameElement();
-            parentPath = targetPath.getAncestor(1);
-        } catch (MalformedPathException e) {
-            String msg = "failed to resolve path " + relPath + " relative to " + safeGetJCRPath();
-            log.error(msg, e);
-            throw new RepositoryException(msg, e);
-        }
-
-        // check if the specified item exists and if it is protected
-        ItemImpl targetItem;
-        try {
-            targetItem = itemMgr.getItem(targetPath);
-            if (targetItem.isNode()) {
-                NodeImpl node = (NodeImpl) targetItem;
-                NodeDef def = node.getDefinition();
-                // check protected flag
-                if (def.isProtected()) {
-                    String msg = targetItem.safeGetJCRPath() + ": cannot remove a protected node";
-                    log.error(msg);
-                    throw new ConstraintViolationException(msg);
-                }
-            } else {
-                PropertyImpl prop = (PropertyImpl) targetItem;
-                PropertyDef def = prop.getDefinition();
-                // check protected flag
-                if (def.isProtected()) {
-                    String msg = targetItem.safeGetJCRPath() + ": cannot remove a protected property";
-                    log.error(msg);
-                    throw new ConstraintViolationException(msg);
-                }
-            }
-        } catch (AccessDeniedException ade) {
-            throw new PathNotFoundException(relPath);
-        }
-
-        NodeImpl parentNode;
-        try {
-            ItemImpl parent = itemMgr.getItem(parentPath);
-            if (!parent.isNode()) {
-                // should never get here
-                String msg = "cannot remove an item from a property " + parent.safeGetJCRPath();
-                log.error(msg);
-                throw new RepositoryException(msg);
-            }
-            parentNode = (NodeImpl) parent;
-        } catch (AccessDeniedException ade) {
-            // should never get here because we already checked
-            // the existence of the child...
-            throw new PathNotFoundException(relPath);
-        }
-
-        // check if versioning allows write
-        if (!parentNode.safeIsCheckedOut()) {
-            String msg = parentNode.safeGetJCRPath() + ": cannot remove a child of a checked-in node";
-            log.error(msg);
-            throw new VersionException(msg);
-        }
-
-        // check protected flag of parent node
-        if (parentNode.getDefinition().isProtected()) {
-            String msg = parentNode.safeGetJCRPath() + ": cannot remove a child of a protected node";
-            log.error(msg);
-            throw new ConstraintViolationException(msg);
-        }
-
-        // delegate the removal of the child item to the parent node
-        if (targetItem.isNode()) {
-            parentNode.removeChildNode(targetName.getName(), targetName.getIndex());
-        } else {
-            parentNode.removeChildProperty(targetName.getName());
-        }
-    }
-
-    /**
      * @see Node#addNode(String)
      */
     public synchronized Node addNode(String relPath)
@@ -2083,7 +1996,8 @@
      * @see Node#checkin()
      */
     public Version checkin()
-            throws UnsupportedRepositoryOperationException, RepositoryException {
+            throws VersionException, UnsupportedRepositoryOperationException,
+            RepositoryException {
 
         if (!isCheckedOut()) {
             String msg = "Unable to checkin node. Is not checked-out. " + safeGetJCRPath();
@@ -2316,11 +2230,11 @@
             NodeIterator ni = getNodes();
             while (ni.hasNext()) {
                 // if the subnode does not exist in the src, and this is update,
-                // so delete here aswell?
+                // so delete here as well?
                 Node n = ni.nextNode();
                 if (!srcNode.hasNode(n.getName())) {
                     // todo: how does this work for same name siblings?
-                    remove(n.getName());
+                    n.remove();
                 }
             }
             // 'clone' nodes that do not exist
@@ -2734,7 +2648,7 @@
                 // if frozen node exist, replace
                 // todo: make work for same name siblings
                 if (hasNode(f.getName())) {
-                    getNode(f.getName()).remove(".");
+                    getNode(f.getName()).remove();
                 }
                 NodeImpl n = addNode(f.getName(), f);
                 n.restoreFrozenState(f, vsel);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java	Mon Oct 25 10:49:43 2004
@@ -24,7 +24,6 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.PropertyDef;
 import javax.jcr.version.VersionException;
@@ -338,7 +337,7 @@
     /**
      * @see Property#getValues()
      */
-    public Value[] getValues() throws RepositoryException {
+    public Value[] getValues() throws ValueFormatException, RepositoryException {
         // check state of this instance
         checkItemState();
 
@@ -359,7 +358,7 @@
     /**
      * @see Property#getValue()
      */
-    public Value getValue() throws RepositoryException {
+    public Value getValue() throws ValueFormatException, RepositoryException {
         // check state of this instance
         checkItemState();
 
@@ -518,18 +517,6 @@
     }
 
     /**
-     * @see Property#hasValue()
-     */
-    public boolean hasValue() {
-        // check state of this instance
-        //checkItemState();
-
-        PropertyState state = (PropertyState) getItemState();
-        InternalValue[] values = state.getValues();
-        return values.length > 0;
-    }
-
-    /**
      * @see Property#setValue(Calendar)
      */
     public void setValue(Calendar date) throws ValueFormatException, RepositoryException {
@@ -992,9 +979,14 @@
     /**
      * @see Property#getLength
      */
-    public long getLength() {
+    public long getLength() throws ValueFormatException, RepositoryException {
         // check state of this instance
-        //checkItemState();
+        checkItemState();
+
+        // check multi-value flag
+        if (definition.isMultiple()) {
+            throw new ValueFormatException(safeGetJCRPath() + " is multi-valued");
+        }
 
         InternalValue[] values = ((PropertyState) state).getValues();
         if (values.length == 0) {
@@ -1013,8 +1005,9 @@
                     return name.toJCRName(session.getNamespaceResolver()).length();
                 } catch (NoPrefixDeclaredException npde) {
                     // should never happen...
-                    log.warn(safeGetJCRPath() + ": the value represents an invalid name", npde);
-                    return -1;
+                    String msg = safeGetJCRPath() + ": the value represents an invalid name";
+                    log.error(msg, npde);
+                    throw new RepositoryException(msg, npde);
                 }
 
             case PropertyType.PATH:
@@ -1023,8 +1016,9 @@
                     return path.toJCRPath(session.getNamespaceResolver()).length();
                 } catch (NoPrefixDeclaredException npde) {
                     // should never happen...
-                    log.warn(safeGetJCRPath() + ": the value represents an invalid path", npde);
-                    return -1;
+                    String msg = safeGetJCRPath() + ": the value represents an invalid path";
+                    log.error(msg, npde);
+                    throw new RepositoryException(msg, npde);
                 }
 
             case PropertyType.BINARY:
@@ -1032,6 +1026,60 @@
                 return blob.getLength();
         }
         return -1;
+    }
+
+    /**
+     * @see Property#getLengths
+     */
+    public long[] getLengths() throws ValueFormatException, RepositoryException {
+        // check state of this instance
+        checkItemState();
+
+        // check multi-value flag
+        if (!definition.isMultiple()) {
+            throw new ValueFormatException(safeGetJCRPath() + " is not multi-valued");
+        }
+
+        InternalValue[] values = ((PropertyState) state).getValues();
+        long[] lengths = new long[values.length];
+        for (int i = 0; i < values.length; i++) {
+            long length = -1;
+            InternalValue value = values[i];
+            switch (value.getType()) {
+                case PropertyType.STRING:
+                case PropertyType.LONG:
+                case PropertyType.DOUBLE:
+                    length = value.toString().length();
+
+                case PropertyType.NAME:
+                    QName name = (QName) value.internalValue();
+                    try {
+                        length = name.toJCRName(session.getNamespaceResolver()).length();
+                    } catch (NoPrefixDeclaredException npde) {
+                        // should never happen...
+                        String msg = safeGetJCRPath() + ": the value represents an invalid name";
+                        log.error(msg, npde);
+                        throw new RepositoryException(msg, npde);
+                    }
+
+                case PropertyType.PATH:
+                    Path path = (Path) value.internalValue();
+                    try {
+                        length = path.toJCRPath(session.getNamespaceResolver()).length();
+                    } catch (NoPrefixDeclaredException npde) {
+                        // should never happen...
+                        String msg = safeGetJCRPath() + ": the value represents an invalid path";
+                        log.error(msg, npde);
+                        throw new RepositoryException(msg, npde);
+                    }
+
+                case PropertyType.BINARY:
+                    BLOBFileValue blob = (BLOBFileValue) value.internalValue();
+                    length = blob.getLength();
+            }
+            lengths[i] = length;
+        }
+        return lengths;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java	Mon Oct 25 10:49:43 2004
@@ -34,7 +34,6 @@
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
-import javax.jcr.observation.EventType;
 import java.io.*;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -311,8 +310,8 @@
             String wspName = ((WorkspaceConfig) iter.next()).getName();
             Session s = getSystemSession(wspName);
             s.getWorkspace().getObservationManager().addEventListener(this,
-                    EventType.CHILD_NODE_ADDED | EventType.CHILD_NODE_REMOVED
-                    | EventType.PROPERTY_ADDED | EventType.PROPERTY_REMOVED,
+                    Event.NODE_ADDED | Event.NODE_REMOVED
+                    | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED,
                     "/", true, null, null, false);
 
             // register SearchManager as EventListener
@@ -320,9 +319,9 @@
 
             if (searchMgr != null) {
                 s.getWorkspace().getObservationManager().addEventListener(searchMgr,
-                        EventType.CHILD_NODE_ADDED | EventType.CHILD_NODE_REMOVED |
-                        EventType.PROPERTY_ADDED | EventType.PROPERTY_REMOVED |
-                        EventType.PROPERTY_CHANGED,
+                        Event.NODE_ADDED | Event.NODE_REMOVED |
+                        Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED |
+                        Event.PROPERTY_CHANGED,
                         "/", true, null, null, false);
             }
         }
@@ -684,7 +683,7 @@
         }
         if (credentials == null) {
             // anonymous login
-            return new SessionImpl(this, ANONYMOUS_CREDENTIALS, wspConfig);
+            return new XASessionImpl(this, ANONYMOUS_CREDENTIALS, wspConfig, txMgr);
         } else if (credentials instanceof SimpleCredentials) {
             // username/password credentials
             // @todo implement authentication/authorization
@@ -696,6 +695,14 @@
         }
     }
 
+    /**
+     * @see Repository#login(String)
+     */
+    public Session login(String workspaceName)
+            throws LoginException, NoSuchWorkspaceException, RepositoryException {
+        return login(null, workspaceName);
+    }
+
     //--------------------------------------------------------< EventListener >
     /**
      * @see EventListener#onEvent(EventIterator)
@@ -710,19 +717,19 @@
         while (events.hasNext()) {
             Event event = events.nextEvent();
             long type = event.getType();
-            if ((type & EventType.CHILD_NODE_ADDED) == EventType.CHILD_NODE_ADDED) {
+            if ((type & Event.NODE_ADDED) == Event.NODE_ADDED) {
                 nodesCount++;
                 repProps.setProperty(STATS_NODE_COUNT_PROPERTY, Long.toString(nodesCount));
             }
-            if ((type & EventType.CHILD_NODE_REMOVED) == EventType.CHILD_NODE_REMOVED) {
+            if ((type & Event.NODE_REMOVED) == Event.NODE_REMOVED) {
                 nodesCount--;
                 repProps.setProperty(STATS_NODE_COUNT_PROPERTY, Long.toString(nodesCount));
             }
-            if ((type & EventType.PROPERTY_ADDED) == EventType.PROPERTY_ADDED) {
+            if ((type & Event.PROPERTY_ADDED) == Event.PROPERTY_ADDED) {
                 propsCount++;
                 repProps.setProperty(STATS_PROP_COUNT_PROPERTY, Long.toString(propsCount));
             }
-            if ((type & EventType.PROPERTY_REMOVED) == EventType.PROPERTY_REMOVED) {
+            if ((type & Event.PROPERTY_REMOVED) == Event.PROPERTY_REMOVED) {
                 propsCount--;
                 repProps.setProperty(STATS_PROP_COUNT_PROPERTY, Long.toString(propsCount));
             }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java	Mon Oct 25 10:49:43 2004
@@ -34,9 +34,8 @@
 import org.apache.lucene.search.Query;
 
 import javax.jcr.RepositoryException;
-import javax.jcr.access.Permission;
 import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventType;
+import javax.jcr.observation.Event;
 import java.io.IOException;
 import java.util.*;
 
@@ -128,7 +127,7 @@
             for (int i = 0; i < result.length(); i++) {
                 String uuid = result.doc(i).get(FieldNames.UUID);
                 // check access
-                if (accessMgr.isGranted(new NodeId(uuid), Permission.READ_ITEM)) {
+                if (accessMgr.isGranted(new NodeId(uuid), AccessManager.READ)) {
                     uuids.add(uuid);
                 }
             }
@@ -157,24 +156,24 @@
             try {
                 EventImpl e = (EventImpl) events.nextEvent();
                 long type = e.getType();
-                if (type == EventType.CHILD_NODE_ADDED) {
+                if (type == Event.NODE_ADDED) {
 
-                    Path path = Path.create(e.getNodePath() + ((e.getNodePath().length() > 1) ? "/" : "") + e.getChildName(),
+                    Path path = Path.create(e.getPath(),
                             session.getNamespaceResolver(),
                             true);
                     pendingNodes.add(path);
-                } else if (type == EventType.CHILD_NODE_REMOVED) {
+                } else if (type == Event.NODE_REMOVED) {
 
-                    Path path = Path.create(e.getNodePath() + ((e.getNodePath().length() > 1) ? "/" : "") + e.getChildName(),
+                    Path path = Path.create(e.getPath(),
                             session.getNamespaceResolver(),
                             true);
                     deleteNode(path, e.getChildUUID());
 
-                } else if (type == EventType.PROPERTY_ADDED
-                        || type == EventType.PROPERTY_CHANGED
-                        || type == EventType.PROPERTY_REMOVED) {
+                } else if (type == Event.PROPERTY_ADDED
+                        || type == Event.PROPERTY_CHANGED
+                        || type == Event.PROPERTY_REMOVED) {
 
-                    Path path = Path.create(e.getNodePath(),
+                    Path path = Path.create(e.getPath(),
                             session.getNamespaceResolver(),
                             true);
                     if (!modified.contains(e.getParentUUID())) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java	Mon Oct 25 10:49:43 2004
@@ -30,12 +30,12 @@
 import org.xml.sax.helpers.XMLReaderFactory;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.security.AccessControlException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
@@ -48,6 +48,14 @@
     private static Logger log = Logger.getLogger(SessionImpl.class);
 
     /**
+     * prededfined action constants in checkPermission
+     */
+    public static final String READ_ACTION = "read";
+    public static final String REMOVE_ACTION = "remove";
+    public static final String ADD_NODE_ACTION = "add_node";
+    public static final String SET_PROPERTY_ACTION = "set_property";
+
+    /**
      * the repository that issued this session
      */
     protected final RepositoryImpl rep;
@@ -192,7 +200,7 @@
      */
     protected AccessManagerImpl createAccessManager(Credentials credentials,
                                                     HierarchyManager hierMgr) {
-        return new AccessManagerImpl(credentials, hierMgr, getNamespaceResolver());
+        return new AccessManagerImpl(credentials, hierMgr);
     }
 
     /**
@@ -200,7 +208,7 @@
      *
      * @return the <code>AccessManager</code> associated with this session
      */
-    protected AccessManagerImpl getAccessManager() {
+    public AccessManagerImpl getAccessManager() {
         return accessMgr;
     }
 
@@ -274,6 +282,147 @@
 
     //--------------------------------------------------------------< Session >
     /**
+     * @see Session#checkPermission(String, String)
+     */
+    public void checkPermission(String absPath, String actions)
+            throws AccessControlException {
+        // build the set of actions to be checked
+        String[] strings = actions.split(",");
+        HashSet set = new HashSet();
+        for (int i = 0; i < strings.length; i++) {
+            set.add(strings[i]);
+        }
+
+        Path targetPath = null;
+        ItemId targetId = null;
+
+        /**
+         * "read" action:
+         * requires READ permission on target item
+         */
+        if (set.contains(READ_ACTION)) {
+            try {
+                targetPath = Path.create(absPath, getNamespaceResolver(), true);
+                targetId = hierMgr.resolvePath(targetPath);
+                accessMgr.checkPermission(targetId, AccessManager.READ);
+            } catch (PathNotFoundException pnfe) {
+                // target does not exist, throw exception
+                throw new AccessControlException(READ_ACTION);
+            } catch (MalformedPathException mpe) {
+                String msg = "invalid path: " + absPath;
+                log.warn(msg, mpe);
+                throw new AccessControlException(READ_ACTION);
+            } catch (RepositoryException re) {
+                String msg = "failed to check READ permission on " + absPath;
+                log.warn(msg, re);
+                throw new AccessControlException(READ_ACTION);
+            }
+        }
+
+        Path parentPath = null;
+        ItemId parentId = null;
+
+        /**
+         * "add_node" action:
+         * requires WRITE permission on parent item
+         */
+        if (set.contains(ADD_NODE_ACTION)) {
+            try {
+                if (targetPath == null) {
+                    targetPath = Path.create(absPath, getNamespaceResolver(), true);
+                }
+                parentPath = targetPath.getAncestor(1);
+                parentId = hierMgr.resolvePath(parentPath);
+                accessMgr.checkPermission(parentId, AccessManager.WRITE);
+            } catch (PathNotFoundException pnfe) {
+                // parent does not exist, throw exception
+                throw new AccessControlException(ADD_NODE_ACTION);
+            } catch (MalformedPathException mpe) {
+                String msg = "invalid path: " + absPath;
+                log.warn(msg, mpe);
+                throw new AccessControlException(ADD_NODE_ACTION);
+            } catch (RepositoryException re) {
+                String msg = "failed to check WRITE permission on parent of " + absPath;
+                log.warn(msg, re);
+                throw new AccessControlException(ADD_NODE_ACTION);
+            }
+        }
+
+        /**
+         * "remove" action:
+         * requires WRITE permission on parent item
+         */
+        if (set.contains(REMOVE_ACTION)) {
+            try {
+                if (targetPath == null) {
+                    targetPath = Path.create(absPath, getNamespaceResolver(), true);
+                }
+                if (parentPath == null) {
+                    parentPath = targetPath.getAncestor(1);
+                }
+                if (parentId == null) {
+                    parentId = hierMgr.resolvePath(parentPath);
+                }
+                accessMgr.checkPermission(parentId, AccessManager.WRITE);
+            } catch (PathNotFoundException pnfe) {
+                // parent does not exist, throw exception
+                throw new AccessControlException(REMOVE_ACTION);
+            } catch (MalformedPathException mpe) {
+                String msg = "invalid path: " + absPath;
+                log.warn(msg, mpe);
+                throw new AccessControlException(REMOVE_ACTION);
+            } catch (RepositoryException re) {
+                String msg = "failed to check WRITE permission on parent of " + absPath;
+                log.warn(msg, re);
+                throw new AccessControlException(REMOVE_ACTION);
+            }
+        }
+
+        /**
+         * "set_property" action:
+         * requires WRITE permission on parent item if property is going to be
+         * added or WRITE permission on target item if property is going to be
+         * modified
+         */
+        if (set.contains(SET_PROPERTY_ACTION)) {
+            try {
+                if (targetPath == null) {
+                    targetPath = Path.create(absPath, getNamespaceResolver(), true);
+                }
+                if (targetId == null) {
+                    try {
+                        targetId = hierMgr.resolvePath(targetPath);
+                        // property does already exist,
+                        // check WRITE permission on target
+                        accessMgr.checkPermission(targetId, AccessManager.WRITE);
+                    } catch (PathNotFoundException pnfe) {
+                        // property does not exist yet,
+                        // check WRITE permission on parent
+                        if (parentPath == null) {
+                            parentPath = targetPath.getAncestor(1);
+                        }
+                        if (parentId == null) {
+                            parentId = hierMgr.resolvePath(parentPath);
+                        }
+                        accessMgr.checkPermission(parentId, AccessManager.WRITE);
+                    }
+                }
+            } catch (PathNotFoundException pnfe) {
+                // parent does not exist, throw exception
+                throw new AccessControlException(SET_PROPERTY_ACTION);
+            } catch (MalformedPathException mpe) {
+                String msg = "invalid path: " + absPath;
+                log.warn(msg, mpe);
+                throw new AccessControlException(SET_PROPERTY_ACTION);
+            } catch (RepositoryException re) {
+                String msg = "failed to check WRITE permission on parent of " + absPath;
+                log.warn(msg, re);
+                throw new AccessControlException(SET_PROPERTY_ACTION);
+            }
+        }
+    }
+
+    /**
      * @see Session#getWorkspace()
      */
     public Workspace getWorkspace() {
@@ -294,7 +443,7 @@
         // a 'superuser' to impersonate another user without needing
         // to know its password.
         try {
-            return rep.login(otherCredentials, null);
+            return rep.login(otherCredentials, getWorkspace().getName());
         } catch (NoSuchWorkspaceException nswe) {
             // should never get here...
             String msg = "impersonate failed";
@@ -360,7 +509,9 @@
     /**
      * @see Session#save
      */
-    public void save() throws AccessDeniedException, LockException, ConstraintViolationException, InvalidItemStateException, RepositoryException {
+    public void save() throws AccessDeniedException, LockException,
+            ConstraintViolationException, InvalidItemStateException,
+            RepositoryException {
         getItemManager().getRootNode().save();
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java	Mon Oct 25 10:49:43 2004
@@ -18,8 +18,9 @@
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
 import org.apache.log4j.Logger;
 
-import javax.jcr.PathNotFoundException;
+import javax.jcr.AccessDeniedException;
 import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
 
 /**
  * A <code>SystemTicket</code> ...
@@ -40,22 +41,33 @@
             throws RepositoryException {
         super(rep, SYSTEM_USER_ID, wspConfig);
 
-        accessMgr = new SystemAccessManqager();
+        accessMgr = new SystemAccessManqager(hierMgr);
     }
 
     //--------------------------------------------------------< inner classes >
     private class SystemAccessManqager extends AccessManagerImpl {
 
-        SystemAccessManqager() {
-            super(null, getHierarchyManager(), getNamespaceResolver());
+        SystemAccessManqager(HierarchyManager hierMgr) {
+            super(null, hierMgr);
         }
 
+        //----------------------------------------------------< AccessManager >
         /**
-         * @see AbstractAccessManager#getPermissions(String)
+         * @see AccessManager#checkPermission(ItemId, int)
          */
-        public long getPermissions(String absPath)
-                throws PathNotFoundException, RepositoryException {
-            return PermissionImpl.ALL_VALUES;
+        public void checkPermission(ItemId id, int permissions)
+                throws AccessDeniedException, ItemNotFoundException,
+                RepositoryException {
+            // allow everything
+        }
+
+        /**
+         * @see AccessManager#isGranted(ItemId, int)
+         */
+        public boolean isGranted(ItemId id, int permissions)
+                throws ItemNotFoundException, RepositoryException {
+            // allow everything
+            return true;
         }
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java	Mon Oct 25 10:49:43 2004
@@ -146,7 +146,7 @@
         //root.setProperty("blob", new FileInputStream(new File("d:/temp/jckrabbit.zip")));
 
         if (root.hasProperty("blah")) {
-            root.remove("blah");
+            root.getProperty("blah").remove();
         }
         root.setProperty("blah", 1);
         root.setProperty("blah", 1.4);
@@ -223,11 +223,11 @@
             System.out.println(prop.getPath() + " is a reference to " + target.getPath());
         }
 /*
-	misc.remove(".");
+	misc.remove();
 	try {
 	    root.save();
 	} catch (ConstraintViolationException cve) {
-	    root.remove("ref");
+	    root.getProperty("ref").remove();
 	    root.save();
 	}
 */
@@ -246,7 +246,7 @@
         importNode(new File("d:/dev/jsr170/jackrabbit/src/java"), imported);
 
         if (root.hasNode("foo")) {
-            root.remove("foo");
+            root.getNode("foo").remove();
         }
 
         Node n = root.addNode("foo", "nt:folder");
@@ -268,7 +268,7 @@
         System.out.println();
         dumpTree(root, System.out);
 
-        n3.remove("prop1");
+        prop1.remove();
 
         System.out.println();
         dumpTree(root, System.out);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java	Mon Oct 25 10:49:43 2004
@@ -29,9 +29,6 @@
 import org.xml.sax.SAXException;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
-import javax.jcr.access.AccessManager;
-import javax.jcr.access.Permission;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.observation.EventListener;
@@ -274,10 +271,10 @@
         Path.PathElement nodeName = nodePath.getNameElement();
         try {
             // check access rights
-            if (!accessMgr.isGranted(parentState.getId(), Permission.READ_ITEM)) {
+            if (!accessMgr.isGranted(parentState.getId(), AccessManager.READ)) {
                 throw new PathNotFoundException(hierMgr.safeGetJCRPath(parentPath));
             }
-            if (!accessMgr.isGranted(parentState.getId(), Permission.ADD_NODE)) {
+            if (!accessMgr.isGranted(parentState.getId(), AccessManager.WRITE)) {
                 throw new AccessDeniedException(hierMgr.safeGetJCRPath(parentPath) + ": not allowed to add child node");
             }
         } catch (ItemNotFoundException infe) {
@@ -352,11 +349,11 @@
 
         try {
             // check access rights
-            if (!accessMgr.isGranted(targetState.getId(), Permission.READ_ITEM)) {
+            if (!accessMgr.isGranted(targetState.getId(), AccessManager.READ)) {
                 throw new PathNotFoundException(hierMgr.safeGetJCRPath(nodePath));
             }
-            if (!accessMgr.isGranted(parentState.getId(), Permission.REMOVE_ITEM)) {
-                throw new AccessDeniedException(hierMgr.safeGetJCRPath(parentPath) + ": not allowed to remove child node");
+            if (!accessMgr.isGranted(parentState.getId(), AccessManager.WRITE)) {
+                throw new AccessDeniedException(hierMgr.safeGetJCRPath(parentPath) + ": not allowed to remove node");
             }
         } catch (ItemNotFoundException infe) {
             String msg = "internal error: failed to check access rights for " + hierMgr.safeGetJCRPath(nodePath);
@@ -577,7 +574,7 @@
 
         try {
             // check read access right on source node
-            if (!accessMgr.isGranted(srcState.getId(), Permission.READ_ITEM)) {
+            if (!accessMgr.isGranted(srcState.getId(), AccessManager.READ)) {
                 throw new PathNotFoundException(srcAbsPath);
             }
         } catch (ItemNotFoundException infe) {
@@ -712,6 +709,25 @@
     }
 
     /**
+     * @see Workspace#copy(String, String, String)
+     */
+    public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath)
+            throws NoSuchWorkspaceException, ConstraintViolationException,
+            AccessDeniedException, PathNotFoundException, ItemExistsException,
+            RepositoryException {
+        // copy (i.e. pull) subtree at srcAbsPath from srcWorkspace
+        // to 'this' workspace at destAbsPath
+        PersistentItemStateProvider srcStateMgr = rep.getWorkspaceStateManager(srcWorkspace);
+        // FIXME need to setup a hierarchy manager for source workspace
+        HierarchyManagerImpl srcHierMgr = new HierarchyManagerImpl(rep.getRootNodeUUID(), srcStateMgr, session.getNamespaceResolver());
+        // do cross-workspace copy
+        internalCopy(srcAbsPath, srcStateMgr, srcHierMgr,
+                destAbsPath, persistentStateMgr, hierMgr,
+                session.getAccessManager(), session.getNamespaceResolver(),
+                rep.getNodeTypeRegistry(), false);
+    }
+
+    /**
      * @see Workspace#move
      */
     public void move(String srcAbsPath, String destAbsPath)
@@ -853,13 +869,6 @@
     }
 
     /**
-     * @see Workspace#getAccessManager
-     */
-    public AccessManager getAccessManager() throws UnsupportedRepositoryOperationException, RepositoryException {
-        return session.getAccessManager();
-    }
-
-    /**
      * @see Workspace#getObservationManager
      */
     public synchronized ObservationManager getObservationManager()
@@ -929,7 +938,7 @@
         }
 
         // check read access
-        if (!session.getAccessManager().isGranted(state.getId(), Permission.READ_ITEM)) {
+        if (!session.getAccessManager().isGranted(state.getId(), AccessManager.READ)) {
             throw new PathNotFoundException(absPath);
         }
 
@@ -972,7 +981,7 @@
         }
 
         // check read access
-        if (!session.getAccessManager().isGranted(state.getId(), Permission.READ_ITEM)) {
+        if (!session.getAccessManager().isGranted(state.getId(), AccessManager.READ)) {
             throw new PathNotFoundException(absPath);
         }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/BindableRepository.java	Mon Oct 25 10:49:43 2004
@@ -85,16 +85,24 @@
     /**
      * @see Repository#getProperty(String)
      */
-    public String getProperty(String s) {
-        return delegatee.getProperty(s);
+    public String getProperty(String key) {
+        return delegatee.getProperty(key);
     }
 
     /**
      * @see Repository#login(Credentials, String)
      */
-    public Session login(Credentials credentials, String s)
+    public Session login(Credentials credentials, String workspaceName)
             throws LoginException, NoSuchWorkspaceException, RepositoryException {
-        return delegatee.login(credentials, s);
+        return delegatee.login(credentials, workspaceName);
+    }
+
+    /**
+     * @see Repository#login(String)
+     */
+    public Session login(String workspaceName)
+            throws LoginException, NoSuchWorkspaceException, RepositoryException {
+        return delegatee.login(workspaceName);
     }
 
     //--------------------------------------------------------< Referenceable >

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java	Mon Oct 25 10:49:43 2004
@@ -295,6 +295,27 @@
     }
 
     /**
+     * @see NodeType#isNodeType(String)
+     */
+    public boolean isNodeType(String nodeTypeName) {
+        QName ntName;
+        try {
+            ntName = QName.fromJCRName(nodeTypeName, nsResolver);
+        } catch (IllegalNameException ine) {
+            log.warn("invalid node type name: " + nodeTypeName, ine);
+            return false;
+        } catch (UnknownPrefixException upe) {
+            log.warn("invalid node type name: " + nodeTypeName, upe);
+            return false;
+        }
+        if (getQName().equals(ntName) || isDerivedFrom(ntName)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
      * @see NodeType#hasOrderableChildNodes
      */
     public boolean hasOrderableChildNodes() {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropertyDefImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropertyDefImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropertyDefImpl.java	Mon Oct 25 10:49:43 2004
@@ -80,15 +80,18 @@
     }
 
     /**
-     * @see PropertyDef#getValueConstraint
+     * @see PropertyDef#getValueConstraints
      */
-    public String getValueConstraint() {
+    public String[] getValueConstraints() {
         ValueConstraint[] constraints = propDef.getValueConstraints();
         if (constraints == null || constraints.length == 0) {
-            return null;
-        } else {
-            return constraints[0].getDefinition();
+            return new String[0];
         }
+        String[] vca = new String[constraints.length];
+        for (int i = 0; i < constraints.length; i++) {
+            vca[i] = constraints[i].getDefinition();
+        }
+        return vca;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java	Mon Oct 25 10:49:43 2004
@@ -15,18 +15,14 @@
  */
 package org.apache.jackrabbit.core.observation;
 
-import org.apache.jackrabbit.core.MalformedPathException;
-import org.apache.jackrabbit.core.NoPrefixDeclaredException;
-import org.apache.jackrabbit.core.Path;
-import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.*;
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.access.Permission;
+import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
-import javax.jcr.observation.EventType;
 import java.util.*;
 
 /**
@@ -132,8 +128,8 @@
         Set denied = null;
         while (it.hasNext()) {
             EventState state = (EventState) it.next();
-            if (state.getType() == EventType.CHILD_NODE_REMOVED
-                    || state.getType() == EventType.PROPERTY_REMOVED) {
+            if (state.getType() == Event.NODE_REMOVED
+                    || state.getType() == Event.PROPERTY_REMOVED) {
 
                 if (session.equals(state.getSession())) {
                     // if we created the event, we can be sure that
@@ -141,23 +137,20 @@
                     continue;
                 }
 
-                try {
-                    // FIXME is there a better way to check access right
-                    // without transforming path
-                    Path p = Path.create(state.getParentPath(), state.getChildItemQName(), false);
-                    if (!session.getWorkspace().getAccessManager().isGranted(p.toJCRPath(session.getNamespaceResolver()),
-                            Permission.READ_ITEM)) {
-                        if (denied == null) {
-                            denied = new HashSet();
-                        }
-                        denied.add(state);
+                // check read permission
+                ItemId targetId;
+                if (state.getChildUUID() == null) {
+                    // target is a property
+                    targetId = new PropertyId(state.getParentUUID(), state.getChildItemQName());
+                } else {
+                    // target is a node
+                    targetId = new NodeId(state.getChildUUID());
+                }
+                if (!session.getAccessManager().isGranted(targetId, AccessManager.READ)) {
+                    if (denied == null) {
+                        denied = new HashSet();
                     }
-                } catch (MalformedPathException e) {
-                    // should actually never happen
-                    log.error("internal error: malformed path exception", e);
-                } catch (NoPrefixDeclaredException e) {
-                    // should actually never happen
-                    log.error("internal error: no prefix declared", e);
+                    denied.add(state);
                 }
             }
         }
@@ -177,26 +170,22 @@
         // check permissions
         for (Iterator it = events.iterator(); it.hasNext();) {
             EventState state = (EventState) it.next();
-            if (state.getType() == EventType.CHILD_NODE_ADDED
-                    || state.getType() == EventType.PROPERTY_ADDED
-                    || state.getType() == EventType.PROPERTY_CHANGED) {
-                try {
-                    // FIXME is there a better way to check access right
-                    // without transforming path
-                    Path p = Path.create(state.getParentPath(), state.getChildItemQName(), false);
-                    if (!session.getWorkspace().getAccessManager().isGranted(p.toJCRPath(session.getNamespaceResolver()),
-                            Permission.READ_ITEM)) {
-                        if (denied == null) {
-                            denied = new HashSet();
-                        }
-                        denied.add(state);
+            if (state.getType() == Event.NODE_ADDED
+                    || state.getType() == Event.PROPERTY_ADDED
+                    || state.getType() == Event.PROPERTY_CHANGED) {
+                ItemId targetId;
+                if (state.getChildUUID() == null) {
+                    // target is a property
+                    targetId = new PropertyId(state.getParentUUID(), state.getChildItemQName());
+                } else {
+                    // target is a node
+                    targetId = new NodeId(state.getChildUUID());
+                }
+                if (!session.getAccessManager().isGranted(targetId, AccessManager.READ)) {
+                    if (denied == null) {
+                        denied = new HashSet();
                     }
-                } catch (MalformedPathException e) {
-                    // should actually never happen
-                    log.error("internal error: malformed path exception", e);
-                } catch (NoPrefixDeclaredException e) {
-                    // should actually never happen
-                    log.error("internal error: no prefix declared", e);
+                    denied.add(state);
                 }
             }
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java	Mon Oct 25 10:49:43 2004
@@ -69,14 +69,14 @@
     /**
      * @see Event#getType()
      */
-    public long getType() {
+    public int getType() {
         return eventState.getType();
     }
 
     /**
-     * @see Event#getNodePath()
+     * @see Event#getPath()
      */
-    public String getNodePath() throws RepositoryException {
+    public String getPath() throws RepositoryException {
         try {
             return eventState.getParentPath().toJCRPath(session.getNamespaceResolver());
         } catch (NoPrefixDeclaredException e) {
@@ -87,20 +87,6 @@
     }
 
     /**
-     * @see Event#getChildName()
-     */
-    public String getChildName() throws RepositoryException {
-        try {
-            return eventState.getChildItemQName().toJCRName(session.getNamespaceResolver());
-        } catch (NoPrefixDeclaredException e) {
-            // should never get here...
-            String msg = "internal error: encountered unregistered namespace in name";
-            log.error(msg, e);
-            throw new RepositoryException(msg, e);
-        }
-    }
-
-    /**
      * @see Event#getUserId()
      */
     public String getUserId() {
@@ -137,18 +123,12 @@
             StringBuffer sb = new StringBuffer();
             sb.append("Event: Path: ");
             try {
-                sb.append(getNodePath());
+                sb.append(getPath());
             } catch (RepositoryException e) {
                 log.error("Exception retrieving path: " + e);
                 sb.append("[Error retrieving path]");
             }
             sb.append(", ").append(EventState.valueOf(getType())).append(": ");
-            try {
-                sb.append(getChildName());
-            } catch (RepositoryException e) {
-                log.error("Exception retrieving child item name: " + e);
-                sb.append("[Error retrieving child item name]");
-            }
             sb.append(", UserId: ").append(getUserId());
             stringValue = sb.toString();
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventState.java	Mon Oct 25 10:49:43 2004
@@ -20,7 +20,7 @@
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 
 import javax.jcr.Session;
-import javax.jcr.observation.EventType;
+import javax.jcr.observation.Event;
 
 /**
  * The <code>EventState</code> class encapsulates the session
@@ -29,9 +29,9 @@
 class EventState {
 
     /**
-     * The {@link javax.jcr.observation.EventType} of this event.
+     * The {@link javax.jcr.observation.Event} of this event.
      */
-    private final long type;
+    private final int type;
 
     /**
      * The UUID of the parent node associated with this event.
@@ -45,8 +45,8 @@
 
     /**
      * The UUID of a child node, in case this EventState is of type
-     * {@link javax.jcr.observation.EventType#CHILD_NODE_ADDED} or
-     * {@link javax.jcr.observation.EventType#CHILD_NODE_REMOVED}.
+     * {@link javax.jcr.observation.Event#NODE_ADDED} or
+     * {@link javax.jcr.observation.Event#NODE_REMOVED}.
      */
     private final String childUUID;
 
@@ -78,8 +78,7 @@
     /**
      * Creates a new <code>EventState</code> instance.
      *
-     * @param type       the {@link javax.jcr.observation.EventType} of this
-     *                   event.
+     * @param type       the type of this event.
      * @param parentUUID the uuid of the parent node associated with this
      *                   event.
      * @param parentPath the path of the parent node associated with this
@@ -93,14 +92,14 @@
      * @param nodeType   the node type of the parent node.
      * @param session    the {@link javax.jcr.Session} that caused this event.
      */
-    private EventState(long type,
+    private EventState(int type,
                        String parentUUID,
                        Path parentPath,
                        String childUUID,
                        QName childName,
                        NodeTypeImpl nodeType,
                        Session session) {
-        long mask = (EventType.PROPERTY_ADDED | EventType.PROPERTY_CHANGED | EventType.PROPERTY_REMOVED);
+        int mask = (Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED);
         if ((type & mask) > 0) {
             if (childUUID != null) {
                 throw new IllegalArgumentException("childUUID only allowed for Node events.");
@@ -123,7 +122,7 @@
 
     /**
      * Creates a new {@link javax.jcr.observation.Event} of type
-     * {@link javax.jcr.observation.EventType#CHILD_NODE_ADDED}.
+     * {@link javax.jcr.observation.Event#NODE_ADDED}.
      *
      * @param parentUUID the uuid of the parent node associated with
      *                   this <code>EventState</code>.
@@ -141,7 +140,7 @@
                                             QName childName,
                                             NodeTypeImpl nodeType,
                                             Session session) {
-        return new EventState(EventType.CHILD_NODE_ADDED,
+        return new EventState(Event.NODE_ADDED,
                 parentUUID,
                 parentPath,
                 childUUID,
@@ -152,7 +151,7 @@
 
     /**
      * Creates a new {@link javax.jcr.observation.Event} of type
-     * {@link javax.jcr.observation.EventType#CHILD_NODE_REMOVED}.
+     * {@link javax.jcr.observation.Event#NODE_REMOVED}.
      *
      * @param parentUUID the uuid of the parent node associated with
      *                   this <code>EventState</code>.
@@ -170,7 +169,7 @@
                                               QName childName,
                                               NodeTypeImpl nodeType,
                                               Session session) {
-        return new EventState(EventType.CHILD_NODE_REMOVED,
+        return new EventState(Event.NODE_REMOVED,
                 parentUUID,
                 parentPath,
                 childUUID,
@@ -181,7 +180,7 @@
 
     /**
      * Creates a new {@link javax.jcr.observation.Event} of type
-     * {@link javax.jcr.observation.EventType#PROPERTY_ADDED}.
+     * {@link javax.jcr.observation.Event#PROPERTY_ADDED}.
      *
      * @param parentUUID the uuid of the parent node associated with
      *                   this <code>EventState</code>.
@@ -197,7 +196,7 @@
                                            QName childName,
                                            NodeTypeImpl nodeType,
                                            Session session) {
-        return new EventState(EventType.PROPERTY_ADDED,
+        return new EventState(Event.PROPERTY_ADDED,
                 parentUUID,
                 parentPath,
                 null,
@@ -208,7 +207,7 @@
 
     /**
      * Creates a new {@link javax.jcr.observation.Event} of type
-     * {@link javax.jcr.observation.EventType#PROPERTY_REMOVED}.
+     * {@link javax.jcr.observation.Event#PROPERTY_REMOVED}.
      *
      * @param parentUUID the uuid of the parent node associated with
      *                   this <code>EventState</code>.
@@ -224,7 +223,7 @@
                                              QName childName,
                                              NodeTypeImpl nodeType,
                                              Session session) {
-        return new EventState(EventType.PROPERTY_REMOVED,
+        return new EventState(Event.PROPERTY_REMOVED,
                 parentUUID,
                 parentPath,
                 null,
@@ -235,7 +234,7 @@
 
     /**
      * Creates a new {@link javax.jcr.observation.Event} of type
-     * {@link javax.jcr.observation.EventType#PROPERTY_CHANGED}.
+     * {@link javax.jcr.observation.Event#PROPERTY_CHANGED}.
      *
      * @param parentUUID the uuid of the parent node associated with
      *                   this <code>EventState</code>.
@@ -251,7 +250,7 @@
                                              QName childName,
                                              NodeTypeImpl nodeType,
                                              Session session) {
-        return new EventState(EventType.PROPERTY_CHANGED,
+        return new EventState(Event.PROPERTY_CHANGED,
                 parentUUID,
                 parentPath,
                 null,
@@ -263,7 +262,7 @@
     /**
      * @see javax.jcr.observation.Event#getType()
      */
-    public long getType() {
+    public int getType() {
         return type;
     }
 
@@ -393,19 +392,19 @@
     /**
      * Returns a String representation of <code>eventType</code>.
      *
-     * @param eventType an event type defined by {@link EventType}.
+     * @param eventType an event type defined by {@link Event}.
      * @return a String representation of <code>eventType</code>.
      */
-    public static String valueOf(long eventType) {
-        if (eventType == EventType.CHILD_NODE_ADDED) {
-            return "ChildNodeAdded";
-        } else if (eventType == EventType.CHILD_NODE_REMOVED) {
-            return "ChildNodeRemoved";
-        } else if (eventType == EventType.PROPERTY_ADDED) {
+    public static String valueOf(int eventType) {
+        if (eventType == Event.NODE_ADDED) {
+            return "NodeAdded";
+        } else if (eventType == Event.NODE_REMOVED) {
+            return "NodeRemoved";
+        } else if (eventType == Event.PROPERTY_ADDED) {
             return "PropertyAdded";
-        } else if (eventType == EventType.PROPERTY_CHANGED) {
+        } else if (eventType == Event.PROPERTY_CHANGED) {
             return "PropertyChanged";
-        } else if (eventType == EventType.PROPERTY_REMOVED) {
+        } else if (eventType == Event.PROPERTY_REMOVED) {
             return "PropertyRemoved";
         } else {
             return "UnknownEventType";

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java	Mon Oct 25 10:49:43 2004
@@ -268,7 +268,7 @@
          * @see ObservationManager#addEventListener
          */
         public void addEventListener(EventListener listener,
-                                     long eventTypes,
+                                     int eventTypes,
                                      String absPath,
                                      boolean isDeep,
                                      String[] uuid,

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java	Mon Oct 25 10:49:43 2004
@@ -20,6 +20,7 @@
 
 import javax.jcr.NodeIterator;
 import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
 import javax.jcr.query.QueryResult;
 
 /**
@@ -43,12 +44,18 @@
         this.selectProps = selectProps;
     }
 
-    public PropertyIterator getProperties() {
+    /**
+     * @see QueryResult#getProperties()  
+     */
+    public PropertyIterator getProperties() throws RepositoryException {
         return new PropertyIteratorImpl(selectProps,
                 new NodeIteratorImpl(itemMgr, uuids));
     }
 
-    public NodeIterator getNodes() {
+    /**
+     * @see QueryResult#getNodes()
+     */
+    public NodeIterator getNodes() throws RepositoryException {
         return new NodeIteratorImpl(itemMgr, uuids);
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/XASessionImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/XASessionImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/XASessionImpl.java	Mon Oct 25 10:49:43 2004
@@ -396,7 +396,7 @@
      *      Has to be overridden to provide the access manager based on items
      *      contained in the current transaction
      */
-    protected AccessManagerImpl getAccessManager() {
+    public AccessManagerImpl getAccessManager() {
         if (tx != null) {
             return (AccessManagerImpl) tx.getAttribute(ATTRIBUTE_ACCESS_MANAGER);
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeWrapper.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeWrapper.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeWrapper.java	Mon Oct 25 10:49:43 2004
@@ -19,7 +19,6 @@
 import org.apache.jackrabbit.core.QName;
 
 import javax.jcr.*;
-import javax.jcr.access.AccessDeniedException;
 import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -152,13 +151,6 @@
     }
 
     /**
-     * @see Node#remove(String)
-     */
-    public void remove(String relPath) throws PathNotFoundException, RepositoryException {
-        delegatee.remove(relPath);
-    }
-
-    /**
      * @see Node#getNode(String)
      */
     public Node getNode(String relPath) throws PathNotFoundException, RepositoryException {
@@ -510,7 +502,7 @@
     }
 
     /**
-     * @see javax.jcr.Node#save()
+     * @see Node#save()
      */
     public void save() throws AccessDeniedException, LockException, ConstraintViolationException, InvalidItemStateException, RepositoryException {
         delegatee.save();
@@ -524,9 +516,9 @@
     }
 
     /**
-     * @see Node#isGranted(long)
+     * @see Node#remove()
      */
-    public boolean isGranted(long permissions) throws UnsupportedRepositoryOperationException, RepositoryException {
-        return delegatee.isGranted(permissions);
+    public void remove() throws RepositoryException {
+        delegatee.remove();
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java	Mon Oct 25 10:49:43 2004
@@ -24,6 +24,7 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
+import javax.jcr.version.VersionException;
 
 /**
  * This Class implements a version history that extends a node.
@@ -87,16 +88,28 @@
     }
 
     /**
-     * @see VersionHistory#addVersionLabel(Version, String, boolean)
+     * @see VersionHistory#addVersionLabel(String, String)
      */
-    public void addVersionLabel(Version version, String label, boolean move) throws RepositoryException {
-        history.addVersionLabel(((VersionImpl) version).version, label, move);
+    public void addVersionLabel(String versionName, String label) throws VersionException, RepositoryException {
+        InternalVersion v;
+        try {
+            QName name = QName.fromJCRName(versionName, ((SessionImpl) unwrap().getSession()).getNamespaceResolver());
+            v = history.getVersion(name);
+        } catch (IllegalNameException e) {
+            throw new RepositoryException(e);
+        } catch (UnknownPrefixException e) {
+            throw new RepositoryException(e);
+        }
+        if (v == null) {
+            throw new VersionException("specified version does not exist");
+        }
+        history.addVersionLabel(v, label, false);
     }
 
     /**
      * @see VersionHistory#removeVersionLabel(String)
      */
-    public void removeVersionLabel(String label) throws RepositoryException {
+    public void removeVersionLabel(String label) throws VersionException, RepositoryException {
         history.removeVersionLabel(label);
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java	Mon Oct 25 10:49:43 2004
@@ -61,12 +61,11 @@
         return version.internalGetLabels();
     }
 
-    public void addVersionLabel(String label) throws RepositoryException {
-        version.getVersionHistory().addVersionLabel(version, label, false);
-    }
-
-    public void removeVersionLabel(String label) throws RepositoryException {
-        version.getVersionHistory().removeVersionLabel(label);
+    /**
+     * @see Version#hasVersionLabel
+     */
+    public boolean hasVersionLabel(String label) {
+        return version.internalHasLabel(label);
     }
 
     /**
@@ -112,7 +111,7 @@
     }
 
     /**
-     * Returns the forzen node of this version
+     * Returns the frozen node of this version
      *
      * @return
      * @throws RepositoryException

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java	Mon Oct 25 10:49:43 2004
@@ -25,7 +25,6 @@
 import org.xml.sax.SAXException;
 
 import javax.jcr.RepositoryException;
-import javax.jcr.access.Permission;
 import java.util.Iterator;
 
 /**
@@ -171,7 +170,7 @@
             }
             PropertyId propId = new PropertyId(nodeState.getUUID(), pe.getName());
             // check read access
-            if (accessMgr.isGranted(propId, Permission.READ_ITEM)) {
+            if (accessMgr.isGranted(propId, AccessManager.READ)) {
                 // serialize property
                 process(pe, nodeState.getUUID(), level + 1);
             }
@@ -187,7 +186,7 @@
                 NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) iter.next();
                 NodeId childId = new NodeId(cne.getUUID());
                 // check read access
-                if (accessMgr.isGranted(childId, Permission.READ_ITEM)) {
+                if (accessMgr.isGranted(childId, AccessManager.READ)) {
                     NodeState childState;
                     try {
                         childState = (NodeState) stateProvider.getItemState(childId);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java	Mon Oct 25 10:49:43 2004
@@ -108,7 +108,7 @@
             // clean test root
             testRootNode = root.getNode(testPath);
             for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
-                testRootNode.remove(children.nextNode().getName());
+                children.nextNode().remove();
             }
         } else {
             // create nodes to testPath
@@ -131,7 +131,7 @@
                 // clean test root
                 testRootNode = root.getNode(testPath);
                 for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
-                    testRootNode.remove(children.nextNode().getName());
+                    children.nextNode().remove();
                 }
                 root.save();
             }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java	Mon Oct 25 10:49:43 2004
@@ -20,7 +20,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventListener;
-import javax.jcr.observation.EventType;
 import javax.jcr.observation.ObservationManager;
 import java.util.HashSet;
 import java.util.Set;
@@ -54,7 +53,7 @@
      */
     protected void addEventListener(EventListener listener) throws RepositoryException {
         addEventListener(listener,
-                EventType.CHILD_NODE_ADDED | EventType.CHILD_NODE_REMOVED | EventType.PROPERTY_ADDED | EventType.PROPERTY_CHANGED | EventType.PROPERTY_REMOVED);
+                Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED);
     }
 
     /**
@@ -62,10 +61,10 @@
      * type(s).
      *
      * @param listener  the <code>EventListener</code>.
-     * @param eventType the {@link javax.jcr.observation.EventType}s
+     * @param eventType the event types
      * @throws RepositoryException if registration fails.
      */
-    protected void addEventListener(EventListener listener, long eventType)
+    protected void addEventListener(EventListener listener, int eventType)
             throws RepositoryException {
         if (obsMgr != null) {
             obsMgr.addEventListener(listener,
@@ -108,7 +107,7 @@
      */
     protected void checkNodeAdded(Event[] events, String[] relPaths)
             throws RepositoryException {
-        checkNodes(events, relPaths, EventType.CHILD_NODE_ADDED);
+        checkNodes(events, relPaths, Event.NODE_ADDED);
     }
 
     /**
@@ -123,7 +122,7 @@
      */
     protected void checkNodeRemoved(Event[] events, String[] relPaths)
             throws RepositoryException {
-        checkNodes(events, relPaths, EventType.CHILD_NODE_REMOVED);
+        checkNodes(events, relPaths, Event.NODE_REMOVED);
     }
 
     /**
@@ -138,7 +137,7 @@
      */
     protected void checkPropertyAdded(Event[] events, String[] relPaths)
             throws RepositoryException {
-        checkNodes(events, relPaths, EventType.PROPERTY_ADDED);
+        checkNodes(events, relPaths, Event.PROPERTY_ADDED);
     }
 
     /**
@@ -153,7 +152,7 @@
      */
     protected void checkPropertyChanged(Event[] events, String[] relPaths)
             throws RepositoryException {
-        checkNodes(events, relPaths, EventType.PROPERTY_CHANGED);
+        checkNodes(events, relPaths, Event.PROPERTY_CHANGED);
     }
 
     /**
@@ -168,7 +167,7 @@
      */
     protected void checkPropertyRemoved(Event[] events, String[] relPaths)
             throws RepositoryException {
-        checkNodes(events, relPaths, EventType.PROPERTY_REMOVED);
+        checkNodes(events, relPaths, Event.PROPERTY_REMOVED);
     }
 
     /**
@@ -187,8 +186,7 @@
         Set paths = new HashSet();
         for (int i = 0; i < events.length; i++) {
             assertEquals("Wrong event type", eventType, events[i].getType());
-            String path = events[i].getNodePath()
-                    + "/" + events[i].getChildName();
+            String path = events[i].getPath();
             paths.add(path);
         }
         for (int i = 0; i < relPaths.length; i++) {

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java	Mon Oct 25 10:49:43 2004
@@ -18,17 +18,16 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
-import javax.jcr.observation.EventType;
 
 /**
- * Test cases for {@link javax.jcr.observation.EventType#CHILD_NODE_ADDED
+ * Test cases for {@link javax.jcr.observation.Event.NODE_ADDED
  * CHILD_NODE_ADDED} events.
  */
 public class NodeAddedTest extends AbstractObservationTest {
 
     public void testSingleNodeAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_ADDED);
+        addEventListener(result, Event.NODE_ADDED);
         testRootNode.addNode(nodeName1, testNodeType);
         testRootNode.save();
         removeEventListener(result);
@@ -38,7 +37,7 @@
 
     public void testMultipleNodeAdded1() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_ADDED);
+        addEventListener(result, Event.NODE_ADDED);
         testRootNode.addNode(nodeName1, testNodeType);
         testRootNode.addNode(nodeName2, testNodeType);
         testRootNode.save();
@@ -49,7 +48,7 @@
 
     public void testMultipleNodeAdded2() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_ADDED);
+        addEventListener(result, Event.NODE_ADDED);
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
         n1.addNode(nodeName2, testNodeType);
         testRootNode.save();
@@ -60,10 +59,10 @@
 
     public void testTransientNodeAddedRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_ADDED);
+        addEventListener(result, Event.NODE_ADDED);
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        n1.addNode(nodeName2, testNodeType);
-        n1.remove(nodeName2);
+        Node n2 = n1.addNode(nodeName2, testNodeType);
+        n2.remove();
         testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java	Mon Oct 25 10:49:43 2004
@@ -18,20 +18,19 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
-import javax.jcr.observation.EventType;
 
 /**
- * Test cases for {@link javax.jcr.observation.EventType#CHILD_NODE_REMOVED
+ * Test cases for {@link javax.jcr.observation.Event#NODE_REMOVED
  * CHILD_NODE_REMOVED} events.
  */
 public class NodeRemovedTest extends AbstractObservationTest {
 
     public void testSingleNodeRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_REMOVED);
-        testRootNode.addNode("foo", NT_UNSTRUCTURED);
+        addEventListener(result, Event.NODE_REMOVED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         testRootNode.save();
-        testRootNode.remove("foo");
+        foo.remove();
         testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
@@ -40,11 +39,11 @@
 
     public void testMultiNodesRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_REMOVED);
+        addEventListener(result, Event.NODE_REMOVED);
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.addNode("bar", NT_UNSTRUCTURED);
         testRootNode.save();
-        testRootNode.remove("foo");
+        foo.remove();
         testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
@@ -53,12 +52,12 @@
 
     public void testMultiNodesRemovedWithRemaining() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.CHILD_NODE_REMOVED);
+        addEventListener(result, Event.NODE_REMOVED);
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         testRootNode.addNode("foobar", NT_UNSTRUCTURED);
         foo.addNode("bar", NT_UNSTRUCTURED);
         testRootNode.save();
-        testRootNode.remove("foo");
+        foo.remove();
         testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java	Mon Oct 25 10:49:43 2004
@@ -18,17 +18,16 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
-import javax.jcr.observation.EventType;
 
 /**
- * Test cases for {@link javax.jcr.observation.EventType#PROPERTY_ADDED
+ * Test cases for {@link javax.jcr.observation.Event#PROPERTY_ADDED
  * PROPERTY_ADDED} events.
  */
 public class PropertyAddedTest extends AbstractObservationTest {
 
     public void testSinglePropertyAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.PROPERTY_ADDED);
+        addEventListener(result, Event.PROPERTY_ADDED);
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         testRootNode.save();
@@ -40,7 +39,7 @@
 
     public void testMultiPropertyAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.PROPERTY_ADDED);
+        addEventListener(result, Event.PROPERTY_ADDED);
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java	Mon Oct 25 10:49:43 2004
@@ -18,10 +18,9 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
-import javax.jcr.observation.EventType;
 
 /**
- * Test cases for {@link javax.jcr.observation.EventType#PROPERTY_CHANGED
+ * Test cases for {@link javax.jcr.observation.Event#PROPERTY_CHANGED
  * PROPERTY_CHANGED} events.
  */
 public class PropertyChangedTest extends AbstractObservationTest {
@@ -31,7 +30,7 @@
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bar", new String[]{"foo"});
         testRootNode.save();
-        addEventListener(result, EventType.PROPERTY_CHANGED);
+        addEventListener(result, Event.PROPERTY_CHANGED);
         foo.getProperty("bar").setValue(new String[]{"foobar"});
         testRootNode.save();
         removeEventListener(result);
@@ -45,7 +44,7 @@
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
         testRootNode.save();
-        addEventListener(result, EventType.PROPERTY_CHANGED);
+        addEventListener(result, Event.PROPERTY_CHANGED);
         foo.getProperty("prop1").setValue(new String[]{"foobar"});
         foo.getProperty("prop2").setValue(new String[]{"foobar"});
         testRootNode.save();
@@ -59,7 +58,7 @@
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bar", new String[]{"foo"});
         testRootNode.save();
-        addEventListener(result, EventType.PROPERTY_CHANGED);
+        addEventListener(result, Event.PROPERTY_CHANGED);
         foo.getProperty("bar").setValue(new String[]{"foobar"});
         foo.setProperty("foo", new String[]{"bar"});    // will not fire prop changed event
         testRootNode.save();
@@ -74,7 +73,7 @@
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
         testRootNode.save();
-        addEventListener(result, EventType.PROPERTY_CHANGED);
+        addEventListener(result, Event.PROPERTY_CHANGED);
         foo.getProperty("prop1").setValue(new String[]{"foobar"});
         foo.getProperty("prop2").setValue(new String[]{"foobar"});
         foo.setProperty("prop3", new String[]{"foo"}); // will not fire prop changed event

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java	Mon Oct 25 10:49:43 2004
@@ -17,23 +17,23 @@
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.Property;
 import javax.jcr.observation.Event;
-import javax.jcr.observation.EventType;
 
 /**
- * Test cases for {@link javax.jcr.observation.EventType#PROPERTY_REMOVED
+ * Test cases for {@link javax.jcr.observation.Event#PROPERTY_REMOVED
  * PROPERTY_REMOVED} events.
  */
 public class PropertyRemovedTest extends AbstractObservationTest {
 
     public void testSinglePropertyRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.PROPERTY_REMOVED);
+        addEventListener(result, Event.PROPERTY_REMOVED);
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
-        foo.setProperty("prop1", new String[]{"foo"});
+        Property prop1 = foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
         testRootNode.save();
-        foo.remove("prop1");
+        prop1.remove();
         testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
@@ -42,13 +42,13 @@
 
     public void testMultiPropertyRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
-        addEventListener(result, EventType.PROPERTY_REMOVED);
+        addEventListener(result, Event.PROPERTY_REMOVED);
         Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
-        foo.setProperty("prop1", new String[]{"foo"});
-        foo.setProperty("prop2", new String[]{"bar"});
+        Property prop1 = foo.setProperty("prop1", new String[]{"foo"});
+        Property prop2 = foo.setProperty("prop2", new String[]{"bar"});
         testRootNode.save();
-        foo.remove("prop1");
-        foo.remove("prop2");
+        prop1.remove();
+        prop2.remove();
         testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);

Mime
View raw message