jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r161660 [2/7] - in incubator/jackrabbit/trunk/contrib/jcr-server: ./ client/ client/src/java/org/apache/jackrabbit/webdav/ client/src/java/org/apache/jackrabbit/webdav/client/ client/src/java/org/apache/jackrabbit/webdav/client/methods/ server/ server/src/java/org/apache/jackrabbit/ server/src/java/org/apache/jackrabbit/server/ server/src/java/org/apache/jackrabbit/server/io/ server/src/java/org/apache/jackrabbit/server/jcr/ server/src/java/org/apache/jackrabbit/server/simple/ server/src/java/org/apache/jackrabbit/server/simple/dav/ server/src/java/org/apache/jackrabbit/webdav/simple/ server/src/java/org/apache/jackrabbit/webdav/spi/ server/src/java/org/apache/jackrabbit/webdav/spi/lock/ server/src/java/org/apache/jackrabbit/webdav/spi/nodetype/ server/src/java/org/apache/jackrabbit/webdav/spi/observation/ server/src/java/org/apache/jackrabbit/webdav/spi/property/ server/src/java/org/apache/jackrabbit/webdav/spi/search/ server/src/java/org/apache/jackrabbit/webdav/spi/transaction/ server/src/java/org/apache/jackrabbit/webdav/spi/version/ server/src/java/org/apache/jackrabbit/webdav/spi/version/report/ webapp/ webapp/src/webapp/WEB-INF/ webdav/ webdav/src/java/org/apache/jackrabbit/ webdav/src/java/org/apache/jackrabbit/webdav/ webdav/src/java/org/apache/jackrabbit/webdav/header/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/lock/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/nodetype/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/observation/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/property/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/search/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/transaction/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/version/ webdav/src/java/org/apache/jackrabbit/webdav/jcr/version/report/ webdav/src/java/org/apache/jackrabbit/webdav/lock/ webdav/src/java/org/apache/jackrabbit/webdav/search/
Date Sun, 17 Apr 2005 14:52:14 GMT
Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2005 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.server.jcr;
+
+import org.apache.log4j.Logger;
+import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.jcr.JcrDavException;
+import org.apache.jackrabbit.client.RepositoryAccessServlet;
+
+import javax.jcr.*;
+import javax.servlet.ServletException;
+import java.util.HashMap;
+import java.util.HashSet;
+/**
+ * <code>JCRWebdavServer</code>...
+ */
+public class JCRWebdavServer implements DavSessionProvider {
+
+    /** the default logger */
+    private static Logger log = Logger.getLogger(JCRWebdavServer.class);
+
+    /** the session cache */
+    private final SessionCache cache = new SessionCache();
+
+    /** the jcr repository */
+    private final Repository repository;
+
+    /**
+     * Creates a new JCRWebdavServer that operates on the given repository.
+     *
+     * @param repository
+     */
+    public JCRWebdavServer(Repository repository) {
+	this.repository = repository;
+    }
+
+    //---------------------------------------< DavSessionProvider interface >---
+    /**
+     * Acquires a DavSession either from the session cache or creates a new
+     * one by login to the repository.
+     * Upon success, the WebdavRequest will reference that session.
+     *
+     * @param request
+     * @throws DavException if no session could be obtained.
+     * @see DavSessionProvider#acquireSession(org.apache.jackrabbit.webdav.WebdavRequest)
+     */
+    public void acquireSession(WebdavRequest request)
+            throws DavException {
+        DavSession session = cache.get(request);
+	request.setDavSession(session);
+    }
+
+    /**
+     * Releases the reference from the request to the session. If no further
+     * references to the session exist, the session will be removed from the
+     * cache.
+     *
+     * @param request
+     * @see DavSessionProvider#releaseSession(org.apache.jackrabbit.webdav.WebdavRequest)
+     */
+    public void releaseSession(WebdavRequest request) {
+	DavSession session = request.getDavSession();
+	if (session != null) {
+	    session.removeReference(request);
+	}
+	// remove the session from the request
+	request.setDavSession(null);
+    }
+
+    //--------------------------------------------------------------------------
+    /**
+     * Private inner class implementing the <code>DavSession</code> interface.
+     */
+    private class DavSessionImpl implements DavSession {
+
+	/** the underlaying jcr session */
+        private final Session session;
+
+        /**
+         * Private constructor.
+         *
+         * @param request
+         * @throws DavException in case a {@link javax.jcr.LoginException} or {@link javax.jcr.RepositoryException} occurs.
+         */
+        private DavSessionImpl(DavServletRequest request) throws DavException {
+            try {
+                String workspaceName = request.getRequestLocator().getWorkspaceName();
+		Credentials creds = RepositoryAccessServlet.getCredentialsFromHeader(request.getHeader(DavConstants.HEADER_AUTHORIZATION));
+                session = repository.login(creds, workspaceName);
+            } catch (LoginException e) {
+                // LoginException results in UNAUTHORIZED,
+                throw new JcrDavException(e);
+            } catch (RepositoryException e) {
+                // RepositoryException results in FORBIDDEN
+                throw new JcrDavException(e);
+            } catch (ServletException e) {
+		throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+	    }
+        }
+
+        /**
+         * Add a reference to this <code>DavSession</code>.
+         *
+         * @see DavSession#addReference(Object)
+         */
+        public void addReference(Object reference) {
+            cache.addReference(this, reference);
+        }
+
+        /**
+         * Removes the reference from this <code>DavSession</code>. If no
+         * more references are present, this <code>DavSession</code> is removed
+         * from the internal cache and the underlaying session is released by calling
+         * {@link javax.jcr.Session#logout()}.
+         *
+         * @see DavSession#removeReference(Object)
+         */
+        public void removeReference(Object reference) {
+            cache.removeReference(this, reference);
+        }
+
+        /**
+         * @see DavSession#getRepositorySession()
+         */
+        public Session getRepositorySession() {
+            return session;
+        }
+
+	/**
+	 * @see DavSession#addLockToken(String)
+	 */
+	public void addLockToken(String token) {
+	    session.addLockToken(token);
+	}
+
+	/**
+	 * @see DavSession#getLockTokens()
+	 */
+	public String[] getLockTokens() {
+	    return session.getLockTokens();
+	}
+
+	/**
+	 * @see DavSession#removeLockToken(String)
+	 */
+	public void removeLockToken(String token) {
+	    session.removeLockToken(token);
+	}
+    }
+
+    /**
+     * Private inner class providing a cache for referenced session objects.
+     */
+    private class SessionCache {
+
+        private SessionMap sessionMap = new SessionMap();
+        private HashMap referenceToSessionMap = new HashMap();
+
+        /**
+         * Try to retrieve <code>DavSession</code> if a TransactionId or
+         * SubscriptionId is present in the request header. If no cached session
+         * was found <code>null</code> is returned.
+         *
+         * @param request
+         * @return a cached <code>DavSession</code> or <code>null</code>.
+         * @throws DavException
+         */
+        private DavSession get(WebdavRequest request)
+                throws DavException {
+            String txId = request.getTransactionId();
+            String subscriptionId = request.getSubscriptionId();
+            String lockToken = request.getLockToken();
+
+            if ((lockToken != null || txId != null) && subscriptionId != null) {
+                throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Ambiguous headers: either TransactionId/Lock-Token or SubscriptionId can be present, not both.");
+            }
+
+            DavSession session = null;
+            // try to retrieve a cached session
+            if (lockToken != null && containsReference(lockToken)) {
+                session = getSessionByReference(lockToken);
+            } else if (txId != null && containsReference(txId)) {
+                session = getSessionByReference(txId);
+            } else if (subscriptionId != null && containsReference(subscriptionId)) {
+                session = getSessionByReference(subscriptionId);
+            }
+            // no cached session present -> create new one.
+            if (session == null) {
+                session = new DavSessionImpl(request);
+                sessionMap.put(session, new HashSet());
+                log.info("login: User '" + session.getRepositorySession().getUserID() + "' logged in.");
+            } else {
+                log.info("login: Retrieved cached session for user '" + session.getRepositorySession().getUserID() + "'");
+            }
+            addReference(session, request);
+            return session;
+        }
+
+        /**
+         * Add a references to the specified <code>DavSession</code>.
+         *
+         * @param session
+         * @param reference
+         */
+        private void addReference(DavSession session, Object reference) {
+            HashSet referenceSet = sessionMap.get(session);
+            if (referenceSet != null) {
+                referenceSet.add(reference);
+                referenceToSessionMap.put(reference, session);
+            } else {
+                log.error("Failed to add reference to session. No entry in cache found.");
+            }
+        }
+
+        /**
+         * Remove the given reference from the specified <code>DavSession</code>.
+         *
+         * @param session
+         * @param reference
+         */
+        private void removeReference(DavSession session, Object reference) {
+            HashSet referenceSet = sessionMap.get(session);
+            if (referenceSet != null) {
+                if (referenceSet.remove(reference)) {
+                    log.info("Removed reference " + reference + " to session " + session);
+                    referenceToSessionMap.remove(reference);
+                } else {
+                    log.warn("Failed to remove reference " + reference + " to session " + session);
+                }
+                if (referenceSet.isEmpty()) {
+                    log.info("No more references present on webdav session -> clean up.");
+                    sessionMap.remove(session);
+                    log.info("Login: User '" + session.getRepositorySession().getUserID() + "' logged out");
+                    session.getRepositorySession().logout();
+                } else {
+                    log.debug(referenceSet.size() + " references remaining on webdav session " + session);
+                }
+            } else {
+                log.error("Failed to remove reference from session. No entry in cache found.");
+            }
+        }
+
+        /**
+         * Returns true, if there exists a <code>DavSession</code> in the cache
+         * that is referenced by the specified object.
+         *
+         * @param reference
+         * @return true if a <code>DavSession</code> is referenced by the given
+         * object.
+         */
+        private boolean containsReference(Object reference) {
+            return referenceToSessionMap.containsKey(reference);
+        }
+
+        /**
+         * Returns the <code>DavSession</code> that is referenced by the
+         * specified reference object.
+         *
+         * @param reference
+         * @return <code>DavSession</code> that is referenced by this reference
+         * object.
+         * @see #containsReference(Object)
+         */
+        private DavSession getSessionByReference(Object reference) {
+            return (DavSession) referenceToSessionMap.get(reference);
+        }
+    }
+
+    /**
+     * Simple inner class extending the {@link HashMap}.
+     */
+    private static class SessionMap extends HashMap {
+
+        public HashSet get(DavSession key) {
+            return (HashSet) super.get(key);
+        }
+
+        public HashSet put(DavSession key, HashSet value) {
+            return (HashSet) super.put(key, value);
+        }
+
+        public HashSet remove(DavSession key) {
+            return (HashSet) super.remove(key);
+        }
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServerServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServerServlet.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServerServlet.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServerServlet.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,261 @@
+/*
+ * Copyright 2005 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.server.jcr;
+
+import org.apache.log4j.Logger;
+import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.observation.*;
+import org.apache.jackrabbit.webdav.jcr.*;
+import org.apache.jackrabbit.webdav.jcr.observation.SubscriptionManagerImpl;
+import org.apache.jackrabbit.webdav.jcr.transaction.TxLockManagerImpl;
+import org.apache.jackrabbit.client.RepositoryAccessServlet;
+import org.apache.jackrabbit.server.AbstractWebdavServlet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.*;
+import javax.jcr.Repository;
+import java.io.IOException;
+
+/**
+ * JCRWebdavServerServlet provides request/response handling for the JCRWebdavServer.
+ */
+public class JCRWebdavServerServlet extends AbstractWebdavServlet implements DavConstants {
+
+    /** the default logger */
+    private static Logger log = Logger.getLogger(JCRWebdavServerServlet.class);
+
+    /** Init parameter specifying the prefix used with the resource path. */
+    public static final String INIT_PARAM_PREFIX = "resource-path-prefix";
+    private static String pathPrefix;
+
+    private JCRWebdavServer server;
+    private DavResourceFactory resourceFactory;
+    private DavLocatorFactory locatorFactory;
+    private TxLockManagerImpl txMgr;
+    private SubscriptionManager subscriptionMgr;
+
+    /**
+     * Initializes the servlet set reads the following parameter from the
+     * servlet configuration:
+     * <ul>
+     * <li>resource-path-prefix: optional prefix for all resources.</li>
+     * </ul>
+     *
+     * @throws ServletException
+     */
+    public void init() throws ServletException {
+        super.init();
+
+	// set resource path prefix
+	pathPrefix = getInitParameter(INIT_PARAM_PREFIX);
+	log.debug(INIT_PARAM_PREFIX + " = " + pathPrefix);
+
+	Repository repository = RepositoryAccessServlet.getRepository();
+	if (repository == null) {
+	    throw new ServletException("Repository could not be retrieved. Check config of 'RepositoryServlet'.");
+	}
+	server = new JCRWebdavServer(repository);
+        txMgr = new TxLockManagerImpl();
+        subscriptionMgr = new SubscriptionManagerImpl();
+
+        // todo: ev. make configurable
+        resourceFactory = new DavResourceFactoryImpl(txMgr, subscriptionMgr);
+        locatorFactory = new DavLocatorFactoryImpl(pathPrefix);
+    }
+
+    /**
+     * Returns the path prefix
+     *
+     * @return pathPrefix
+     * @see #INIT_PARAM_PREFIX
+     */
+    public static String getPathPrefix() {
+	return pathPrefix;
+    }
+
+    /**
+     * Service the request.
+     *
+     * @param request
+     * @param response
+     * @throws javax.servlet.ServletException
+     * @throws java.io.IOException
+     * @see HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    protected void service(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+
+        WebdavRequest webdavRequest = new WebdavRequestImpl(request, locatorFactory);
+        WebdavResponse webdavResponse = new WebdavResponseImpl(response);
+        try {
+            // login to the server
+            server.acquireSession(webdavRequest);
+
+            // create the resource and perform initial precondition tests
+            DavResource resource = createResource(webdavRequest.getRequestLocator(), webdavRequest, webdavResponse);
+            if (preconditionFailed(webdavRequest, resource)) {
+                webdavResponse.sendError(DavServletResponse.SC_PRECONDITION_FAILED);
+                return;
+            }
+
+            // execute the requested method
+            int methodCode = DavMethods.getMethodCode(webdavRequest.getMethod());
+            execute(webdavRequest, webdavResponse, methodCode, resource);
+        } catch (DavException e) {
+            webdavResponse.sendErrorResponse(e);
+        } finally {
+            // logout
+	    server.releaseSession(webdavRequest);
+        }
+    }
+
+    /**
+     *
+     * @param locator
+     * @param request
+     * @param response
+     * @return
+     */
+    protected DavResource createResource(DavResourceLocator locator, WebdavRequest request,
+                               WebdavResponse response) throws DavException {
+        return resourceFactory.createResource(locator, request, response);
+    }
+
+    /**
+     *
+     * @param request
+     * @param resource
+     * @return
+     */
+    private boolean preconditionFailed(WebdavRequest request, DavResource resource) {
+        // first check matching If header
+        if (!request.matchesIfHeader(resource)) {
+            return true;
+        }
+
+        // test if the requested path matches to the existing session
+        // this may occur if the session was retrieved from the cache.
+        String wsName = request.getDavSession().getRepositorySession().getWorkspace().getName();
+        boolean failed = !resource.getLocator().isSameWorkspace(wsName);
+        if (!failed) {
+            // make sure, the TransactionId header is valid
+            String txId = request.getTransactionId();
+            if (txId != null && !txMgr.hasLock(txId, resource)) {
+               failed = true;
+            }
+        }
+        return failed;
+    }
+
+    /**
+     * @param request
+     * @param response
+     * @param method
+     * @param resource
+     * @throws ServletException
+     * @throws IOException
+     * @throws DavException
+     */
+    private void execute(WebdavRequest request, WebdavResponse response,
+                 int method, DavResource resource)
+            throws ServletException, IOException, DavException {
+
+        switch (method) {
+            case DavMethods.DAV_GET:
+                doGet(request, response, resource);
+                break;
+            case DavMethods.DAV_HEAD:
+                doHead(request, response, resource);
+                break;
+            case DavMethods.DAV_PROPFIND:
+                doPropFind(request, response, resource);
+                break;
+            case DavMethods.DAV_PROPPATCH:
+                doPropPatch(request, response, resource);
+                break;
+            case DavMethods.DAV_POST:
+            case DavMethods.DAV_PUT:
+                doPut(request, response, resource);
+                break;
+            case DavMethods.DAV_DELETE:
+                doDelete(request, response, resource);
+                break;
+            case DavMethods.DAV_COPY:
+                doCopy(request, response, resource);
+                break;
+            case DavMethods.DAV_MOVE:
+                doMove(request, response, resource);
+                break;
+            case DavMethods.DAV_MKCOL:
+                doMkCol(request, response, resource);
+                break;
+            case DavMethods.DAV_OPTIONS:
+                doOptions(request, response, resource);
+                break;
+            case DavMethods.DAV_LOCK:
+                doLock(request, response, resource);
+                break;
+            case DavMethods.DAV_UNLOCK:
+                doUnlock(request, response, resource);
+                break;
+            case DavMethods.DAV_ORDERPATCH:
+                doOrderPatch(request, response, resource);
+                break;
+            case DavMethods.DAV_SUBSCRIBE:
+                doSubscribe(request, response, resource);
+                break;
+            case DavMethods.DAV_UNSUBSCRIBE:
+                doUnsubscribe(request, response, resource);
+                break;
+            case DavMethods.DAV_POLL:
+                doPoll(request, response, resource);
+                break;
+            case DavMethods.DAV_SEARCH:
+                doSearch(request, response, resource);
+                break;
+            case DavMethods.DAV_VERSION_CONTROL:
+                doVersionControl(request, response, resource);
+                break;
+            case DavMethods.DAV_LABEL:
+                doLabel(request, response, resource);
+                break;
+            case DavMethods.DAV_REPORT:
+                doReport(request, response, resource);
+                break;
+            case DavMethods.DAV_CHECKIN:
+                doCheckin(request, response, resource);
+                break;
+            case DavMethods.DAV_CHECKOUT:
+                doCheckout(request, response, resource);
+                break;
+            case DavMethods.DAV_UNCHECKOUT:
+                doUncheckout(request, response, resource);
+                break;
+            case DavMethods.DAV_MERGE:
+                doMerge(request, response, resource);
+                break;
+            case DavMethods.DAV_UPDATE:
+                doUpdate(request, response, resource);
+                break;
+            case DavMethods.DAV_MKWORKSPACE:
+                doMkWorkspace(request, response, resource);
+                break;
+            default:
+                // any other method
+                super.service(request, response);
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServerServlet.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/jcr/JCRWebdavServerServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java?view=diff&r1=161659&r2=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/simple/WebdavServlet.java Sun Apr 17 07:51:59 2005
@@ -15,10 +15,10 @@
  */
 package org.apache.jackrabbit.server.simple;
 
-import org.apache.jackrabbit.server.simple.dav.lock.SimpleLockManager;
-import org.apache.jackrabbit.server.simple.dav.ResourceFactoryImpl;
-import org.apache.jackrabbit.server.simple.dav.LocatorFactoryImpl;
-import org.apache.jackrabbit.server.simple.dav.DavSessionProviderImpl;
+import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
+import org.apache.jackrabbit.webdav.simple.ResourceFactoryImpl;
+import org.apache.jackrabbit.webdav.simple.LocatorFactoryImpl;
+import org.apache.jackrabbit.webdav.simple.DavSessionProviderImpl;
 
 import javax.servlet.http.*;
 import javax.servlet.*;
@@ -224,7 +224,7 @@
 
     /**
      * Returns the <code>DavLocatorFactory</code>. If no locator factory has
-     * been set or created a new instance of {@link LocatorFactoryImpl} is
+     * been set or created a new instance of {@link org.apache.jackrabbit.webdav.simple.LocatorFactoryImpl} is
      * returned.
      *
      * @return the locator factory
@@ -293,7 +293,7 @@
 
     /**
      * Returns the <code>DavSessionProvider</code>. If no session provider has
-     * been set or created a new instance of {@link DavSessionProviderImpl} is
+     * been set or created a new instance of {@link org.apache.jackrabbit.webdav.simple.DavSessionProviderImpl} is
      * returned.
      *
      * @return the session provider

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,638 @@
+/*
+ * Copyright 2005 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.webdav.simple;
+
+import javax.jcr.*;
+import javax.jcr.lock.Lock;
+import java.util.*;
+import java.io.*;
+
+import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.util.Text;
+import org.apache.jackrabbit.webdav.jcr.lock.JcrActiveLock;
+import org.apache.jackrabbit.webdav.jcr.JcrDavException;
+import org.apache.jackrabbit.webdav.lock.*;
+import org.apache.jackrabbit.webdav.property.*;
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.server.io.ImportContext;
+import org.apache.jackrabbit.server.io.ImportResourceChain;
+import org.apache.jackrabbit.server.io.ImportCollectionChain;
+import org.apache.log4j.Logger;
+
+/**
+ * DavResourceImpl imeplements a DavResource.
+ */
+public class DavResourceImpl implements DavResource, JcrConstants {
+
+    /** the default logger */
+    private static final Logger log = Logger.getLogger(DavResourceImpl.class);
+
+    private DavResourceFactory factory;
+    private LockManager lockManager;
+    private DavSession session;
+    private Node node;
+    private DavResourceLocator locator;
+
+    private DavPropertySet properties;
+    private boolean isCollection = true;
+
+    /** is created on initProperties */
+    private NodeResource nodeResource;
+
+    /**
+     * Create a new {@link DavResource}.
+     *
+     * @param locator
+     * @param factory
+     * @param session
+     */
+    public DavResourceImpl(DavResourceLocator locator, DavResourceFactory factory,
+                           DavSession session)
+        throws RepositoryException {
+        this.session = session;
+        this.factory = factory;
+        this.locator = locator;
+        if (locator != null && locator.getResourcePath() != null) {
+            try {
+                init(session.getRepositorySession().getItem(locator.getResourcePath()));
+            } catch (PathNotFoundException e) {
+                // ignore: exists field evaluates to false
+            }
+        }
+    }
+
+    /**
+     * Init the webdav resource and retrieve the relevant property.
+     *
+     * @param repositoryItem
+     * @throws RepositoryException
+     */
+    private void init(Item repositoryItem) throws RepositoryException {
+        if (repositoryItem == null || !repositoryItem.isNode()) {
+            return;
+        }
+        node = (Node)repositoryItem;
+
+        // define what is a resource in webdav
+        if (node.isNodeType(NT_RESOURCE) || node.isNodeType(NT_FILE)) {
+            isCollection = false;
+        }
+    }
+
+    /**
+     * @return DavResource#COMPLIANCE_CLASS
+     * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
+     */
+    public String getComplianceClass() {
+        return DavResource.COMPLIANCE_CLASS;
+    }
+
+    /**
+     * @return DavResource#METHODS
+     * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
+     */
+    public String getSupportedMethods() {
+        return DavResource.METHODS;
+    }
+
+    /**
+     * @see DavResource#exists() )
+     */
+    public boolean exists() {
+        return node != null;
+    }
+
+    /**
+     * @see DavResource#isCollection()
+     */
+    public boolean isCollection() {
+        return isCollection;
+    }
+
+    /**
+     * @see org.apache.jackrabbit.webdav.DavResource#getLocator()
+     */
+    public DavResourceLocator getLocator() {
+        return locator;
+    }
+
+    /**
+     * @see DavResource#getResourcePath()
+     */
+    public String getResourcePath() {
+        return locator.getResourcePath();
+    }
+
+    /**
+     * @see DavResource#getHref()
+     */
+    public String getHref() {
+        return locator.getHref(isCollection());
+    }
+
+    /**
+     * @see DavResource#getDisplayName()
+     */
+    public String getDisplayName() {
+        String name = null;
+        if (exists()) {
+            try {
+                name = node.getName();
+            } catch (RepositoryException e) {
+                // ignore
+            }
+        }
+        if (name == null && getResourcePath() != null) {
+            name = Text.getLabel(getResourcePath());
+        }
+        return name;
+    }
+
+    /**
+     * @see org.apache.jackrabbit.webdav.DavResource#getModificationTime()
+     */
+    public long getModificationTime() {
+	initProperties();
+	return nodeResource == null ? 0 : nodeResource.getModificationTime();
+    }
+
+    /**
+     * @see org.apache.jackrabbit.webdav.DavResource#getStream()
+     */
+    public InputStream getStream() {
+	initProperties();
+	return nodeResource == null ? null : nodeResource.getStream();
+    }
+
+    /**
+     * @see DavResource#getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
+     */
+    public DavProperty getProperty(DavPropertyName name) {
+        initProperties();
+        return properties.get(name);
+    }
+
+    /**
+     * @see DavResource#getProperties()
+     */
+    public DavPropertySet getProperties() {
+        initProperties();
+        return properties;
+    }
+
+    /**
+     * @see DavResource#getPropertyNames()
+     */
+    public DavPropertyName[] getPropertyNames() {
+        return getProperties().getPropertyNames();
+    }
+
+    /**
+     * Fill the set of properties
+     */
+    private void initProperties() {
+        if (properties == null && exists()) {
+            properties = new DavPropertySet();
+            try {
+                nodeResource = new NodeResource(this, node);
+                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, nodeResource.getContentLength()+""));
+                properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, nodeResource.getCreationDate()));
+                properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, nodeResource.getLastModified()));
+                String contentType = nodeResource.getContentType();
+                if (contentType != null) {
+                    properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
+                }
+                properties.add(new DefaultDavProperty(DavPropertyName.GETETAG, nodeResource.getETag()));
+            } catch (RepositoryException e) {
+                // should not occure....
+            }
+
+            if (getDisplayName() != null) {
+                properties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName()));
+            }
+            if (isCollection()) {
+                properties.add(new ResourceType(ResourceType.COLLECTION));
+                // Windows XP support
+                properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "1"));
+            } else {
+                properties.add(new ResourceType(ResourceType.DEFAULT_RESOURCE));
+                // Windows XP support
+                properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0"));
+            }
+
+            /* set current lock information. If no lock is set to this resource,
+            an empty lockdiscovery will be returned in the response. */
+            properties.add(new LockDiscovery(getLock(Type.WRITE, Scope.EXCLUSIVE)));
+
+            /* lock support information: all locks are lockable. */
+            SupportedLock supportedLock = new SupportedLock();
+            supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
+            properties.add(supportedLock);
+        }
+    }
+
+    /**
+     * @param property
+     * @throws DavException
+     * @see DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
+     */
+    public void setProperty(DavProperty property) throws DavException {
+        if (isLocked(this)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+        throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
+    }
+
+    /**
+     * @param propertyName
+     * @throws DavException
+     * @see DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
+     */
+    public void removeProperty(DavPropertyName propertyName) throws DavException {
+        if (isLocked(this)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+        throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
+    }
+
+    /**
+     * @see DavResource#getCollection()
+     */
+    public DavResource getCollection() {
+        DavResource parent = null;
+        if (getResourcePath() != null && !getResourcePath().equals("/")) {
+            String parentPath = Text.getRelativeParent(getResourcePath(), 1);
+            if (parentPath.equals("")) {
+                parentPath="/";
+            }
+            DavResourceLocator parentloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), parentPath);
+            try {
+                parent = factory.createResource(parentloc, session);
+            } catch (DavException e) {
+                // should not occur
+            }
+        }
+        return parent;
+    }
+
+    /**
+     * @see DavResource#getMembers()
+     */
+    public DavResourceIterator getMembers() {
+        ArrayList list = new ArrayList();
+        if (exists() && isCollection()) {
+            try {
+                NodeIterator it = node.getNodes();
+                while(it.hasNext()) {
+                    list.add(buildResourceFromItem(it.nextNode()));
+                }
+            } catch (RepositoryException e) {
+                // should not occure
+            } catch (DavException e) {
+                // should not occure
+            }
+        }
+        return new DavResourceIteratorImpl(list);
+    }
+
+    /**
+     * Adds a new non-collection member to this resource.
+     *
+     * @see DavResource#addMember(DavResource, InputStream)
+     */
+    public void addMember(DavResource member, InputStream in) throws DavException {
+        if (!exists() || in == null) {
+            throw new DavException(DavServletResponse.SC_BAD_REQUEST);
+        }
+	if (isLocked(this)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+
+        try {
+            String fileName = member.getDisplayName();
+            ImportContext ctx = new ImportContext(node);
+            ctx.setInputStream(in);
+            ctx.setSystemId(fileName);
+            ImportResourceChain.getChain().execute(ctx);
+            session.getRepositorySession().save();
+        } catch (RepositoryException e) {
+            log.error("Error while executing import chain: " + e.toString());
+            throw new JcrDavException(e);
+        } catch (IOException e) {
+            log.error("Error while executing import chain: " + e.toString());
+            throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+        } catch (Exception e) {
+            log.error("Error while executing import chain: " + e.toString());
+            throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+        }
+    }
+
+    /**
+     * Creates a new collection as member of this resource.
+     *
+     * @see DavResource#addMember(DavResource)
+     */
+    public void addMember(DavResource member) throws DavException {
+        if (!exists()) {
+            throw new DavException(DavServletResponse.SC_CONFLICT);
+        }
+	if (isLocked(this)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+        try {
+            ImportContext ctx = new ImportContext(node);
+            ctx.setSystemId(member.getDisplayName());
+            ImportCollectionChain.getChain().execute(ctx);
+            node.save();
+        } catch (ItemExistsException e) {
+            log.error("Error while executing import chain: " + e.toString());
+            throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
+        } catch (RepositoryException e) {
+            log.error("Error while executing import chain: " + e.toString());
+            throw new JcrDavException(e);
+        } catch (Exception e) {
+            log.error("Error while executing import chain: " + e.toString());
+            throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+        }
+    }
+
+    /**
+     * @see DavResource#removeMember(DavResource)
+     */
+    public void removeMember(DavResource member) throws DavException {
+        if (!exists() || !member.exists()) {
+            throw new DavException(DavServletResponse.SC_NOT_FOUND);
+        }
+        if (isLocked(this) || isLocked(member)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+
+        try {
+            // make sure, non-jcr locks are removed.
+            if (!isJsrLockable()) {
+                ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
+                if (lock != null) {
+                    lockManager.releaseLock(lock.getToken(), member);
+                }
+            }
+	    ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
+	    if (lock != null && lockManager.hasLock(lock.getToken(), member)) {
+		lockManager.releaseLock(lock.getToken(), member);
+	    }
+
+            Session s = session.getRepositorySession();
+            Item memItem = s.getItem(member.getResourcePath());
+            memItem.remove();
+            s.save();
+        } catch (RepositoryException e) {
+            throw new JcrDavException(e);
+        }
+    }
+
+    /**
+     * @see DavResource#move(DavResource)
+     */
+    public void move(DavResource destination) throws DavException {
+        if (!exists()) {
+            throw new DavException(DavServletResponse.SC_NOT_FOUND);
+        }
+        if (isLocked(this)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+        try {
+            session.getRepositorySession().getWorkspace().move(getResourcePath(), destination.getResourcePath());
+        } catch (RepositoryException e) {
+            throw new JcrDavException(e);
+        }
+    }
+
+    /**
+     * @see DavResource#copy(DavResource, boolean)
+     */
+    public void copy(DavResource destination, boolean shallow) throws DavException {
+        if (!exists()) {
+            throw new DavException(DavServletResponse.SC_NOT_FOUND);
+        }
+        if (isLocked(destination)) {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+        // TODO: support shallow and deep copy
+        if (shallow) {
+            throw new DavException(DavServletResponse.SC_FORBIDDEN, "Unable to perform shallow copy.");
+        }
+        try {
+            session.getRepositorySession().getWorkspace().copy(getResourcePath(), destination.getResourcePath());
+        } catch (PathNotFoundException e) {
+            // according to rfc 2518: missing parent
+            throw new DavException(DavServletResponse.SC_CONFLICT, e.getMessage());
+        } catch (RepositoryException e) {
+            throw new JcrDavException(e);
+        }
+    }
+
+    /**
+     * @param type
+     * @param scope
+     * @return true if type is {@link Type#WRITE} and scope is {@link Scope#EXCLUSIVE}
+     * @see DavResource#isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
+     */
+    public boolean isLockable(Type type, Scope scope) {
+        return Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope);
+    }
+
+    /**
+     * @see DavResource#hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
+     */
+    public boolean hasLock(Type type, Scope scope) {
+        return getLock(type, scope) != null;
+    }
+
+    /**
+     * @see DavResource#getLock(Type, Scope)
+     */
+    public ActiveLock getLock(Type type, Scope scope) {
+        ActiveLock lock = null;
+        if (exists() && Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope)) {
+            // try to retrieve the repository lock information first
+	    if (isJsrLockable()) {
+                try {
+                    Lock jcrLock = node.getLock();
+                    if (jcrLock != null && jcrLock.isLive()) {
+                        lock = new JcrActiveLock(jcrLock);
+                    }
+                } catch (RepositoryException e) {
+                    // LockException: no lock applies to this node >> ignore
+                    // RepositoryException, AccessDeniedException or another error >> ignore
+                }
+            }
+
+            // could not retrieve jcr-lock (either not jcr-lockable or the lock has
+            // been created before the node was made jcr-lockable. test if a simple
+            // webdav lock is present.
+            if (lock == null) {
+                lock = lockManager.getLock(type, scope, this);
+            }
+        }
+        return lock;
+    }
+
+    /**
+     * @see org.apache.jackrabbit.webdav.DavResource#getLocks()
+     */
+    public ActiveLock[] getLocks() {
+        return new ActiveLock[] {getLock(Type.WRITE, Scope.EXCLUSIVE)};
+    }
+
+    /**
+     * @see DavResource#lock(LockInfo)
+     */
+    public ActiveLock lock(LockInfo lockInfo) throws DavException {
+	ActiveLock lock = null;
+        if (isLockable(lockInfo.getType(), lockInfo.getScope())) {
+            // todo: deal with existing locks, that may have been created, before the node was jcr-lockable...            
+            if (isJsrLockable()) {
+		try {
+		    // try to execute the lock operation
+		    Lock jcrLock = node.lock(lockInfo.isDeep(), false);
+		    if (jcrLock != null) {
+			lock = new JcrActiveLock(jcrLock);
+		    }
+		} catch (RepositoryException e) {
+		    throw new JcrDavException(e);
+		}
+	    } else {
+		// create a new webdav lock
+		lock = lockManager.createLock(lockInfo, this);
+	    }
+	} else {
+	    throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Unsupported lock type or scope.");
+	}
+	return lock;
+    }
+
+    /**
+     * @see DavResource#refreshLock(LockInfo, String)
+     */
+    public ActiveLock refreshLock(LockInfo lockInfo, String lockToken) throws DavException{
+        if (!exists()) {
+            throw new DavException(DavServletResponse.SC_NOT_FOUND);
+        }
+        ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope());
+        if (lock == null) {
+           throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No lock with the given type/scope present on resource " + getResourcePath());
+        }
+        
+        if (lock instanceof JcrActiveLock) {
+            try {
+                // refresh JCR lock and return the original lock object.
+                node.getLock().refresh();
+            } catch (RepositoryException e) {
+                throw new JcrDavException(e);
+            }
+        } else {
+            lock = lockManager.refreshLock(lockInfo, lockToken, this);
+        }
+        /* since lock has infinite lock (simple) or undefined timeout (jcr)
+           return the lock as retrieved from getLock. */
+        return lock;
+    }
+
+    /**
+     * @see DavResource#unlock(String)
+     */
+    public void unlock(String lockToken) throws DavException {
+        ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
+        if (lock == null) {
+            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
+        } else if (lock.isLockedByToken(lockToken)) {
+            if (lock instanceof JcrActiveLock) {
+                try {
+                    node.unlock();
+                } catch (RepositoryException e) {
+                    throw new JcrDavException(e);
+                }
+            } else {
+                lockManager.releaseLock(lockToken, this);
+            }
+        } else {
+            throw new DavException(DavServletResponse.SC_LOCKED);
+        }
+    }
+
+    /**
+     * @see DavResource#addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
+     */
+    public void addLockManager(LockManager lockMgr) {
+        this.lockManager = lockMgr;
+    }
+
+    /**
+     * @see org.apache.jackrabbit.webdav.DavResource#getFactory()
+     */
+    public DavResourceFactory getFactory() {
+        return factory;
+    }
+
+    /**
+     * Returns true, if this webdav resource allows for locking without checking
+     * its current lock status.
+     *
+     * @return true if this resource is lockable.
+     */
+    private boolean isJsrLockable() {
+        boolean lockable = false;
+        if (exists()) {
+            try {
+                lockable =  node.isNodeType("mix:lockable");
+            } catch (RepositoryException e) {
+                // not jcr-lockable
+            }
+        }
+        return lockable;
+    }
+
+    /**
+     * Return true if this resource cannot be modified due to a write lock
+     * that is not owned by the given session.
+     *
+     * @return true if this resource cannot be modified due to a write lock
+     */
+    private boolean isLocked(DavResource res) {
+        ActiveLock lock = res.getLock(Type.WRITE, Scope.EXCLUSIVE);
+        if (lock == null) {
+            return false;
+        } else {
+            String[] sLockTokens = session.getLockTokens();
+            for (int i = 0; i < sLockTokens.length; i++) {
+                if (sLockTokens[i].equals(lock.getToken())) {
+                   return false;
+                }
+            }
+            return true;
+        }
+    }
+
+    /**
+     * @param item
+     * @return
+     * @throws DavException
+     * @throws RepositoryException
+     */
+    private DavResource buildResourceFromItem(Item item) throws DavException, RepositoryException {
+        DavResourceLocator parentloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), item.getPath());
+        return factory.createResource(parentloc, session);
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2005 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.webdav.simple;
+
+import javax.jcr.Session;
+import java.util.HashSet;
+
+import org.apache.jackrabbit.webdav.DavSession;
+
+/**
+ * Simple implementation of the {@link DavSession} interface. Stores
+ * lock tokens but does not yet store references.
+ */
+public class DavSessionImpl implements DavSession {
+
+    /** the underlaying jcr session */
+    private final Session session;
+
+    /** the lock tokens of this session */
+    private final HashSet lockTokens = new HashSet();
+
+    /**
+     * Creates a new DavSession based on a jcr session
+     * @param session
+     */
+    public DavSessionImpl(Session session) {
+        this.session = session;
+    }
+
+    /**
+     * @see DavSession#addReference(Object)
+     */
+    public void addReference(Object reference) {
+        throw new UnsupportedOperationException("No yet implemented.");
+    }
+
+    /**
+     * @see DavSession#removeReference(Object)
+     */
+    public void removeReference(Object reference) {
+        throw new UnsupportedOperationException("No yet implemented.");
+    }
+
+    /**
+     * @see DavSession#getRepositorySession()
+     */
+    public Session getRepositorySession() {
+        return session;
+    }
+
+    /**
+     * @see DavSession#addLockToken(String)
+     */
+    public void addLockToken(String token) {
+        lockTokens.add(token);
+    }
+
+    /**
+     * @see DavSession#getLockTokens()
+     */
+    public String[] getLockTokens() {
+        return (String[]) lockTokens.toArray(new String[lockTokens.size()]);
+    }
+
+    /**
+     * @see DavSession#removeLockToken(String)
+     */
+    public void removeLockToken(String token) {
+        lockTokens.remove(token);
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2005 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.webdav.simple;
+
+import javax.jcr.*;
+import javax.servlet.ServletException;
+
+import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.jcr.JcrDavException;
+import org.apache.jackrabbit.client.RepositoryAccessServlet;
+
+/**
+ * Simple implementation of the {@link DavSessionProvider}
+ * interface that uses the {@link RepositoryAccessServlet} to locate
+ * credentials in the request, log into the respository, and provide
+ * a {@link DavSession} to the request.
+ */
+public class DavSessionProviderImpl implements DavSessionProvider {
+
+    /**
+     * Acquires a DavSession. Upon success, the WebdavRequest will
+     * reference that session.
+     *
+     * A session will not be available if an exception is thrown.
+     *
+     * @param request
+     * @throws DavException if a problem occurred while obtaining the session
+     * @see DavSessionProvider#acquireSession(org.apache.jackrabbit.webdav.WebdavRequest)
+     */
+    public void acquireSession(WebdavRequest request) throws DavException {
+        try {
+            // extract credentials from the auth header. depending of the
+            // configuration of the RepositoryAccessServlet, this could also
+            // throw a login excetpion.
+            Credentials creds = RepositoryAccessServlet.getCredentialsFromHeader(
+                    request.getHeader(DavConstants.HEADER_AUTHORIZATION));
+
+            // login to repository
+            Session repSession = RepositoryAccessServlet.getRepository().login(creds);
+            DavSession ds = new DavSessionImpl(repSession);
+            request.setDavSession(ds);
+        } catch (LoginException e) {
+	    throw new JcrDavException(e);
+        } catch (RepositoryException e) {
+	    throw new JcrDavException(e);
+	} catch (ServletException e) {
+	    throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+	}
+    }
+
+    /**
+     * Only removes the <code>DavSession</code> object from the given request object.
+     * No further actions required, since <code>DavSessionImpl</code> does not
+     * allow to keep track of references to it.
+     *
+     * @param request
+     * @see DavSessionProvider#releaseSession(org.apache.jackrabbit.webdav.WebdavRequest)
+     */
+    public void releaseSession(WebdavRequest request) {
+        request.setDavSession(null);
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImpl.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImpl.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2005 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.webdav.simple;
+
+import org.apache.jackrabbit.webdav.*;
+import org.apache.log4j.Logger;
+
+/**
+ * ResourceFactoryImpl implements a simple DavLocatorFactory
+ */
+// todo improve special handling of root item....
+public class LocatorFactoryImpl implements DavLocatorFactory {
+
+    /** the default logger */
+    private static final Logger log = Logger.getLogger(LocatorFactoryImpl.class);
+
+    private final String repositoryPrefix;
+
+    public LocatorFactoryImpl(String repositoryPrefix) {
+        this.repositoryPrefix = repositoryPrefix;
+    }
+
+    public DavResourceLocator createResourceLocator(String prefix, String requestHandle) {
+        String rPrefix = prefix + repositoryPrefix;
+        String rHandle = requestHandle;
+	// remove the configured repository prefix from the path
+        if (rHandle != null && rHandle.startsWith(repositoryPrefix)) {
+            rHandle = rHandle.substring(repositoryPrefix.length());
+        }
+	// special treatment for root item, that has no name but '/' path.
+        if (rHandle == null || "".equals(rHandle)) {
+            rHandle = "/";
+        }
+        return new Locator(rPrefix, rHandle, this);
+    }
+
+    public DavResourceLocator createResourceLocator(String prefix, String workspacePath, String resourcePath) {
+        return new Locator(prefix, resourcePath, this);
+    }
+
+    private class Locator implements DavResourceLocator {
+
+        private final String prefix;
+        private final String itemPath;
+        private final DavLocatorFactory factory;
+
+        private Locator(String prefix, String itemPath, DavLocatorFactory factory) {
+            this.prefix = prefix;
+            this.factory = factory;
+	    // remove trailing '/' that is not part of the itemPath except for the root item.
+            if (itemPath.endsWith("/") && !"/".equals(itemPath)) {
+                itemPath = itemPath.substring(0, itemPath.length()-1);
+            }
+            this.itemPath = itemPath;
+        }
+
+        public String getPrefix() {
+            return prefix;
+        }
+
+        public String getResourcePath() {
+            return itemPath;
+        }
+
+        public String getWorkspacePath() {
+            return "";
+        }
+
+        public String getWorkspaceName() {
+            return "";
+        }
+
+        public boolean isSameWorkspace(DavResourceLocator path) {
+            return isSameWorkspace(path.getWorkspaceName());
+        }
+
+        public boolean isSameWorkspace(String workspaceName) {
+            return getWorkspaceName().equals(workspaceName);
+        }
+
+        public String getHref(boolean isCollection) {
+	    // avoid doubled trainling '/' for the root item
+	    String suffix = (isCollection && !isRootLocation()) ? "/" : "";
+            return prefix + itemPath + suffix;
+        }
+
+        public boolean isRootLocation() {
+            return "/".equals(itemPath);
+        }
+
+        public DavLocatorFactory getFactory() {
+            return factory;
+        }
+
+        /**
+         * Computes the hash code using the prefix and the itemPath
+         *
+         * @return the hash code
+         */
+        public int hashCode() {
+            int hashCode = prefix.hashCode();
+            if (itemPath != null) {
+                hashCode += itemPath.hashCode();
+            }
+            return hashCode % Integer.MAX_VALUE;
+        }
+
+        /**
+         * Equality of path is achieved if the specified object is a <code>DavResourceLocator</code>
+         * and the return values of the two <code>getHref(boolean)</code> methods are
+         * equal.
+         *
+         * @param obj the object to compare to
+         * @return <code>true</code> if the 2 objects are equal;
+         *         <code>false</code> otherwise
+         */
+        public boolean equals(Object obj) {
+            if (obj instanceof DavResourceLocator) {
+                DavResourceLocator path = (DavResourceLocator) obj;
+                this.getHref(true).equals(path.getHref(true));
+            }
+            return false;
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImpl.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/NodeResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/NodeResource.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/NodeResource.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/NodeResource.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2005 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.webdav.simple;
+
+import org.apache.log4j.Logger;
+import org.apache.jackrabbit.server.io.ExportContext;
+import org.apache.jackrabbit.server.io.ExportCollectionChain;
+import org.apache.jackrabbit.server.io.ExportResourceChain;
+import org.apache.commons.chain.Command;
+
+import javax.jcr.*;
+import java.util.Date;
+import java.util.Locale;
+import java.io.*;
+import java.text.SimpleDateFormat;
+
+/**
+ * The <code>NodeResource</code> class wraps a jcr item in order to respond
+ * to 'GET', 'HEAD', 'PROPFIND' or 'PROPPATCH' requests. If the item is a
+ * {@link javax.jcr.Node} its primary property is determined. The value of the
+ * primary property can be accessed by {@link #getStream()}. If possible other
+ * required information (last modification date, content type...) is retrieved
+ * from the property siblings.<br>
+ * If the requested item is a {@link javax.jcr.Property} it is treated accordingly.
+ */
+public class NodeResource {
+
+    /**
+     * the default logger
+     */
+    private static final Logger log = Logger.getLogger(NodeResource.class);
+
+    /**
+     * modificationDate date format per RFC 1123
+     */
+    public static SimpleDateFormat modificationDateFormat =
+	new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
+
+    /**
+     * Simple date format for the creation date ISO representation (partial).
+     */
+    public static SimpleDateFormat creationDateFormat =
+	new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+
+    private long creationTime = 0;
+    private long modificationTime = new Date().getTime();
+    private long contentLength = 0;
+    private String contentType = null;
+    private InputStream in = null;
+
+    /**
+     * Create a new <code>NodeResource</code> that wraps a JSR170 item.
+     *
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
+     * @throws IllegalArgumentException if the given item is <code>null</code>
+     */
+    public NodeResource(DavResourceImpl davResource, Node node) throws ItemNotFoundException, RepositoryException {
+        ExportContext ctx = new ExportContext(node);
+        Command exportChain = davResource.isCollection()
+                ? ExportCollectionChain.getChain()
+                : ExportResourceChain.getChain();
+        try {
+            exportChain.execute(ctx);
+        } catch (Exception e) {
+            log.error("Error while executing export chain: " + e.toString());
+            throw new RepositoryException(e);
+        }
+        this.contentLength = ctx.getContentLength();
+        this.contentType = ctx.getContentType();
+        this.in = ctx.getInputStream();
+        this.creationTime = ctx.getCreationTime();
+        this.modificationTime = ctx.getModificationTime();
+    }
+
+    /**
+     * Return the content length or '0'.
+     *
+     * @return content Length or '0' if it could not be determined.
+     */
+    public long getContentLength() {
+	return contentLength;
+    }
+
+    /**
+     * Return the creation time or '0'.
+     *
+     * @return creation time or '0' if it could not be determined.
+     */
+    public long getCreationTime() {
+	return creationTime;
+    }
+
+    /**
+     * Return the last modification time. By default it is set to the current
+     * time.
+     *
+     * @return time of last modification or the current time, if it could not
+     * be determined.
+     */
+    public long getModificationTime() {
+	return modificationTime;
+    }
+
+    /**
+     * Return the last modification time as formatted string.
+     *
+     * @return last modification time as string.
+     * @see NodeResource#modificationDateFormat
+     */
+    public String getLastModified() {
+	if (modificationTime >= 0) {
+	    return modificationDateFormat.format(new Date(modificationTime));
+	} else {
+	    return null;
+	}
+    }
+
+    /**
+     * Return the creation time as formatted string.
+     *
+     * @return creation time as string.
+     * @see NodeResource#creationDateFormat
+     */
+    public String getCreationDate() {
+	if (creationTime >= 0) {
+	    return creationDateFormat.format(new Date(creationTime));
+	} else {
+	    return null;
+	}
+    }
+
+    /**
+     * Return the weak ETag
+     *
+     * @return weak ETag
+     */
+    public String getETag() {
+	return "W/\"" + this.contentLength + "-" + this.modificationTime + "\"";
+    }
+
+    /**
+     * Return the strong ETag or empty string if it cannot be determined.
+     *
+     * @return strong ETag
+     */
+    public String getStrongETag() {
+	return "";
+    }
+
+    /**
+     * Return the content type or <code>null</code> if it could not be determined.
+     *
+     * @return content type
+     */
+    public String getContentType() {
+	return contentType;
+    }
+
+    /**
+     * Return a stream to the resource value.
+     *
+     * @return
+     */
+    public InputStream getStream() {
+	return in;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/NodeResource.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/NodeResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 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.webdav.simple;
+
+import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.jcr.JcrDavException;
+import org.apache.jackrabbit.webdav.lock.LockManager;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * ResourceFactoryImpl implements a simple DavResourceFactory
+ */
+public class ResourceFactoryImpl implements DavResourceFactory {
+
+    private final LockManager lockMgr;
+
+    public ResourceFactoryImpl(LockManager lockMgr) {
+        this.lockMgr = lockMgr;
+    }
+
+    public DavResource createResource(DavResourceLocator locator, DavServletRequest request,
+                                      DavServletResponse response) throws DavException {
+        return createResource(locator, request.getDavSession());
+    }
+
+    public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException {
+        try {
+            DavResource res = new DavResourceImpl(locator, this, session);
+            res.addLockManager(lockMgr);
+            return res;
+        } catch (RepositoryException e) {
+            throw new JcrDavException(e);
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
------------------------------------------------------------------------------
    svn = 

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml?view=diff&r1=161659&r2=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml Sun Apr 17 07:51:59 2005
@@ -57,15 +57,15 @@
         <dependency>
             <groupId>jsr170</groupId>
             <artifactId>jcr</artifactId>
-            <version>0.16.2</version>
-            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.2.jar</url>
+            <version>0.16.4</version>
+            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.jar</url>
             <properties>
                 <war.bundle>true</war.bundle>
             </properties>
         </dependency>
         <dependency>
             <id>jackrabbit</id>
-            <version>0.16.2-dev</version>
+            <version>0.16.4-dev</version>
             <properties>
                 <war.bundle>true</war.bundle>
             </properties>
@@ -90,7 +90,7 @@
         </dependency>
         <dependency>
             <id>jcr-rmi</id>
-            <version>0.16.2</version>
+            <version>0.16.4</version>
             <properties>
                 <war.bundle>false</war.bundle>
             </properties>

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/catalog.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/catalog.xml?view=diff&r1=161659&r2=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/catalog.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/catalog.xml Sun Apr 17 07:51:59 2005
@@ -24,7 +24,7 @@
     <!--
         command-chain for importing a webdav non-collection-resource into the jcr repository
     -->
-    <chain name="import-nc-resource">
+    <chain name="import-resource">
         <!--
             registers the content type of the resource in the import context
             @return false
@@ -109,7 +109,7 @@
     <!--
         command-chain for exporting non-collection-resources
     -->
-    <chain name="export-nc-resource">
+    <chain name="export-resource">
         <!--
             exports the jcr:data property if the node contains a jcr:content
             node of type nt:resource.

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/simple_catalog.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/simple_catalog.xml?view=diff&r1=161659&r2=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/simple_catalog.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/simple_catalog.xml Sun Apr 17 07:51:59 2005
@@ -17,7 +17,7 @@
     <!--
         command-chain for importing a webdav non-collection-resource into the jcr repository
     -->
-    <chain name="import-nc-resource">
+    <chain name="import-resource">
         <command
             id="set-contenttype"
             className="org.apache.jackrabbit.server.io.SetContentTypeCommand"
@@ -42,7 +42,7 @@
     <!--
         command-chain for exporting non-collection-resources
     -->
-    <chain name="export-nc-resource">
+    <chain name="export-resource">
         <command
             id="export-file"
             className="org.apache.jackrabbit.server.io.FileExportCommand"

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/web.xml?view=diff&r1=161659&r2=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/web.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/web.xml Sun Apr 17 07:51:59 2005
@@ -40,6 +40,7 @@
             <description>Repository Name under which the repository is registered via JNDI/RMI</description>
         </init-param>
 
+        <!--
         <init-param>
             <param-name>rmi-port</param-name>
             <param-value>0</param-value>
@@ -49,7 +50,7 @@
                 disable RMI server completely.
             </description>
         </init-param>
-
+        -->
         <!--
             JNDI environment variables for creating the initial context
             (all init parameters starting with java.naming.* will be added to the initial context environment).
@@ -169,7 +170,7 @@
         <description>
             The webdav servlet that connects HTTP request to the repository.
         </description>
-        <servlet-class>org.apache.jackrabbit.server.JCRWebdavServerServlet</servlet-class>
+        <servlet-class>org.apache.jackrabbit.server.jcr.JCRWebdavServerServlet</servlet-class>
 
         <init-param>
             <param-name>resource-path-prefix</param-name>

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml?view=diff&r1=161659&r2=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/project.xml Sun Apr 17 07:51:59 2005
@@ -32,12 +32,12 @@
         <dependency>
             <groupId>jsr170</groupId>
             <artifactId>jcr</artifactId>
-            <version>0.16.2</version>
-            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.2.jar</url>
+            <version>0.16.4</version>
+            <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.jar</url>
         </dependency>
         <dependency>
             <id>jackrabbit</id>
-            <version>0.16.2-dev</version>
+            <version>0.16.4-dev</version>
         </dependency>
         <dependency>
             <id>jdom</id>
@@ -51,51 +51,6 @@
             <id>servletapi</id>
             <version>2.3</version>
         </dependency>
-        <dependency>
-            <id>jcr-rmi</id>
-            <version>0.16.2</version>
-        </dependency>
-        <!-- dependencies of jackrabbit -->
-        <!--
-        <dependency>
-          <id>concurrent</id>
-          <version>1.3.4</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        <dependency>
-          <id>commons-collections</id>
-          <version>2.1</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        <dependency>
-          <groupId>geronimo-spec</groupId>
-          <artifactId>geronimo-spec-jta</artifactId>
-          <version>1.0-M1</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        <dependency>
-          <groupId>lucene</groupId>
-          <artifactId>lucene</artifactId>
-          <version>1.4.3</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        <dependency>
-          <groupId>xerces</groupId>
-          <artifactId>xercesImpl</artifactId>
-          <version>2.6.2</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        -->
     </dependencies>
 
     <!-- ====================================================================== -->

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java?view=auto&rev=161660
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/JcrConstants.java Sun Apr 17 07:51:59 2005
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.jackrabbit;
+
+/**
+ * This Interface defines some jcr constants
+ */
+public interface JcrConstants {
+    /**
+     * jcr:autoCreated
+     */
+    public static final String JCR_AUTOCREATED = "jcr:autoCreated";
+    /**
+     * jcr:baseVersion
+     */
+    public static final String JCR_BASEVERSION = "jcr:baseVersion";
+    /**
+     * jcr:child
+     */
+    public static final String JCR_CHILD = "jcr:child";
+    /**
+     * jcr:childNodeDefinition
+     */
+    public static final String JCR_CHILDNODEDEFINITION = "jcr:childNodeDefinition";
+    /**
+     * jcr:content
+     */
+    public static final String JCR_CONTENT = "jcr:content";
+    /**
+     * jcr:created
+     */
+    public static final String JCR_CREATED = "jcr:created";
+    /**
+     * jcr:data
+     */
+    public static final String JCR_DATA = "jcr:data";
+    /**
+     * jcr:defaultPrimaryType
+     */
+    public static final String JCR_DEFAULTPRIMARYTYPE = "jcr:defaultPrimaryType";
+    /**
+     * jcr:defaultValues
+     */
+    public static final String JCR_DEFAULTVALUES = "jcr:defaultValues";
+    /**
+     * jcr:encoding
+     */
+    public static final String JCR_ENCODING = "jcr:encoding";
+    /**
+     * jcr:frozenMixinTypes
+     */
+    public static final String JCR_FROZENMIXINTYPES = "jcr:frozenMixinTypes";
+    /**
+     * jcr:frozenNode
+     */
+    public static final String JCR_FROZENNODE = "jcr:frozenNode";
+    /**
+     * jcr:frozenPrimaryType
+     */
+    public static final String JCR_FROZENPRIMARYTYPE = "jcr:frozenPrimaryType";
+    /**
+     * jcr:frozenUuid
+     */
+    public static final String JCR_FROZENUUID = "jcr:frozenUuid";
+    /**
+     * jcr:hasOrderableChildNodes
+     */
+    public static final String JCR_HASORDERABLECHILDNODES = "jcr:hasOrderableChildNodes";
+    /**
+     * jcr:isCheckedOut
+     */
+    public static final String JCR_ISCHECKEDOUT = "jcr:isCheckedOut";
+    /**
+     * jcr:isMixin
+     */
+    public static final String JCR_ISMIXIN = "jcr:isMixin";
+    /**
+     * jcr:language
+     */
+    public static final String JCR_LANGUAGE = "jcr:language";
+    /**
+     * jcr:lastModified
+     */
+    public static final String JCR_LASTMODIFIED = "jcr:lastModified";
+    /**
+     * jcr:lockIsDeep
+     */
+    public static final String JCR_LOCKISDEEP = "jcr:lockIsDeep";
+    /**
+     * jcr:lockOwner
+     */
+    public static final String JCR_LOCKOWNER = "jcr:lockOwner";
+    /**
+     * jcr:mandatory
+     */
+    public static final String JCR_MANDATORY = "jcr:mandatory";
+    /**
+     * jcr:mergeFailed
+     */
+    public static final String JCR_MERGEFAILED = "jcr:mergeFailed";
+    /**
+     * jcr:mimeType
+     */
+    public static final String JCR_MIMETYPE = "jcr:mimeType";
+    /**
+     * jcr:mixinTypes
+     */
+    public static final String JCR_MIXINTYPES = "jcr:mixinTypes";
+    /**
+     * jcr:multiple
+     */
+    public static final String JCR_MULTIPLE = "jcr:multiple";
+    /**
+     * jcr:name
+     */
+    public static final String JCR_NAME = "jcr:name";
+    /**
+     * jcr:nodeTypeName
+     */
+    public static final String JCR_NODETYPENAME = "jcr:nodeTypeName";
+    /**
+     * jcr:onParentVersion
+     */
+    public static final String JCR_ONPARENTVERSION = "jcr:onParentVersion";
+    /**
+     * jcr:predecessors
+     */
+    public static final String JCR_PREDECESSORS = "jcr:predecessors";
+    /**
+     * jcr:primaryItemName
+     */
+    public static final String JCR_PRIMARYITEMNAME = "jcr:primaryItemName";
+    /**
+     * jcr:primaryType
+     */
+    public static final String JCR_PRIMARYTYPE = "jcr:primaryType";
+    /**
+     * jcr:propertyDefinition
+     */
+    public static final String JCR_PROPERTYDEFINITION = "jcr:propertyDefinition";
+    /**
+     * jcr:protected
+     */
+    public static final String JCR_PROTECTED = "jcr:protected";
+    /**
+     * jcr:requiredPrimaryTypes
+     */
+    public static final String JCR_REQUIREDPRIMARYTYPES = "jcr:requiredPrimaryTypes";
+    /**
+     * jcr:requiredType
+     */
+    public static final String JCR_REQUIREDTYPE = "jcr:requiredType";
+    /**
+     * jcr:rootVersion
+     */
+    public static final String JCR_ROOTVERSION = "jcr:rootVersion";
+    /**
+     * jcr:sameNameSiblings
+     */
+    public static final String JCR_SAMENAMESIBLINGS = "jcr:sameNameSiblings";
+    /**
+     * jcr:statement
+     */
+    public static final String JCR_STATEMENT = "jcr:statement";
+    /**
+     * jcr:successors
+     */
+    public static final String JCR_SUCCESSORS = "jcr:successors";
+    /**
+     * jcr:supertypes
+     */
+    public static final String JCR_SUPERTYPES = "jcr:supertypes";
+    /**
+     * jcr:system
+     */
+    public static final String JCR_SYSTEM = "jcr:system";
+    /**
+     * jcr:uuid
+     */
+    public static final String JCR_UUID = "jcr:uuid";
+    /**
+     * jcr:valueConstraints
+     */
+    public static final String JCR_VALUECONSTRAINTS = "jcr:valueConstraints";
+    /**
+     * jcr:versionHistory
+     */
+    public static final String JCR_VERSIONHISTORY = "jcr:versionHistory";
+    /**
+     * jcr:versionLabels
+     */
+    public static final String JCR_VERSIONLABELS = "jcr:versionLabels";
+    /**
+     * jcr:versionStorage
+     */
+    public static final String JCR_VERSIONSTORAGE = "jcr:versionStorage";
+    /**
+     * jcr:versionableUuid
+     */
+    public static final String JCR_VERSIONABLEUUID = "jcr:versionableUuid";
+    /**
+     * mix:lockable
+     */
+    public static final String MIX_LOCKABLE = "mix:lockable";
+    /**
+     * mix:referenceable
+     */
+    public static final String MIX_REFERENCEABLE = "mix:referenceable";
+    /**
+     * mix:versionable
+     */
+    public static final String MIX_VERSIONABLE = "mix:versionable";
+    /**
+     * nt:base
+     */
+    public static final String NT_BASE = "nt:base";
+    /**
+     * nt:childNodeDefinition
+     */
+    public static final String NT_CHILDNODEDEFINITION = "nt:childNodeDefinition";
+    /**
+     * nt:file
+     */
+    public static final String NT_FILE = "nt:file";
+    /**
+     * nt:folder
+     */
+    public static final String NT_FOLDER = "nt:folder";
+    /**
+     * nt:frozenNode
+     */
+    public static final String NT_FROZENNODE = "nt:frozenNode";
+    /**
+     * nt:hierarchyNode
+     */
+    public static final String NT_HIERARCHYNODE = "nt:hierarchyNode";
+    /**
+     * nt:linkedFile
+     */
+    public static final String NT_LINKEDFILE = "nt:linkedFile";
+    /**
+     * nt:nodeType
+     */
+    public static final String NT_NODETYPE = "nt:nodeType";
+    /**
+     * nt:propertyDefinition
+     */
+    public static final String NT_PROPERTYDEFINITION = "nt:propertyDefinition";
+    /**
+     * nt:query
+     */
+    public static final String NT_QUERY = "nt:query";
+    /**
+     * nt:resource
+     */
+    public static final String NT_RESOURCE = "nt:resource";
+    /**
+     * nt:unstructured
+     */
+    public static final String NT_UNSTRUCTURED = "nt:unstructured";
+    /**
+     * nt:version
+     */
+    public static final String NT_VERSION = "nt:version";
+    /**
+     * nt:versionHistory
+     */
+    public static final String NT_VERSIONHISTORY = "nt:versionHistory";
+    /**
+     * nt:versionLabels
+     */
+    public static final String NT_VERSIONLABELS = "nt:versionLabels";
+    /**
+     * nt:versionedChild
+     */
+    public static final String NT_VERSIONEDCHILD = "nt:versionedChild";
+    /**
+     * rep:frozen
+     */
+    public static final String REP_FROZEN = "rep:frozen";
+    /**
+     * rep:frozenVersionHistory
+     */
+    public static final String REP_FROZENVERSIONHISTORY = "rep:frozenVersionHistory";
+    /**
+     * rep:nodeTypes
+     */
+    public static final String REP_NODETYPES = "rep:nodeTypes";
+    /**
+     * rep:root
+     */
+    public static final String REP_ROOT = "rep:root";
+    /**
+     * rep:system
+     */
+    public static final String REP_SYSTEM = "rep:system";
+    /**
+     * rep:version
+     */
+    public static final String REP_VERSION = "rep:version";
+    /**
+     * rep:versionHistory
+     */
+    public static final String REP_VERSIONHISTORY = "rep:versionHistory";
+    /**
+     * rep:versionLabels
+     */
+    public static final String REP_VERSIONLABELS = "rep:versionLabels";
+    /**
+     * rep:versionStorage
+     */
+    public static final String REP_VERSIONSTORAGE = "rep:versionStorage";
+}



Mime
View raw message