You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2006/07/12 15:33:27 UTC

svn commit: r421270 [20/23] - in /jackrabbit/trunk/contrib/spi: ./ commons/ commons/src/ commons/src/main/ commons/src/main/java/ commons/src/main/java/org/ commons/src/main/java/org/apache/ commons/src/main/java/org/apache/jackrabbit/ commons/src/main...

Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java (added)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,585 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi;
+
+import org.apache.jackrabbit.name.QName;
+
+import javax.jcr.lock.LockException;
+import javax.jcr.version.VersionException;
+import javax.jcr.version.Version;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Credentials;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.MergeException;
+import javax.jcr.NamespaceException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.Node;
+import java.util.Properties;
+import java.io.InputStream;
+
+/**
+ * <code>RepositoryService</code>...
+ */
+public interface RepositoryService {
+
+    /**
+     * Return the <code>IdFactory</code>
+     * 
+     * @return
+     */
+    public IdFactory getIdFactory();
+
+    //--------------------------------------------------------------------------
+    /**
+     * @return key-value pairs for repository descriptor keys and values.
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Repository#getDescriptorKeys()
+     * @see javax.jcr.Repository#getDescriptor(String)
+     */
+    public Properties getRepositoryDescriptors() throws RepositoryException;
+
+    //------------------------------------------------------< Initial login >---
+    /**
+     *
+     * @param credentials
+     * @return
+     * @throws RepositoryException
+     */
+    public SessionInfo login(Credentials credentials, String workspaceName) throws RepositoryException;
+
+    //--------------------------------------------------------------------------
+    /**
+     * @param sessionInfo
+     * @return an array of workspace ids
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#getAccessibleWorkspaceNames()
+     * @see javax.jcr.Workspace#getName()
+     */
+    public String[] getWorkspaceNames(SessionInfo sessionInfo) throws RepositoryException;
+
+    // todo: createWorkspace required????
+
+    //-----------------------------------------------------< Access Control >---
+    /**
+     * @param sessionInfo
+     * @param itemId
+     * @param actions
+     * @return true if the session with the given <code>SessionInfo</code> has
+     * the specified rights for the given item.
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Session#checkPermission(String, String)
+     */
+    public boolean isGranted(SessionInfo sessionInfo, ItemId itemId, String[] actions) throws RepositoryException;
+
+    //------------------------------------------------------< Reading items >---
+    /**
+     * @param sessionInfo
+     * @return
+     * @throws RepositoryException
+     */
+    public NodeId getRootId(SessionInfo sessionInfo) throws RepositoryException;
+
+    /**
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @return
+     * @throws RepositoryException
+     */
+    public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException;
+
+    /**
+     *
+     * @param sessionInfo
+     * @param propertyId
+     * @return
+     * @throws RepositoryException
+     */
+    public QPropertyDefinition getPropertyDefinition(SessionInfo sessionInfo, PropertyId propertyId) throws RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param itemId
+     * @return true if the item with the given id exists
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Session#itemExists(String)
+     */
+    public boolean exists(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @return
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Session#getItem(String)
+     * @see javax.jcr.Node#getNode(String)
+     * @see javax.jcr.version.VersionHistory#getAllVersions()
+     * @see javax.jcr.version.VersionHistory#getVersion(String)
+     * @see javax.jcr.version.VersionHistory#getVersionByLabel(String)
+     * @see javax.jcr.version.VersionHistory#getRootVersion()
+     * @see javax.jcr.Node#getBaseVersion()
+     * @see javax.jcr.Node#getVersionHistory()
+     * @see javax.jcr.version.Version#getContainingHistory()
+     */
+    public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws PathNotFoundException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param propertyId
+     * @return
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Session#getItem(String)
+     * @see javax.jcr.Node#getProperty(String)
+     */
+    public PropertyInfo getPropertyInfo(SessionInfo sessionInfo, PropertyId propertyId) throws PathNotFoundException, RepositoryException;
+
+    //-----------------------------------------------< general modification >---
+    /**
+     * Indicates the start of a set of operations that cause modifications
+     * on the underlaying persistence layer. All modification called on the
+     * Batch must be executed at once or non must be executed.
+     *
+     * @param sessionInfo
+     * @return
+     */
+    public Batch createBatch(SessionInfo sessionInfo) throws RepositoryException;
+
+    /**
+     * Completes the this Batch or discard all the previous modifications.
+     *
+     * @param batch
+     * @return EventIterator
+     * @throws PathNotFoundException
+     * @throws ItemNotFoundException
+     * @throws NoSuchNodeTypeException
+     * @throws ValueFormatException
+     * @throws VersionException
+     * @throws LockException
+     * @throws ConstraintViolationException
+     * @throws AccessDeniedException
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public EventIterator submit(Batch batch) throws PathNotFoundException, ItemNotFoundException, NoSuchNodeTypeException, ValueFormatException, VersionException, LockException, ConstraintViolationException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    //-------------------------------------------------------------< Import >---
+    /**
+     *
+     * @param sessionInfo
+     * @param parentId
+     * @param xmlStream
+     * @param uuidBehaviour
+     * @return
+     * @throws ItemExistsException
+     * @throws PathNotFoundException
+     * @throws VersionException
+     * @throws ConstraintViolationException
+     * @throws LockException
+     * @throws AccessDeniedException
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     * @see javax.jcr.Workspace#importXML(String, java.io.InputStream, int)
+     */
+    public EventIterator importXml(SessionInfo sessionInfo, NodeId parentId, InputStream xmlStream, int uuidBehaviour) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    //---------------------------------------------------------< Copy, Move >---
+    /**
+     * @param sessionInfo
+     * @param srcNodeId
+     * @param destParentNodeId
+     * @param destName
+     * @throws javax.jcr.ItemExistsException
+     * @throws javax.jcr.PathNotFoundException
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.nodetype.ConstraintViolationException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#move(String, String)
+     */
+    public EventIterator move(SessionInfo sessionInfo, NodeId srcNodeId, NodeId destParentNodeId, QName destName) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param srcWorkspaceId
+     * @param srcNodeId
+     * @param destParentNodeId
+     * @param destName
+     * @throws javax.jcr.NoSuchWorkspaceException
+     * @throws javax.jcr.nodetype.ConstraintViolationException
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.PathNotFoundException
+     * @throws javax.jcr.ItemExistsException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#copy(String, String)
+     * @see javax.jcr.Workspace#copy(String, String, String)
+     */
+    public EventIterator copy(SessionInfo sessionInfo, String srcWorkspaceId, NodeId srcNodeId, NodeId destParentNodeId, QName destName) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    //------------------------------------------------------< Update, Clone >---
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @param srcWorkspaceId
+     * @throws javax.jcr.NoSuchWorkspaceException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#update(String)
+     */
+    public EventIterator update(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceId) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param srcWorkspaceId
+     * @param srcNodeId
+     * @param destParentNodeId
+     * @param destName
+     * @param removeExisting
+     * @throws javax.jcr.NoSuchWorkspaceException
+     * @throws javax.jcr.nodetype.ConstraintViolationException
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.PathNotFoundException
+     * @throws javax.jcr.ItemExistsException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#clone(String, String, String, boolean)
+     */
+    public EventIterator clone(SessionInfo sessionInfo, String srcWorkspaceId, NodeId srcNodeId, NodeId destParentNodeId, QName destName, boolean removeExisting) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    //------------------------------------------------------------< Locking >---
+
+    /**
+     * Retrieve available lock information for the given <code>NodeId</code>.
+     * 
+     * @param sessionInfo
+     * @param nodeId
+     * @return
+     * @throws LockException
+     * @throws RepositoryException
+     * @see Node#getLock()
+     */
+    public LockInfo getLockInfo(SessionInfo sessionInfo, NodeId nodeId) throws LockException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @param deep
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#lock(boolean, boolean)
+     */
+    public EventIterator lock(SessionInfo sessionInfo, NodeId nodeId, boolean deep) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException;
+
+    /**
+     * Explicit refresh of an existing lock. Existing locks should be refreshed
+     * implicitely with all read and write methods listed here.
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.lock.Lock#refresh()
+     */
+    public EventIterator refreshLock(SessionInfo sessionInfo, NodeId nodeId) throws LockException, RepositoryException;
+
+    /**
+     * Releases the lock on the given node.<p/>
+     * Please note, that on {@link javax.jcr.Session#logout() logout} all
+     * session-scoped locks must be released by calling unlock.
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#unlock()
+     */
+    public EventIterator unlock(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException;
+
+    //---------------------------------------------------------< Versioning >---
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#checkin()
+     */
+    public EventIterator checkin(SessionInfo sessionInfo, NodeId nodeId) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#checkout()
+     */
+    public EventIterator checkout(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, LockException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @param versionId
+     * @param removeExisting
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.PathNotFoundException
+     * @throws javax.jcr.ItemExistsException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#restore(String, boolean)
+     * @see javax.jcr.Node#restore(javax.jcr.version.Version, boolean)
+     * @see javax.jcr.Node#restore(javax.jcr.version.Version, String, boolean)
+     * @see javax.jcr.Node#restoreByLabel(String, boolean)
+     */
+    public EventIterator restore(SessionInfo sessionInfo, NodeId nodeId, NodeId versionId, boolean removeExisting) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param versionIds
+     * @param removeExisting
+     * @throws javax.jcr.ItemExistsException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#restore(javax.jcr.version.Version[], boolean)
+     */
+    public EventIterator restore(SessionInfo sessionInfo, NodeId[] versionIds, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @param srcWorkspaceId
+     * @param bestEffort
+     * @throws javax.jcr.NoSuchWorkspaceException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.MergeException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#merge(String, boolean)
+     */
+    public EventIterator merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceId, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodeId
+     * @param mergeFailedIds The <code>NodeId</code>s remaining in the jcr:mergeFailed
+     * REFERENCE property. The version id(s) to be resolved were removed from the
+     * array and added to the predecessor ids in case of {@link Node#doneMerge(Version)}.
+     * In case of a {@link Node#cancelMerge(Version)} the version id only gets
+     * removed from the list.
+     * @param predecessorIds
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.InvalidItemStateException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Node#cancelMerge(javax.jcr.version.Version)
+     * @see javax.jcr.Node#doneMerge(javax.jcr.version.Version)
+     */
+    public EventIterator resolveMergeConflict(SessionInfo sessionInfo, NodeId nodeId, NodeId[] mergeFailedIds, NodeId[] predecessorIds) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param versionId
+     * @param label
+     * @param moveLabel
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.version.VersionHistory#addVersionLabel(String, String, boolean)
+     */
+    public EventIterator addVersionLabel(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId, QName label, boolean moveLabel) throws VersionException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param versionId
+     * @param label
+     * @return
+     * @throws javax.jcr.version.VersionException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.version.VersionHistory#removeVersionLabel(String)
+     */
+    public EventIterator removeVersionLabel(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId, QName label) throws VersionException, RepositoryException;
+
+    //----------------------------------------------------------< Searching >---
+    /**
+     * @param sessionInfo
+     * @return
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.query.QueryManager#getSupportedQueryLanguages()
+     */
+    public String[] getSupportedQueryLanguages(SessionInfo sessionInfo) throws RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param statement
+     * @param language
+     * @return
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.query.Query#execute()
+     */
+    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language) throws RepositoryException;
+
+    //--------------------------------------------------------< Observation >---
+
+    /**
+     * Registers a listener to receive events about changes that were applied
+     * by other sessions. In contrast to {@link javax.jcr.observation.ObservationManager#addEventListener)}
+     * this method does not have a <code>noLocal</code> flag. Local changes
+     * are immediately reported and only remote changes are reported to the
+     * registered listener.
+     * </p>
+     * The implementation must ensure that {@link EventIterator}s issued to
+     * potential listeners and the ones returned by the individual methods
+     * are in a proper sequence.
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @param listener
+     * @param eventTypes
+     * @param isDeep
+     * @param uuid
+     * @param nodeTypeIds
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.observation.ObservationManager#addEventListener(javax.jcr.observation.EventListener, int, String, boolean, String[], String[], boolean)
+     */
+    public void addEventListener(SessionInfo sessionInfo, NodeId nodeId, EventListener listener, int eventTypes, boolean isDeep, String[] uuid, QName[] nodeTypeIds) throws RepositoryException;
+
+    /**
+     * Removes the registration of the specified <code>EventListener</code>. If
+     * the event listener was not registered for the node indentified by <code>nodeId</code>
+     * an <code>RepositoryException</code> is thrown. The same applies if the
+     * registration timeouted before or an other error occurs.<p/>
+     * Please note, that all eventlistener registrations must be removed upon
+     * {@link javax.jcr.Session#logout()} logout) of the <code>Session</code>.
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @param listener
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.observation.ObservationManager#removeEventListener(javax.jcr.observation.EventListener)
+     */
+    public void removeEventListener(SessionInfo sessionInfo, NodeId nodeId, EventListener listener) throws RepositoryException;
+
+    //---------------------------------------------------------< Namespaces >---
+    /**
+     * Retrieve all registered namespaces.
+     *
+     * @param sessionInfo
+     * @return
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#getNamespaceRegistry()
+     * @see javax.jcr.NamespaceRegistry#getPrefixes()
+     * @see javax.jcr.NamespaceRegistry#getURIs()
+     * @see javax.jcr.NamespaceRegistry#getPrefix(String)
+     * @see javax.jcr.NamespaceRegistry#getURI(String)
+     */
+    public Properties getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException;
+
+    /**
+     * Register a new namespace with the given prefix and uri
+     *
+     * @param sessionInfo
+     * @param prefix
+     * @param uri
+     * @throws javax.jcr.NamespaceException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.NamespaceRegistry#registerNamespace(String, String)
+     */
+    public void registerNamespace(SessionInfo sessionInfo, String prefix, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException;
+
+    /**
+     * Unregister the namesspace indentified by the given prefix
+     *
+     * @param sessionInfo
+     * @param uri
+     * @throws javax.jcr.NamespaceException
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.AccessDeniedException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.NamespaceRegistry#unregisterNamespace(String)
+     */
+    public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException;
+
+    //----------------------------------------------------------< NodeTypes >---
+    /**
+     * Retrieve the <code>QNodeTypeDefinition</code>s of all registered nodetypes.
+     *
+     * @param sessionInfo
+     * @return
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.Workspace#getNodeTypeManager()
+     * @see javax.jcr.nodetype.NodeTypeManager#getAllNodeTypes()
+     * @see javax.jcr.nodetype.NodeTypeManager#getMixinNodeTypes()
+     * @see javax.jcr.nodetype.NodeTypeManager#getPrimaryNodeTypes()
+     * @see javax.jcr.nodetype.NodeTypeManager#getNodeType(String)
+     */
+    public QNodeTypeDefinitionIterator getNodeTypeDefinitions(SessionInfo sessionInfo) throws RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodetypeDefs
+     * @throws javax.jcr.nodetype.NoSuchNodeTypeException
+     * @throws javax.jcr.RepositoryException
+     */
+    public void registerNodeTypes(SessionInfo sessionInfo, QNodeTypeDefinition[] nodetypeDefs) throws NoSuchNodeTypeException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodetypeDefs
+     * @throws javax.jcr.nodetype.NoSuchNodeTypeException
+     * @throws javax.jcr.RepositoryException
+     */
+    public void reregisterNodeTypes(SessionInfo sessionInfo, QNodeTypeDefinition[] nodetypeDefs) throws NoSuchNodeTypeException, UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * @param sessionInfo
+     * @param nodetypeNames
+     * @throws javax.jcr.nodetype.NoSuchNodeTypeException
+     * @throws javax.jcr.RepositoryException
+     */
+    public void unregisterNodeTypes(SessionInfo sessionInfo, QName[] nodetypeNames) throws NoSuchNodeTypeException, UnsupportedRepositoryOperationException, RepositoryException;
+}

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/SessionInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/SessionInfo.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/SessionInfo.java (added)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/SessionInfo.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi;
+
+import javax.security.auth.Subject;
+
+/**
+ * <code>SessionInfo</code>...
+ */
+public interface SessionInfo {
+
+    public Subject getSubject();
+
+    public String getWorkspaceName();
+
+    public String[] getLockTokens();
+
+    public void addLockToken(String lockToken);
+
+    public void removeLockToken(String lockToken);
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/SessionInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/SessionInfo.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/XASessionInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/XASessionInfo.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/XASessionInfo.java (added)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/XASessionInfo.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * <code>XASessionInfo</code> extends the <code>SessionInfo</code> and provides
+ * access to the XAResource of the session info.
+ */
+public interface XASessionInfo extends SessionInfo {
+
+    /**
+     * Retrieves an <code>XAResource</code> object that the transaction manager
+     * will use to manage this <code>XASessionInfo</code> object's participation
+     * in a distributed transaction.
+     *
+     * @return the <code>XAResource</code> object.
+     */
+    public XAResource getXAResource();
+}

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/XASessionInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/XASessionInfo.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 12 06:33:19 2006
@@ -0,0 +1,6 @@
+target
+*.log
+*.iws
+*.ipr
+*.iml
+junit*.properties

Added: jackrabbit/trunk/contrib/spi/spi2dav/maven.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/maven.xml?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/maven.xml (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/maven.xml Wed Jul 12 06:33:19 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project default="jar">
+    <!--
+        the 'clean' goal is already redefined in the maven.xml
+        of the parent project. we need to redefine it here
+        again to 'maven clean' works.
+    -->
+    <goal name="clean">
+        <attainGoal name="clean:clean"/>
+    </goal>
+</project>

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/maven.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/contrib/spi/spi2dav/project.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/project.properties?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/project.properties (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/project.properties Wed Jul 12 06:33:19 2006
@@ -0,0 +1,2 @@
+maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,http://www.day.com/maven/jsr170/javadocs/jcr-0.16.1-pfd/
+maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/project.properties
------------------------------------------------------------------------------
    svn = 

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/project.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/contrib/spi/spi2dav/project.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/project.xml?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/project.xml (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/project.xml Wed Jul 12 06:33:19 2006
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project>
+    <!-- ====================================================================== -->
+    <!-- P R O J E C T  D E S C R I P T I O N                                   -->
+    <!-- ====================================================================== -->
+    <extend>${basedir}/../project.xml</extend>
+    <artifactId>jackrabbit-spi-spi2dav</artifactId>
+    <name>SPI to WebDAV</name>
+    <package>org.apache.jackrabbit.spi2dav.*</package>
+
+    <!-- ====================================================================== -->
+    <!-- D E P E N D E N C I E S                                                -->
+    <!-- ====================================================================== -->
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-spi</artifactId>
+            <version>${jackrabbit.build.version.spi}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-spi-commons</artifactId>
+            <version>${jackrabbit.build.version.spi}</version>
+        </dependency>
+        <!-- jackrabbit dependencies -->
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-commons</artifactId>
+            <version>${jackrabbit.build.version.jackrabbit}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-client</artifactId>
+            <version>${jackrabbit.build.version.jackrabbit}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-server</artifactId>
+            <version>${jackrabbit.build.version.jackrabbit}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-webdav</artifactId>
+            <version>${jackrabbit.build.version.jackrabbit}</version>
+        </dependency>
+
+        <!-- external dependencies -->
+        <dependency>
+            <groupId>jsr170</groupId>
+            <artifactId>jcr</artifactId>
+            <version>${jackrabbit.build.version.jcr}</version>
+            <url>http://jcp.org/en/jsr/detail?id=170</url>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.0</version>
+            <url>http://www.slf4j.org/download.html</url>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <url>http://jakarta.apache.org/commons/collections/</url>
+            <version>3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>servletapi</groupId>
+            <artifactId>servletapi</artifactId>
+            <version>2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <!-- runtime dependency -->
+        <dependency>
+            <!-- transitive dependency from commons-httpclient -->
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.0.3</version>
+            <properties>
+                <scope>runtime</scope>
+            </properties>
+        </dependency>
+    </dependencies>
+
+    <!-- ====================================================================== -->
+    <!-- B U I L D  D E S C R I P T I O N                                       -->
+    <!-- ====================================================================== -->
+    <build>
+        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                    <include>**/*.xsd</include>
+                    <include>**/*.properties</include>
+                    <include>**/*.dtd</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
+
+</project>

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.spi.Event;
+import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.webdav.xml.DomUtil;
+import org.apache.jackrabbit.webdav.observation.ObservationConstants;
+import org.apache.jackrabbit.webdav.observation.EventType;
+import org.apache.jackrabbit.webdav.observation.DefaultEventType;
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.jcr.observation.SubscriptionImpl;
+import org.w3c.dom.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>EventImpl</code>...
+ */
+public class EventImpl implements Event, ObservationConstants {
+
+    private static Logger log = LoggerFactory.getLogger(EventImpl.class);
+
+    private final Element eventElement;
+    private final int type;
+    private final ItemId itemId;
+    private final Path qPath;
+
+    public EventImpl(Element eventElement, URIResolver uriResolver, SessionInfo sessionInfo) throws RepositoryException, DavException {
+        this.eventElement = eventElement;
+
+        Element typeEl = DomUtil.getChildElement(eventElement, XML_EVENTTYPE, NAMESPACE);
+        EventType[] et = DefaultEventType.createFromXml(typeEl);
+        if (et.length == 0 || et.length > 1) {
+            throw new IllegalArgumentException("Ambigous event type definition: expected one single eventtype.");
+        }
+        // TODO: server sends JCR-event types. we expect spi-types
+        type = SubscriptionImpl.getJcrEventType(et[0]);
+
+        String href = DomUtil.getChildTextTrim(eventElement, DavConstants.XML_HREF, DavConstants.NAMESPACE);
+        if (type == Event.NODE_ADDED || type == Event.NODE_REMOVED) {
+            itemId = uriResolver.getNodeId(href, sessionInfo);
+        } else {
+            itemId = uriResolver.getPropertyId(href, sessionInfo);
+        }
+        qPath = uriResolver.getQPath(href, sessionInfo);
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public Path getQPath() {
+        return qPath;
+    }
+
+    public ItemId getItemId() {
+        return itemId;
+    }
+
+    public NodeId getParentId() {
+        // TODO not available from XML_EVENT element
+        return null;
+    }
+
+    public String getUUID() {
+        // TODO not available from XML_EVENT element
+        return null;
+    }
+
+    public QName getPrimaryNodeTypeName() {
+        // TODO not available from XML_EVENT element
+        return null;
+    }
+
+    public QName[] getMixinTypeNames() {
+        // TODO not available from XML_EVENT element
+        return new QName[0];
+    }
+
+    public String getUserID() {
+        return DomUtil.getChildTextTrim(eventElement, XML_EVENTUSERID, NAMESPACE);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventIteratorImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventIteratorImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventIteratorImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,110 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.webdav.xml.ElementIterator;
+import org.apache.jackrabbit.webdav.xml.DomUtil;
+import org.apache.jackrabbit.webdav.observation.ObservationConstants;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.spi.EventIterator;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.spi.Event;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+import org.w3c.dom.Element;
+
+import javax.jcr.RepositoryException;
+import java.util.NoSuchElementException;
+
+/**
+ * <code>EventIteratorImpl</code>...
+ */
+public class EventIteratorImpl implements EventIterator {
+
+    private static Logger log = LoggerFactory.getLogger(EventIteratorImpl.class);
+
+    private final SessionInfo sessionInfo;
+    private final URIResolver uriResolver;
+    private final ElementIterator eventElementIterator;
+
+    private Event next;
+    private long pos;
+
+    public EventIteratorImpl(Element eventBundleElement, URIResolver uriResolver, SessionInfo sessionInfo) {
+        if (!DomUtil.matches(eventBundleElement, ObservationConstants.XML_EVENTBUNDLE, ObservationConstants.NAMESPACE)) {
+            throw new IllegalArgumentException("eventbundle element expected.");
+        }
+
+        this.sessionInfo = sessionInfo;
+        this.uriResolver = uriResolver;
+        eventElementIterator = DomUtil.getChildren(eventBundleElement, ObservationConstants.XML_EVENT, ObservationConstants.NAMESPACE);
+        retrieveNext();
+    }
+
+    public Event nextEvent() {
+        if (next == null) {
+            throw new NoSuchElementException();
+        }
+        Event event = next;
+        retrieveNext();
+        pos++;
+        return event;
+    }
+
+    public void skip(long skipNum) {
+        while (skipNum-- > 0) {
+            next();
+        }
+    }
+
+    public long getSize() {
+        return -1; // size undefined
+    }
+
+    public long getPosition() {
+        return pos;
+    }
+
+    public void remove() {
+        eventElementIterator.remove();
+    }
+
+    public boolean hasNext() {
+        return eventElementIterator.hasNext();
+    }
+
+    public Object next() {
+        return nextEvent();
+    }
+
+    //------------------------------------------------------------< private >---
+    /**
+     *
+     */
+    private void retrieveNext() {
+        next = null;
+        while (next == null && eventElementIterator.hasNext()) {
+            Element evElem = eventElementIterator.nextElement();
+            try {
+                next = new EventImpl(evElem, uriResolver, sessionInfo);
+            } catch (RepositoryException e) {
+                log.error("Unexpected error while creating event.", e);
+            } catch (DavException e) {
+                log.error("Unexpected error while creating event.", e);
+            }
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventIteratorImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventIteratorImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.apache.jackrabbit.webdav.xml.DomUtil;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+import org.w3c.dom.Element;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.lock.LockException;
+import java.lang.reflect.Constructor;
+
+/**
+ * <code>ExceptionConverter</code>...
+ */
+public class ExceptionConverter {
+
+    private static Logger log = LoggerFactory.getLogger(ExceptionConverter.class);
+
+    // avoid instanciation
+    private ExceptionConverter() {}
+
+    static RepositoryException generate(DavException davExc) throws RepositoryException {
+        String msg = davExc.getMessage();
+        if (davExc.hasErrorCondition()) {
+            try {
+                Element error = davExc.toXml(DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument());
+                if (DomUtil.matches(error, DavException.XML_ERROR, DavConstants.NAMESPACE)) {
+                    if (DomUtil.hasChildElement(error, "exception", null)) {
+                        Element exc = DomUtil.getChildElement(error, "exception", null);
+                        if (DomUtil.hasChildElement(exc, "message", null)) {
+                            msg = DomUtil.getChildText(exc, "message", null);
+                        }
+                        if (DomUtil.hasChildElement(exc, "class", null)) {
+                            Class cl = Class.forName(DomUtil.getChildText(exc, "class", null));
+                            Constructor excConstr = cl.getConstructor(new Class[]{String.class});
+                            if (excConstr != null) {
+                                Object o = excConstr.newInstance(new String[]{msg});
+                                if (o instanceof RepositoryException) {
+                                    return (RepositoryException) o;
+                                } else if (o instanceof Exception) {
+                                    return new RepositoryException(msg, (Exception)o);
+                                }
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                throw new RepositoryException(e);
+            }
+        }
+
+        // make sure an exception is generated
+        switch (davExc.getErrorCode()) {
+            case DavServletResponse.SC_NOT_FOUND : return new ItemNotFoundException(msg);
+            case DavServletResponse.SC_LOCKED : return new LockException(msg);
+            default: return new RepositoryException(msg);
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.IdFactory;
+import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.MalformedPathException;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+/**
+ * <code>IdFactoryImpl</code>...
+ */
+public class IdFactoryImpl implements IdFactory {
+
+    private static Logger log = LoggerFactory.getLogger(IdFactoryImpl.class);
+
+    private static final IdFactory idFactory = new IdFactoryImpl(); 
+
+    private IdFactoryImpl() {};
+
+    public static IdFactory getInstance() {
+        return idFactory;
+    }
+
+    public PropertyId createPropertyId(NodeId parentId, QName propertyName) {
+        try {
+            return new PropertyIdImpl(parentId, propertyName);
+        } catch (MalformedPathException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+    }
+
+    public NodeId createNodeId(NodeId parentId, Path relativePath) {
+        try {
+            return new NodeIdImpl(parentId, relativePath);
+        } catch (MalformedPathException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+    }
+
+    public NodeId createNodeId(String uuid, Path relativePath) {
+        return new NodeIdImpl(uuid, relativePath);
+    }
+
+    public NodeId createNodeId(String uuid) {
+        return new NodeIdImpl(uuid);
+    }
+
+    //------------------------------------------------------< Inner classes >---
+    private abstract class ItemIdImpl implements ItemId {
+
+        private final String uuid;
+        private final Path relativePath;
+
+        private int hashCode = 0;
+
+        private ItemIdImpl(String uuid, Path relativePath) {
+            if (uuid == null && relativePath == null) {
+                throw new IllegalArgumentException("Only uuid or relative path might be null.");
+            }
+            this.uuid = uuid;
+            this.relativePath = relativePath;
+        }
+
+        private ItemIdImpl(NodeId parentId, QName name) throws MalformedPathException {
+            if (parentId == null || name == null) {
+                throw new IllegalArgumentException("Invalid ItemIdImpl: parentId and name must not be null.");
+            }
+            this.uuid = parentId.getUUID();
+            Path parent = parentId.getRelativePath();
+            if (parent != null) {
+                this.relativePath = Path.create(parent, name, true);
+            } else {
+                this.relativePath = Path.create(name, Path.INDEX_UNDEFINED);
+            }
+        }
+
+        public abstract boolean denotesNode();
+
+        public String getUUID() {
+            return uuid;
+        }
+
+        public Path getRelativePath() {
+            return relativePath;
+        }
+
+        /**
+         * ItemIdImpl objects are equal if the have the same uuid and relative path.
+         *
+         * @param obj
+         * @return
+         */
+        public boolean equals(Object obj) {
+            if (obj == this) {
+                return true;
+            }
+            if (obj instanceof ItemId) {
+                ItemId other = (ItemId) obj;
+                return equals(other);
+            }
+            return false;
+        }
+
+        boolean equals(ItemId other) {
+            return (uuid == null) ? other.getUUID() == null : uuid.equals(other.getUUID())
+                && (relativePath == null) ? other.getRelativePath() == null : relativePath.equals(other.getRelativePath());
+        }
+
+        /**
+         * Returns the hash code of the uuid and the relativePath. The computed hash code
+         * is memorized for better performance.
+         *
+         * @return hash code
+         * @see Object#hashCode()
+         */
+        public int hashCode() {
+            // since the ItemIdImpl is immutable, store the computed hash code value
+            if (hashCode == 0) {
+                hashCode = toString().hashCode();
+            }
+            return hashCode;
+        }
+
+        /**
+         * Combination of uuid and relative path
+         *
+         * @return
+         */
+        public String toString() {
+            StringBuffer b = new StringBuffer();
+            if (uuid != null) {
+                b.append(uuid);
+            }
+            if (relativePath != null) {
+                b.append(relativePath.toString());
+            }
+            return b.toString();
+        }
+    }
+
+    public class NodeIdImpl extends ItemIdImpl implements NodeId {
+
+        public NodeIdImpl(String uuid) {
+            super(uuid, null);
+        }
+
+        public NodeIdImpl(String uuid, Path relativePath) {
+            super(uuid, relativePath);
+        }
+
+        public NodeIdImpl(NodeId parentId, Path relativePath) throws MalformedPathException {
+            super(parentId.getUUID(), (parentId.getRelativePath() != null) ? Path.create(parentId.getRelativePath(), relativePath, true) : relativePath);
+        }
+
+        public boolean denotesNode() {
+            return true;
+        }
+
+        public boolean equals(Object obj) {
+            if (obj == this) {
+                return true;
+            }
+            if (obj instanceof NodeId) {
+                return super.equals((NodeId)obj);
+            }
+            return false;
+        }
+    }
+
+    private class PropertyIdImpl extends ItemIdImpl implements PropertyId {
+
+        private final NodeId parentId;
+
+        private PropertyIdImpl(NodeId parentId, QName name) throws MalformedPathException {
+            super(parentId, name);
+            this.parentId = parentId;
+        }
+
+        public boolean denotesNode() {
+            return false;
+        }
+
+        public NodeId getParentId() {
+            return parentId;
+        }
+
+        public QName getQName() {
+            return getRelativePath().getNameElement().getName();
+        }
+
+        public boolean equals(Object obj) {
+            if (obj == this) {
+                return true;
+            }
+            if (obj instanceof PropertyId) {
+                return super.equals((PropertyId)obj);
+            }
+            return false;
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
+import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.HrefProperty;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
+import org.apache.jackrabbit.name.NameException;
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.ItemInfo;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>ItemInfoImpl</code>...
+ */
+abstract class ItemInfoImpl implements ItemInfo {
+
+    private static Logger log = LoggerFactory.getLogger(ItemInfoImpl.class);
+
+    private final QName name;
+    private final NodeId parentId;
+
+    public ItemInfoImpl(MultiStatusResponse response, URIResolver uriResolver, SessionInfo sessionInfo) throws RepositoryException {
+
+        DavPropertySet propSet = response.getProperties(DavServletResponse.SC_OK);
+        DavProperty nameProp = propSet.get(ItemResourceConstants.JCR_NAME);
+	if (nameProp != null && nameProp.getValue() != null) {
+            // not root node
+            // TODO: jcrName is transported from jackrabbit-webdav impl
+            String jcrName = nameProp.getValue().toString();
+            try {
+                name = uriResolver.getQName(jcrName);
+            } catch (NameException e) {
+                throw new RepositoryException("Unable to build ItemInfo object, invalid name found: " + jcrName);
+            }
+	} else {
+            // root
+            name = QName.ROOT;
+        }
+        // set the parent id unless its the root item
+        if (propSet.contains(ItemResourceConstants.JCR_PARENT)) {
+            HrefProperty parentProp = new HrefProperty(propSet.get(ItemResourceConstants.JCR_PARENT));
+            String parentHref = parentProp.getHrefs().get(0).toString();
+            parentId = uriResolver.getNodeId(parentHref, sessionInfo);
+        } else {
+            parentId = null;
+        }
+    }
+
+    public NodeId getParentId() {
+        return parentId;
+    }
+
+    public QName getQName() {
+        return name;
+    }
+
+    public abstract boolean denotesNode();
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.spi.IdIterator;
+import org.apache.jackrabbit.spi.QNodeTypeDefinitionIterator;
+import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * <code>org.apache.jackrabbit.spi2dav.IteratorHelper</code>...
+ */
+public class IteratorHelper extends org.apache.jackrabbit.util.IteratorHelper
+    implements IdIterator, QNodeTypeDefinitionIterator {
+
+    private static Logger log = LoggerFactory.getLogger(IteratorHelper.class);
+
+    public IteratorHelper(Collection c) {
+        super(c);
+    }
+
+    public IteratorHelper(Iterator iter) {
+        super(iter);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ItemId nextId() {
+        return (ItemId) next();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public QNodeTypeDefinition nextDefinition() {
+        return (QNodeTypeDefinition) next();
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,77 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.webdav.lock.LockDiscovery;
+import org.apache.jackrabbit.webdav.lock.ActiveLock;
+import org.apache.jackrabbit.webdav.lock.Type;
+import org.apache.jackrabbit.webdav.lock.Scope;
+import org.apache.jackrabbit.spi.LockInfo;
+import org.apache.jackrabbit.spi.NodeId;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import javax.jcr.lock.LockException;
+import javax.jcr.RepositoryException;
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ * <code>LockInfoImpl</code>...
+ */
+public class LockInfoImpl implements LockInfo {
+
+    private static Logger log = LoggerFactory.getLogger(LockInfoImpl.class);
+
+    private final NodeId nodeId;
+    private ActiveLock activeLock;
+
+    public LockInfoImpl(LockDiscovery ld, NodeId nodeId) throws LockException, RepositoryException {
+        List activeLocks = (List) ld.getValue();
+        Iterator it = activeLocks.iterator();
+        while (it.hasNext()) {
+            ActiveLock l = (ActiveLock) it.next();
+            if (l.getType() == Type.WRITE && l.getScope() == Scope.EXCLUSIVE) {
+                if (activeLock != null) {
+                    throw new RepositoryException("Node " + nodeId + " contains multiple exclusive write locks.");
+                } else {
+                    activeLock = l;
+                }
+            }
+        }
+
+        if (activeLock == null) {
+            throw new LockException("No lock present on node " + nodeId);
+        }
+        this.nodeId = nodeId;
+    }
+
+    public NodeId getNodeId() {
+        return nodeId;
+    }
+
+    public String getLockToken() {
+        return activeLock.getToken();
+    }
+
+    public String getOwner() {
+        return activeLock.getOwner();
+    }
+
+    public boolean isDeep() {
+        return activeLock.isDeep();
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/LockInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.jcr.nodetype.NodeTypeProperty;
+import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
+import org.apache.jackrabbit.webdav.property.HrefProperty;
+import org.apache.jackrabbit.webdav.property.DavPropertyName;
+import org.apache.jackrabbit.name.NameException;
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.NodeInfo;
+import org.apache.jackrabbit.spi.IdIterator;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import javax.jcr.RepositoryException;
+import java.util.List;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.ArrayList;
+
+/**
+ * <code>NodeInfoImpl</code>...
+ */
+public class NodeInfoImpl extends ItemInfoImpl implements NodeInfo {
+
+    private static Logger log = LoggerFactory.getLogger(NodeInfoImpl.class);
+
+    private final NodeId id;
+
+    private QName primaryNodeTypeName = null;
+    private QName[] mixinNodeTypeNames = new QName[0];
+    private List references = new ArrayList();
+
+    private final List nodeIds = new ArrayList();
+    private final List propertyIds = new ArrayList();
+
+    public NodeInfoImpl(MultiStatusResponse response, List childItemResponses, URIResolver uriResolver, SessionInfo sessionInfo) throws RepositoryException, DavException {
+        super(response, uriResolver, sessionInfo);
+
+        id = uriResolver.getNodeId(getParentId(), response);
+        DavPropertySet propSet = response.getProperties(DavServletResponse.SC_OK);
+        try {
+            if (propSet.contains(ItemResourceConstants.JCR_PRIMARYNODETYPE)) {
+                Iterator it = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_PRIMARYNODETYPE)).getNodeTypeNames().iterator();
+                if (it.hasNext()) {
+                    String jcrName = it.next().toString();
+                    primaryNodeTypeName = uriResolver.getQName(jcrName);
+                } else {
+                    throw new RepositoryException("Missing primary nodetype for node " + id + ".");
+                }
+            } else {
+                throw new RepositoryException("Missing primary nodetype for node " + id);
+            }
+            if (propSet.contains(ItemResourceConstants.JCR_MIXINNODETYPES)) {
+                Set mixinNames = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_MIXINNODETYPES)).getNodeTypeNames();
+                mixinNodeTypeNames = new QName[mixinNames.size()];
+                Iterator it = mixinNames.iterator();
+                int i = 0;
+                while(it.hasNext()) {
+                    String jcrName = it.next().toString();
+                    mixinNodeTypeNames[i] = uriResolver.getQName(jcrName);
+                    i++;
+                }
+            }
+        } catch (NameException e) {
+            throw new RepositoryException("Error while resolving nodetype names: " + e.getMessage());
+        }
+
+        if (propSet.contains(ItemResourceConstants.JCR_REFERENCES)) {
+            HrefProperty refProp = new HrefProperty(propSet.get(ItemResourceConstants.JCR_REFERENCES));
+            Iterator hrefIter = refProp.getHrefs().iterator();
+            while(hrefIter.hasNext()) {
+                String propertyHref = hrefIter.next().toString();
+                PropertyId propertyId = uriResolver.getPropertyId(propertyHref, sessionInfo);
+                references.add(propertyId);
+            }
+        }
+
+        // build the child-item entries
+        Iterator it = childItemResponses.iterator();
+        while (it.hasNext()) {
+            MultiStatusResponse resp = (MultiStatusResponse)it.next();
+            DavPropertySet childProps = resp.getProperties(DavServletResponse.SC_OK);
+            if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
+                childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
+                // any other resource type than default (empty) is represented by a node item
+                NodeId childId = uriResolver.getNodeId(id, resp);
+                nodeIds.add(childId);
+            } else {
+                PropertyId propertyId = uriResolver.getPropertyId(id, resp);
+                propertyIds.add(propertyId);
+            }
+        }
+    }
+
+    public boolean denotesNode() {
+        return true;
+    }
+
+    public NodeId getId() {
+        return id;
+    }
+
+    public QName getNodetype() {
+        return primaryNodeTypeName;
+    }
+
+    public QName[] getMixins() {
+        return mixinNodeTypeNames;
+    }
+
+    public PropertyId[] getReferences() {
+        return (PropertyId[]) references.toArray(new PropertyId[references.size()]);
+    }
+
+    public IdIterator getNodeIds() {
+        return new IteratorHelper(nodeIds);
+    }
+
+    public IdIterator getPropertyIds() {
+        return new IteratorHelper(propertyIds);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java?rev=421270&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java (added)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java Wed Jul 12 06:33:19 2006
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.spi2dav;
+
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.jcr.property.ValuesProperty;
+import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
+import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.value.ValueFormat;
+import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.PropertyInfo;
+import org.apache.jackrabbit.spi.SessionInfo;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * <code>PropertyInfoImpl</code>...
+ */
+public class PropertyInfoImpl extends ItemInfoImpl implements PropertyInfo {
+
+    private static Logger log = LoggerFactory.getLogger(PropertyInfoImpl.class);
+
+    private final PropertyId id;
+
+    private int type;
+    private boolean isMultiValued;
+    private Object[] values;
+
+    public PropertyInfoImpl(MultiStatusResponse response, URIResolver uriResolver, NamespaceResolver nsResolver, SessionInfo sessionInfo) throws RepositoryException, DavException {
+        super(response, uriResolver, sessionInfo);
+
+        id = uriResolver.getPropertyId(getParentId(), response);
+
+        DavPropertySet propSet = response.getProperties(DavServletResponse.SC_OK);
+        String typeName = propSet.get(ItemResourceConstants.JCR_TYPE).getValue().toString();
+        type = PropertyType.valueFromName(typeName);
+
+        if (propSet.contains(ItemResourceConstants.JCR_VALUE)) {
+            // TODO: jcr-server sends jcr values not qualified
+            ValuesProperty vp = new ValuesProperty(propSet.get(ItemResourceConstants.JCR_VALUE), type);
+            Value jcrValue = vp.getJcrValue(type);
+            if (type == PropertyType.BINARY) {
+                values = (jcrValue == null) ?  new InputStream[0] : new InputStream[] {jcrValue.getStream()};
+            } else {
+                String vStr = (jcrValue == null) ? "" : ValueFormat.getQValue(jcrValue, nsResolver).getString();
+                values = new String[] {vStr};
+            }
+        } else {
+            isMultiValued = true;
+            ValuesProperty vp = new ValuesProperty(propSet.get(ItemResourceConstants.JCR_VALUES), type);
+            Value[] jcrValues = vp.getJcrValues(type);
+            if (type == PropertyType.BINARY) {
+                values = new InputStream[jcrValues.length];
+                for (int i = 0; i < jcrValues.length; i++) {
+                    values[i] = jcrValues[i].getStream();
+                }
+            } else {
+                values = new String[jcrValues.length];
+                for (int i = 0; i < jcrValues.length; i++) {
+                    values[i] = ValueFormat.getQValue(jcrValues[i], nsResolver);
+                }
+            }
+        }
+    }
+
+    public boolean denotesNode() {
+        return false;
+    }
+
+    public PropertyId getId() {
+        return id;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public boolean isMultiValued() {
+        return isMultiValued;
+    }
+
+    public String[] getValues() {
+        if (values instanceof InputStream[]) {
+            // TODO
+            throw new UnsupportedOperationException("use getValueAsStream");
+        } else {
+            return (String[])values;
+        }
+    }
+
+    public InputStream[] getValuesAsStream() {
+        if (values instanceof InputStream[]) {
+            return (InputStream[]) values;
+        } else {
+            InputStream[] ins = new InputStream[values.length];
+            for (int i = 0; i < values.length; i++) {
+                String v = (String)values[i];
+                try {
+                    ins[i] = (v != null) ? new ByteArrayInputStream(v.getBytes("UTF-8")) : null;
+                } catch (UnsupportedEncodingException e) {
+                    log.error("Error while converting values", e);
+                }
+            }
+            return ins;
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/PropertyInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url