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 2005/11/07 16:28:23 UTC

svn commit: r331281 [3/3] - in /incubator/jackrabbit/trunk/contrib/jcr-server: ./ client/ server/ server/src/java/org/apache/jackrabbit/server/ server/src/java/org/apache/jackrabbit/server/io/ server/src/java/org/apache/jackrabbit/server/jcr/ server/sr...

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java Mon Nov  7 07:26:33 2005
@@ -88,7 +88,7 @@
     /**
      * Return the lock token if the {@link javax.jcr.Session} that optained the lock
      * is the lock token holder, <code>null</code> otherwise.<br>
-     * NOTE: currently the token generated by the underlaying JCR repository
+     * NOTE: currently the token generated by the underlying JCR repository
      * is not checked for compliance with RFC 2518 ("<cite>OpaqueLockToken-URI = "opaquelocktoken:"
      * UUID [Extension] ; The UUID production is the string representation of a
      * UUID, as defined in [ISO-11578]. Note that white space (LWS) is not allowed

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/search/SearchResourceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/search/SearchResourceImpl.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/search/SearchResourceImpl.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/search/SearchResourceImpl.java Mon Nov  7 07:26:33 2005
@@ -94,7 +94,7 @@
      * @throws RepositoryException the query manager cannot be accessed or if
      * another error occurs.
      * @throws DavException if <code>sInfo</code> is <code>null</code> and
-     * the underlaying repository item is not an nt:query node or if an error
+     * the underlying repository item is not an nt:query node or if an error
      * occurs when calling {@link Query#storeAsNode(String)}/
      */
     private Query getQuery(SearchInfo sInfo)

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/transaction/TxLockManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/transaction/TxLockManagerImpl.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/transaction/TxLockManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/transaction/TxLockManagerImpl.java Mon Nov  7 07:26:33 2005
@@ -423,7 +423,7 @@
 
         /**
          * @return true if this transaction is used to allow for transient changes
-         *         on the underlaying repository, that may be persisted with the final
+         *         on the underlying repository, that may be persisted with the final
          *         UNLOCK request only.
          */
         boolean isLocal();

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionHistoryItemCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionHistoryItemCollection.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionHistoryItemCollection.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionHistoryItemCollection.java Mon Nov  7 07:26:33 2005
@@ -90,10 +90,10 @@
     //-----------------------------------< VersionHistoryResource interface >---
     /**
      * Return an array of {@link VersionResource}s representing all versions
-     * present in the underlaying JCR version history.
+     * present in the underlying JCR version history.
      *
      * @return array of {@link VersionResource}s representing all versions
-     * present in the underlaying JCR version history.
+     * present in the underlying JCR version history.
      * @throws DavException
      * @see org.apache.jackrabbit.webdav.version.VersionHistoryResource#getVersions()
      */

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionItemCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionItemCollection.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionItemCollection.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/version/VersionItemCollection.java Mon Nov  7 07:26:33 2005
@@ -68,7 +68,7 @@
 
     //------------------------------------------< VersionResource interface >---
     /**
-     * Modify the labels defined for the underlaying repository version.
+     * Modify the labels defined for the underlying repository version.
      *
      * @param labelInfo
      * @throws DavException

Modified: 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?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java Mon Nov  7 07:26:33 2005
@@ -22,7 +22,7 @@
 import java.io.*;
 
 import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.io.InputContext;
+import org.apache.jackrabbit.server.io.IOUtil;
 import org.apache.jackrabbit.webdav.transaction.TransactionConstants;
 import org.apache.jackrabbit.webdav.observation.ObservationConstants;
 import org.apache.jackrabbit.webdav.jcr.lock.JcrActiveLock;
@@ -30,16 +30,21 @@
 import org.apache.jackrabbit.webdav.lock.*;
 import org.apache.jackrabbit.webdav.property.*;
 import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.server.io.IOManager;
+import org.apache.jackrabbit.server.io.ExportContext;
+import org.apache.jackrabbit.webdav.io.InputContext;
+import org.apache.jackrabbit.webdav.io.OutputContext;
 import org.apache.jackrabbit.server.io.ImportContext;
-import org.apache.jackrabbit.server.io.ImportResourceChain;
-import org.apache.jackrabbit.server.io.ImportCollectionChain;
+import org.apache.jackrabbit.server.io.ExportContextImpl;
+import org.apache.jackrabbit.server.io.ImportContextImpl;
+import org.apache.jackrabbit.server.io.AbstractExportContext;
 import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.log4j.Logger;
 import org.jdom.Namespace;
 
 /**
- * DavResourceImpl imeplements a DavResource.
+ * DavResourceImpl implements a DavResource.
  */
 public class DavResourceImpl implements DavResource, JcrConstants {
 
@@ -63,14 +68,12 @@
     private DavResourceLocator locator;
 
     private DavPropertySet properties = new DavPropertySet();
+    private boolean inited = false;
     private boolean isCollection = true;
-
-    /**
-     * is created on initProperties
-     */
-    private NodeResource nodeResource;
+    private long modificationTime = IOUtil.UNDEFINED_TIME;
 
     private ResourceFilter filter;
+    private IOManager ioManager;
 
     /**
      * Create a new {@link DavResource}.
@@ -80,23 +83,19 @@
      * @param session
      */
     public DavResourceImpl(DavResourceLocator locator, DavResourceFactory factory,
-                           DavSession session, ResourceConfig config)
-            throws RepositoryException, DavException {
+                           DavSession session, ResourceConfig config) throws RepositoryException {
         this.session = session;
         this.factory = factory;
         this.locator = locator;
         this.filter = config.getResourceFilter();
+        this.ioManager = config.getIOManager();
 
         if (locator != null && locator.getResourcePath() != null) {
             try {
                 Item item = session.getRepositorySession().getItem(locator.getJcrPath());
                 if (item != null && item.isNode()) {
                     node = (Node) item;
-                    if (isFilteredNode(node)) {
-                        log.debug("Cannot to access resource based on a filtered repository item: " + locator.getResourcePath());
-                        throw new DavException(DavServletResponse.SC_FORBIDDEN);
-                    }
-                    // define what is a resource in webdav
+                    // define what is a collection in webdav
                     isCollection = config.isCollectionResource(node);
                 }
             } catch (PathNotFoundException e) {
@@ -168,7 +167,7 @@
 
     /**
      * Returns the the last segment of the resource path.<p>
-     * Note that this must not correspond to the name of the underlaying
+     * Note that this must not correspond to the name of the underlying
      * repository item for two reasons:<ul>
      * <li>SameNameSiblings have an index appended to their item name.</li>
      * <li>the resource path may differ from the item path.</li>
@@ -188,15 +187,27 @@
      */
     public long getModificationTime() {
         initProperties();
-        return nodeResource == null ? 0 : nodeResource.getModificationTime();
+        return modificationTime;
     }
 
     /**
-     * @see org.apache.jackrabbit.webdav.DavResource#getStream()
+     * If this resource exists and the specified context is not <code>null</code>
+     * this implementation build a new {@link ExportContext} based on the specified
+     * context and forwards the export to its <code>IOManager</code>. If the
+     * {@link IOManager#exportContent(ExportContext, DavResource)} fails,
+     * an <code>IOException</code> is thrown.
+     *
+     * @see DavResource#spool(OutputContext)
+     * @see ResourceConfig#getIOManager()
+     * @throws IOException if the export fails.
      */
-    public InputStream getStream() {
-        initProperties();
-        return nodeResource == null ? null : nodeResource.getStream();
+    public void spool(OutputContext outputContext) throws IOException {
+        if (exists() && outputContext != null) {
+            ExportContext exportCtx = getExportContext(outputContext);
+            if (!ioManager.exportContent(exportCtx, this)) {
+                throw new IOException("Unexpected Error while spooling resource.");
+            }
+        }
     }
 
     /**
@@ -226,19 +237,13 @@
      * Fill the set of properties
      */
     private void initProperties() {
-        if (!exists() || nodeResource != null) {
+        if (!exists() || inited) {
             return;
         }
 
         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()));
-            setContentType(nodeResource.getContentType());
-            setContentLanguage(nodeResource.getContentLanguage());
-            properties.add(new DefaultDavProperty(DavPropertyName.GETETAG, nodeResource.getETag()));
-        } catch (RepositoryException e) {
+            ioManager.exportContent(new PropertyExportCtx(), this);
+        } catch (IOException e) {
             // should not occure....
         }
 
@@ -264,7 +269,7 @@
         supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
         properties.add(supportedLock);
 
-        // non-protected JCR properties defined on the underlaying jcr node
+        // non-protected JCR properties defined on the underlying jcr node
         try {
             // todo: should filter be respected for properties as well?
             PropertyIterator it = node.getProperties();
@@ -283,6 +288,8 @@
         } catch (RepositoryException e) {
             log.error("Unexpected error while retrieving properties: " + e.getMessage());
         }
+
+        inited = true;
     }
 
     /**
@@ -417,28 +424,6 @@
     }
 
     /**
-     * Set the content type.
-     *
-     * @param contentType
-     */
-    private void setContentType(String contentType) {
-        if (contentType != null) {
-            properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
-        }
-    }
-
-    /**
-     * Set the content language.
-     *
-     * @param contentLanguage
-     */
-    private void setContentLanguage(String contentLanguage) {
-        if (contentLanguage != null) {
-            properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLANGUAGE, contentLanguage));
-        }
-    }
-
-    /**
      * @see DavResource#getCollection()
      */
     public DavResource getCollection() {
@@ -488,9 +473,9 @@
     /**
      * Adds a new member to this resource.
      *
-     * @see DavResource#addMember(DavResource, InputContext)
+     * @see DavResource#addMember(DavResource, org.apache.jackrabbit.webdav.io.InputContext)
      */
-    public void addMember(DavResource member, InputContext inputCxt) throws DavException {
+    public void addMember(DavResource member, InputContext inputContext) throws DavException {
         if (!exists()) {
             throw new DavException(DavServletResponse.SC_CONFLICT);
         }
@@ -503,56 +488,25 @@
             throw new DavException(DavServletResponse.SC_FORBIDDEN);
         }
         try {
-            ImportContext ctx = new ImportContext(node);
-            String sysId = Text.getName(member.getLocator().getJcrPath());
-            ctx.setSystemId(sysId);
-            boolean hasContent = inputCxt != null && inputCxt.getInputStream() != null;
-            if (hasContent) {
-                ctx.setInputStream(inputCxt.getInputStream());
-                ctx.setContentType(inputCxt.getContentType());
-                ctx.setContentLanguage(inputCxt.getContentLanguage());
-            }
-            if (member.isCollection()) {
-                ImportCollectionChain.getChain().execute(ctx);
-            } else {
-                ImportResourceChain.getChain().execute(ctx);
-            }
-            // if an input stream was present and was not consumed during the
-            // import the request must fail.
-            if (hasContent && ctx.getInputStream() != null) {
+            ImportContext ctx = getImportContext(inputContext, Text.getName(member.getLocator().getJcrPath()));
+            if (!ioManager.importContent(ctx, member)) {
                 // undo all changes
                 node.refresh(false);
                 throw new DavException(DavServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
             }
+
             // persist changes after successful import
             node.save();
-        } catch (ItemExistsException e) {
-            // should only be thrown by the ImportCollectionChain
-            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());
+            log.error("Error while importing resource: " + e.toString());
             throw new JcrDavException(e);
-        } catch (DavException e) {
-            // TODO: hack needed in order not to fall into the general Exception
-            throw e;
-        } catch (Exception e) {
-            // TODO: remove this! why do the commands throw an unspecific exception?
-            log.error("Error while executing import chain: " + e.toString());
+        } catch (IOException e) {
+            log.error("Error while importing resource: " + e.toString());
             throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
         }
     }
 
     /**
-     * Creates a new member of this resource.
-     *
-     * @see DavResource#addMember(DavResource)
-     */
-    public void addMember(DavResource member) throws DavException {
-        addMember(member, null);
-    }
-
-    /**
      * @see DavResource#removeMember(DavResource)
      */
     public void removeMember(DavResource member) throws DavException {
@@ -792,7 +746,30 @@
     }
 
     /**
-     * Returns true, if the underlaying node is nodetype jcr:lockable,
+     * Returns a new <code>ImportContext</code>
+     *
+     * @param inputCtx
+     * @param systemId
+     * @return
+     * @throws IOException
+     */
+    protected ImportContext getImportContext(InputContext inputCtx, String systemId) throws IOException {
+        return new ImportContextImpl(node, systemId, inputCtx);
+    }
+
+    /**
+     * Returns a new <code>ExportContext</code>
+     *
+     * @param outputCtx
+     * @return
+     * @throws IOException
+     */
+    protected ExportContext getExportContext(OutputContext outputCtx) throws IOException {
+        return new ExportContextImpl(node, outputCtx);
+    }
+
+    /**
+     * Returns true, if the underlying node is nodetype jcr:lockable,
      * without checking its current lock status. If the node is not jcr-lockable
      * an attempt is made to add the mix:lockable mixin type.
      *
@@ -931,5 +908,71 @@
 
     private boolean isFilteredNode(Node n) {
         return filter != null && filter.isFilteredItem(n);
+    }
+
+    //--------------------------------------------------------< inner class >---
+    /**
+     * ExportContext that writes the properties of this <code>DavResource</code>
+     * and provides not stream.
+     */
+    private class PropertyExportCtx extends AbstractExportContext {
+
+        private PropertyExportCtx() {
+            super(node, false, null);
+            // set defaults:
+            setCreationTime(IOUtil.UNDEFINED_TIME);
+            setModificationTime(IOUtil.UNDEFINED_TIME);
+        }
+
+        public OutputStream getOutputStream() {
+            return null;
+        }
+
+        public void setContentLanguage(String contentLanguage) {
+            if (contentLanguage != null) {
+                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLANGUAGE, contentLanguage));
+            }
+        }
+
+        public void setContentLength(long contentLength) {
+            if (contentLength > IOUtil.UNDEFINED_LENGTH) {
+                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, contentLength + ""));
+            }
+        }
+
+        public void setContentType(String mimeType, String encoding) {
+            String contentType = IOUtil.buildContentType(mimeType, encoding);
+            if (contentType != null) {
+                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
+            }
+        }
+
+        public void setCreationTime(long creationTime) {
+            String created = IOUtil.getCreated(creationTime);
+            properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, created));
+        }
+
+        public void setModificationTime(long modTime) {
+            if (modificationTime <= IOUtil.UNDEFINED_TIME) {
+                modificationTime = new Date().getTime();
+            } else {
+                modificationTime = modTime;
+            }
+            String lastModified = IOUtil.getLastModified(modificationTime);
+            properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, lastModified));
+        }
+
+        public void setETag(String etag) {
+            if (etag != null) {
+                properties.add(new DefaultDavProperty(DavPropertyName.GETETAG, etag));
+            }
+        }
+
+        public void setProperty(Object propertyName, Object propertyValue) {
+            if (propertyName instanceof DavPropertyName) {
+                DavPropertyName pName = (DavPropertyName)propertyName;
+                properties.add(new DefaultDavProperty(pName, propertyValue));
+            }
+        }
     }
 }

Modified: 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?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionImpl.java Mon Nov  7 07:26:33 2005
@@ -27,7 +27,7 @@
  */
 public class DavSessionImpl implements DavSession {
 
-    /** the underlaying jcr session */
+    /** the underlying jcr session */
     private final Session session;
 
     /** the lock tokens of this session */

Modified: 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?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavSessionProviderImpl.java Mon Nov  7 07:26:33 2005
@@ -87,10 +87,10 @@
 
     /**
      * Only removes the <code>DavSession</code> object from the given request object.
-     * and remove all the lock tokens from the underlaying repository session
+     * and remove all the lock tokens from the underlying repository session
      * in order make sure they can be reset when attaching a session to the
-     * next request. Finally the session is logged-out. The latter is a workaround
-     * only, since the SessionProvider may not clean up unused sessions properly.
+     * next request. Finally the session provider is informed, that the
+     * session is no longer used.
      *
      * @param request
      * @see DavSessionProvider#releaseSession(org.apache.jackrabbit.webdav.WebdavRequest)
@@ -103,8 +103,7 @@
             for (int i = 0; i < lockTokens.length; i++) {
                 repSession.removeLockToken(lockTokens[i]);
             }
-            // TODO: not quite correct. the SessionProvider should take care of removing session.
-            repSession.logout();
+            sesProvider.releaseSession(repSession);
             log.debug("Releasing session '"+ ds + "' from request '" + request + "'");
         } else {
             // session is null. nothing to be done.

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java Mon Nov  7 07:26:33 2005
@@ -16,8 +16,11 @@
 package org.apache.jackrabbit.webdav.simple;
 
 import org.apache.log4j.Logger;
+import org.apache.jackrabbit.server.io.IOManager;
+import org.apache.jackrabbit.server.io.DefaultIOManager;
 import org.jdom.Document;
 import org.jdom.Element;
+import org.jdom.JDOMException;
 import org.jdom.input.SAXBuilder;
 
 import javax.jcr.Item;
@@ -26,6 +29,7 @@
 import java.net.URL;
 import java.util.List;
 import java.util.Iterator;
+import java.io.IOException;
 
 /**
  * <code>ResourceConfig</code>...
@@ -35,6 +39,7 @@
     private static Logger log = Logger.getLogger(ResourceConfig.class);
 
     private ResourceFilter resourceFilter;
+    private IOManager ioManager;
     private String[] nodetypeNames = new String[0];
     private boolean collectionNames = false;
 
@@ -42,7 +47,8 @@
      * Tries to parse the given xml configuration file.
      * The xml must match the following structure:<br>
      * <pre>
-     * &lt;!ELEMENT config ((collection | noncollection)?, filter?) &gt;
+     * &lt;!ELEMENT config (iomanager, (collection | noncollection)?, filter?) &gt;
+     * &lt;!ELEMENT iomanager (class) &gt;
      * &lt;!ELEMENT collection (nodetypes) &gt;
      * &lt;!ELEMENT noncollection (nodetypes) &gt;
      * &lt;!ELEMENT filter (class, namespaces?, nodetypes?) &gt;
@@ -64,6 +70,16 @@
             Document doc = new SAXBuilder().build(configURL);
             Element root = doc.getRootElement();
 
+            Element ioElem = root.getChild("iomanager");
+            if (ioElem != null) {
+                Object inst = buildClassFromConfig(ioElem.getChild("class"));
+                if (inst != null && inst instanceof IOManager) {
+                   ioManager = (IOManager)inst;
+                }
+            } else {
+                log.error("Resource configuration: mandatory 'iomanager' element is missing.");
+            }
+
             Element collection = root.getChild("collection");
             Element noncollection = root.getChild("noncollection");
             if (collection != null && noncollection != null) {
@@ -82,7 +98,10 @@
 
             Element filter = root.getChild("filter");
             if (filter != null) {
-                resourceFilter = buildResourceFilter(filter.getChild("class"));
+                Object inst = buildClassFromConfig(filter.getChild("class"));
+                if (inst != null && inst instanceof ResourceFilter) {
+                    resourceFilter = (ResourceFilter)inst;
+                }
                 if (resourceFilter != null) {
                     Element nts = filter.getChild("nodetypes");
                     resourceFilter.setFilteredNodetypes(parseNodeTypesEntry(nts));
@@ -91,36 +110,30 @@
             } else {
                 log.debug("Resource configuration: no 'filter' element specified.");
             }
-        } catch (Exception e) {
-            log.warn("Error while reading resource configuration: " + e.getMessage());
+        } catch (IOException e) {
+            log.error("Invalid resource configuration: " + e.getMessage());
+        } catch (JDOMException e) {
+            log.error("Invalid resource configuration: " + e.getMessage());
         }
     }
 
-    private ResourceFilter buildResourceFilter(Element classElement) {
+    private Object buildClassFromConfig(Element classElement) {
+        Object instance = null;
         if (classElement == null) {
-            return null;
+            return instance;
         }
         try {
             String className = classElement.getAttributeValue("name");
             if (className != null) {
-                Class cl = Class.forName(className);
-                Class[] interfaces = cl.getInterfaces();
-                boolean isfilterClass = false;
-                for (int i = 0; i < interfaces.length && !isfilterClass; i++) {
-                    isfilterClass = (interfaces[i].equals(ResourceFilter.class));
-                }
-                if (isfilterClass) {
-                    return (ResourceFilter) cl.newInstance();
+                Class c = Class.forName(className);
+                instance = c.newInstance();
                 } else {
-                    log.warn("Class '" + className + "' specified does not represent a resource filter > using default.");
-                }
-            } else {
-                log.warn("Invalid filter configuration: missing 'class' element");
+                log.error("Invalid configuration: missing 'class' element");
             }
         } catch (Exception e) {
-            log.warn("Error while reading filter configuration. Using empty filter instead.");
+            log.error("Error while create class instance: " + e.getMessage());
         }
-        return null;
+        return instance;
     }
 
     private void parseNamespacesEntry(Element child, ResourceFilter filter) {
@@ -159,6 +172,15 @@
             ntNames[i++] = ((Element) it.next()).getText();
         }
         return ntNames;
+    }
+
+
+    public IOManager getIOManager() {
+        if (ioManager == null) {
+            log.debug("ResourceConfig: missing io-manager > building DefaultIOManager ");
+            ioManager = new DefaultIOManager();
+        }
+        return ioManager;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/todo.txt
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/todo.txt?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/todo.txt (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/todo.txt Mon Nov  7 07:26:33 2005
@@ -40,8 +40,6 @@
 
 - undo incomplete changes in case of exception
 - review GET/PUT for JCR properties
-- etag property on resources
-- use strong etag for comparison in ifHeader!
 - multistatus fuer lock, copy, move, delete, proppatch wherever required.
 - DAV:supported-live-property-set
 - timeout: remove expired locks/subscriptions

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?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/project.xml Mon Nov  7 07:26:33 2005
@@ -111,30 +111,6 @@
             <artifactId>junit</artifactId>
             <version>3.8.1</version>
         </dependency>
-        <dependency>
-            <groupId>commons-chain</groupId>
-            <artifactId>commons-chain</artifactId>
-            <version>1.0</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        <dependency>
-            <groupId>commons-digester</groupId>
-            <artifactId>commons-digester</artifactId>
-            <version>1.6</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils</artifactId>
-            <version>1.7.0</version>
-            <properties>
-                <war.bundle>true</war.bundle>
-            </properties>
-        </dependency>
 
         <!-- dependencies of jackrabbit -->
         <dependency>

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/JCRWebdavServerServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/JCRWebdavServerServlet.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/JCRWebdavServerServlet.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/JCRWebdavServerServlet.java Mon Nov  7 07:26:33 2005
@@ -22,16 +22,13 @@
 import org.apache.jackrabbit.webdav.jcr.observation.SubscriptionManagerImpl;
 import org.apache.jackrabbit.webdav.jcr.transaction.TxLockManagerImpl;
 import org.apache.jackrabbit.server.jcr.JCRWebdavServer;
-import org.apache.jackrabbit.server.CredentialsProvider;
 import org.apache.jackrabbit.server.SessionProviderImpl;
 import org.apache.jackrabbit.server.AbstractWebdavServlet;
+import org.apache.jackrabbit.server.BasicCredentialsProvider;
 
 import javax.servlet.ServletException;
 import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
 import javax.jcr.Repository;
-import javax.jcr.Credentials;
-import javax.jcr.LoginException;
 
 /**
  * JCRWebdavServerServlet provides request/response handling for the JCRWebdavServer.
@@ -48,6 +45,9 @@
      */
     public static final String INIT_PARAM_PREFIX = "resource-path-prefix";
 
+    /** the 'missing-auth-mapping' init parameter */
+    public final static String INIT_PARAM_MISSING_AUTH_MAPPING = "missing-auth-mapping";
+
     private String pathPrefix;
     private JCRWebdavServer server;
     private DavResourceFactory resourceFactory;
@@ -77,13 +77,10 @@
 	if (repository == null) {
 	    throw new ServletException("Repository could not be retrieved. Check config of 'RepositoryAccessServlet'.");
 	}
-        CredentialsProvider cp = new CredentialsProvider() {
-            public Credentials getCredentials(HttpServletRequest request) throws LoginException, ServletException {
-                return RepositoryAccessServlet.getCredentialsFromHeader(ctx, request.getHeader(DavConstants.HEADER_AUTHORIZATION));
-            }
-        };
-
-	server = new JCRWebdavServer(repository, new SessionProviderImpl(cp));
+	server = new JCRWebdavServer(repository, new SessionProviderImpl(
+                new BasicCredentialsProvider(
+                        getInitParameter(INIT_PARAM_MISSING_AUTH_MAPPING)))
+        );
         txMgr = new TxLockManagerImpl();
         subscriptionMgr = new SubscriptionManagerImpl();
 
@@ -97,7 +94,7 @@
      * {@link WebdavRequest#matchesIfHeader(DavResource) If header} and validation
      * of {@link org.apache.jackrabbit.webdav.transaction.TransactionConstants#HEADER_TRANSACTIONID
      * TransactionId header}. This method will also return false if the requested
-     * resource lays within a differenct workspace as is assigned to the repository
+     * resource resides within a differenct workspace as is assigned to the repository
      * session attached to the given request.
      *
      * @see AbstractWebdavServlet#isPreconditionValid(WebdavRequest, DavResource)

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/LoggingServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/LoggingServlet.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/LoggingServlet.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/LoggingServlet.java Mon Nov  7 07:26:33 2005
@@ -1,15 +1,18 @@
 /*
- * $Id$
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
  *
- * Copyright (c) 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ * 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
  *
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ *      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.j2ee;
 

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java Mon Nov  7 07:26:33 2005
@@ -17,23 +17,14 @@
 package org.apache.jackrabbit.j2ee;
 
 import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory;
-import org.apache.jackrabbit.util.Base64;
 import org.apache.log4j.Logger;
 
-import javax.jcr.Credentials;
-import javax.jcr.LoginException;
 import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
@@ -61,9 +52,6 @@
     /** the 'missing-auth-mapping' init parameter */
     public final static String INIT_PARAM_MISSING_AUTH_MAPPING = "missing-auth-mapping";
 
-    /** Authorization header name */
-    private static final String HEADER_AUTHORIZATION = "Authorization";
-
     private static final String CTX_ATTR_REPOSITORY = "jcr.repository";
 
     private String repositoryName;
@@ -180,99 +168,6 @@
      */
     public static Repository getRepository(ServletContext ctx) {
 	return (Repository) ctx.getAttribute(CTX_ATTR_REPOSITORY);
-    }
-
-    /**
-     * Build a {@link Credentials} object for the given authorization header.
-     * The creds may be used to login to the repository. If the specified header
-     * string is <code>null</code> or not of the required format the behaviour
-     * depends on the {@link #INIT_PARAM_MISSING_AUTH_MAPPING} param:<br>
-     * <ul>
-     * <li> if this init-param is missing, a LoginException is thrown.
-     *      This is suiteable for clients (eg. webdav clients) for with
-     *      sending a proper authorization header is not possible, if the
-     *      server never send a 401.
-     * <li> if this init-param is present, but with an empty value,
-     *      null-credentials are returned, thus forcing an null login
-     *      on the repository
-     * <li> if this init-param has a 'user:password' value, the respective
-     *      simple credentials are generated.
-     * </ul>
-     *
-     * @param authHeader Authorization header as present in the Http request
-     * @return credentials or <code>null</code>.
-     * @throws ServletException If an IOException occured while decoding the
-     * Authorization header.
-     * @throws LoginException if no suitable auth header and missing-auth-mapping
-     * is not present
-     * @see #getRepository(ServletContext)
-     */
-    public static Credentials getCredentialsFromHeader(ServletContext ctx,
-                                                       String authHeader)
-	    throws ServletException, LoginException {
-	try {
-	    if (authHeader != null) {
-		String[] authStr = authHeader.split(" ");
-		if (authStr.length >= 2 && authStr[0].equalsIgnoreCase(HttpServletRequest.BASIC_AUTH)) {
-		    ByteArrayOutputStream out = new ByteArrayOutputStream();
-		    Base64.decode(authStr[1].toCharArray(), out);
-		    String decAuthStr = out.toString("ISO-8859-1");
-		    int pos = decAuthStr.indexOf(':');
-		    String userid = decAuthStr.substring(0, pos);
-		    String passwd = decAuthStr.substring(pos + 1);
-		    return new SimpleCredentials(userid, passwd.toCharArray());
-		}
-	    }
-            // check special handling
-            String missingAuthMapping = ctx.getInitParameter(INIT_PARAM_MISSING_AUTH_MAPPING);
-            if (missingAuthMapping == null) {
-                throw new LoginException();
-            } else if (missingAuthMapping.equals("")) {
-                return null;
-            } else {
-                int pos = missingAuthMapping.indexOf(':');
-                if (pos<0) {
-                    return new SimpleCredentials(missingAuthMapping, null);
-                } else {
-                    return new SimpleCredentials(
-                            missingAuthMapping.substring(0, pos),
-                            missingAuthMapping.substring(pos+1).toCharArray()
-                    );
-                }
-            }
-	} catch (IOException e) {
-	    throw new ServletException("Unable to decode authorization: " + e.toString());
-	}
-    }
-
-    /**
-     * Simple login to the {@link Repository} accessed by this servlet using the
-     * Authorization header present in the given request.<p/>
-     * Please note, that no workspace information is provided to the repository
-     * login ({@link Repository#login(javax.jcr.Credentials)}), thus the default
-     * workspace will be selected. In order to provide a specific workspace name,
-     * manual {@link Repository#login(Credentials, String) login} is required (see
-     * also {@link #getRepository(ServletContext)}).
-     *
-     * @param request
-     * @return  Session object obtained upon {@link Repository#login(javax.jcr.Credentials)}.
-     * @throws ServletException
-     * @throws LoginException if credentials are invalid
-     * @see #getRepository(ServletContext) in order to be able to login to a specific workspace.
-     * @see #getCredentialsFromHeader(ServletContext, String) for a utility method to retrieve
-     * credentials from the Authorization header string.
-     */
-    public static Session login(ServletContext ctx, HttpServletRequest request)
-            throws LoginException, ServletException {
-        String authHeader = request.getHeader(HEADER_AUTHORIZATION);
-	try {
-            Repository rep = getRepository(ctx);
-	    return rep.login(getCredentialsFromHeader(ctx, authHeader));
-        } catch (LoginException e) {
-            throw e;
-	} catch (RepositoryException e) {
-	    throw new ServletException("Failed to login to the repository: " + e.toString());
-	}
     }
 }
 

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java Mon Nov  7 07:26:33 2005
@@ -63,6 +63,12 @@
     /** initial param name for the rmi port */
     public final static String INIT_PARAM_RMI_PORT = "rmi-port";
 
+    /** initial param name for the rmi host */
+    public final static String INIT_PARAM_RMI_HOST = "rmi-host";
+
+    /** initial param name for the rmi uri */
+    public final static String INIT_PARAM_RMI_URI = "rmi-uri";
+
     /** initial param name for the log4j config properties */
     public final static String INIT_PARAM_LOG4J_CONFIG = "log4j-config";
 
@@ -75,7 +81,7 @@
     /** the jndi context, created base on configuration */
     private InitialContext jndiContext;
 
-    /** the rmi uri, in the form of  '//:${rmi-port}/${repository-name}' */
+    /** the rmi uri, in the form of  '//${rmi-host}:${rmi-port}/${repository-name}' */
     private String rmiURI;
 
     /**
@@ -227,21 +233,27 @@
     private void registerRMI() throws ServletException {
 	// check registering via RMI
 	String rmiPortStr = getServletConfig().getInitParameter(INIT_PARAM_RMI_PORT);
+        String rmiHost = getServletConfig().getInitParameter(INIT_PARAM_RMI_HOST);
+        rmiURI = getServletConfig().getInitParameter(INIT_PARAM_RMI_URI);
+        if (rmiPortStr == null && rmiHost == null && rmiURI == null) {
+            return;
+        }
+        int rmiPort = Registry.REGISTRY_PORT;
 	if (rmiPortStr != null) {
-	    int rmiPort = 0;
 	    try {
 		rmiPort = Integer.parseInt(rmiPortStr);
 	    } catch (NumberFormatException e) {
-		log.warn("Invalid port in rmi-port param: " + e);
+                log.warn("Invalid port in rmi-port param: " + e + ". using default port.");
+            }
 	    }
-	    if (rmiPort == 0) {
-		rmiPort = Registry.REGISTRY_PORT;
+        if (rmiHost == null) {
+            rmiHost = "";
 	    }
 
 	    // try to create remote repository
 	    Remote remote;
 	    try {
-		Class clazz = Class.forName("org.apache.jackrabbit.j2ee.RMIRemoteFactoryDelegater");
+            Class clazz = Class.forName(getRemoteFactoryDelegaterClass());
 		RemoteFactoryDelegater rmf = (RemoteFactoryDelegater) clazz.newInstance();
 		remote = rmf.createRemoteRepository(repository);
 	    } catch (RemoteException e) {
@@ -262,7 +274,9 @@
 		} catch (RemoteException e) {
 		    // ignore
 		}
-		rmiURI = "//:" + rmiPort + "/" + repositoryName;
+            if (rmiURI == null) {
+                rmiURI = "//" + rmiHost + ":" + rmiPort + "/" + repositoryName;
+            }
 		Naming.bind(rmiURI, remote);
 
 		log.info("Repository bound via RMI with name: " + rmiURI);
@@ -274,6 +288,14 @@
 		throw new ServletException("Unable to bind repository via RMI: " + e.toString(), e);
 	    }
 	}
+
+    /**
+     * Return the fully qualified name of the class providing the remote
+     * repository. The class whose name is returned must implement the
+     * {@link RemoteFactoryDelegater} interface.
+     */
+    protected String getRemoteFactoryDelegaterClass() {
+        return "org.apache.jackrabbit.j2ee.RMIRemoteFactoryDelegater";
     }
 
     /**

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/SimpleWebdavServlet.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/SimpleWebdavServlet.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/SimpleWebdavServlet.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/SimpleWebdavServlet.java Mon Nov  7 07:26:33 2005
@@ -15,38 +15,23 @@
  */
 package org.apache.jackrabbit.j2ee;
 
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.config.ConfigParser;
-import org.apache.commons.chain.impl.CatalogFactoryBase;
-import org.apache.jackrabbit.server.CredentialsProvider;
 import org.apache.jackrabbit.server.SessionProvider;
 import org.apache.jackrabbit.server.SessionProviderImpl;
 import org.apache.jackrabbit.server.AbstractWebdavServlet;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavLocatorFactory;
-import org.apache.jackrabbit.webdav.DavMethods;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceFactory;
-import org.apache.jackrabbit.webdav.DavSessionProvider;
-import org.apache.jackrabbit.webdav.WebdavRequest;
-import org.apache.jackrabbit.webdav.WebdavResponse;
+import org.apache.jackrabbit.server.BasicCredentialsProvider;
+import org.apache.jackrabbit.webdav.jcr.DavLocatorFactoryImpl;
 import org.apache.jackrabbit.webdav.lock.LockManager;
 import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
 import org.apache.jackrabbit.webdav.simple.DavSessionProviderImpl;
-import org.apache.jackrabbit.webdav.simple.LocatorFactoryImpl;
 import org.apache.jackrabbit.webdav.simple.ResourceFactoryImpl;
 import org.apache.jackrabbit.webdav.simple.ResourceConfig;
+import org.apache.jackrabbit.webdav.*;
 import org.apache.log4j.Logger;
 
-import javax.jcr.Credentials;
-import javax.jcr.LoginException;
 import javax.jcr.Repository;
 import javax.servlet.ServletException;
 import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
-import java.net.URL;
 import java.net.MalformedURLException;
 
 /**
@@ -81,6 +66,9 @@
      */
     public static final String INIT_PARAM_AUTHENTICATE_HEADER = "authenticate-header";
 
+    /** the 'missing-auth-mapping' init parameter */
+    public final static String INIT_PARAM_MISSING_AUTH_MAPPING = "missing-auth-mapping";
+
     /**
      * Name of the init parameter that specify a separate configuration used
      * for filtering the resources displayed.
@@ -100,18 +88,13 @@
     private String resourcePathPrefix;
 
     /**
-     * the chain catalog for i/o operations
-     */
-    private Catalog chainCatalog;
-
-    /**
      * Header value as specified in the {@link #INIT_PARAM_AUTHENTICATE_HEADER} parameter.
      */
     private String authenticate_header;
 
     /**
      * Map used to remember any webdav lock created without being reflected
-     * in the underlaying repository.
+     * in the underlying repository.
      * This is needed because some clients rely on a successful locking
      * mechanism in order to perform properly (e.g. mac OSX built-in dav client)
      */
@@ -166,17 +149,6 @@
         getServletContext().setAttribute(CTX_ATTR_RESOURCE_PATH_PREFIX, resourcePathPrefix);
         log.info(INIT_PARAM_RESOURCE_PATH_PREFIX + " = '" + resourcePathPrefix + "'");
 
-        try {
-            String chain = getInitParameter(INIT_PARAM_CHAIN_CATALOG);
-            URL chainUrl = getServletContext().getResource(chain);
-            ConfigParser parser = new ConfigParser();
-            parser.parse(chainUrl);
-            chainCatalog = CatalogFactoryBase.getInstance().getCatalog();
-        } catch (Exception e) {
-            throw new ServletException(e);
-        }
-        log.info(INIT_PARAM_CHAIN_CATALOG + " = '" + chainCatalog + "'");
-
         authenticate_header = getInitParameter(INIT_PARAM_AUTHENTICATE_HEADER);
         if (authenticate_header == null) {
             authenticate_header = DEFAULT_AUTHENTICATE_HEADER;
@@ -206,7 +178,7 @@
      * @return
      * @throws ServletException
      * @throws IOException
-     * @throws DavException
+     * @throws org.apache.jackrabbit.webdav.DavException
      */
     protected boolean execute(WebdavRequest request, WebdavResponse response,
                               int method, DavResource resource)
@@ -296,7 +268,7 @@
      */
     public DavLocatorFactory getLocatorFactory() {
         if (locatorFactory == null) {
-            locatorFactory = new LocatorFactoryImpl(resourcePathPrefix);
+            locatorFactory = new DavLocatorFactoryImpl(resourcePathPrefix);
         }
         return locatorFactory;
     }
@@ -366,16 +338,13 @@
      * returned.
      *
      * @return the session provider
-     * @see RepositoryAccessServlet#getCredentialsFromHeader(ServletContext, String)
      */
     public synchronized SessionProvider getSessionProvider() {
         if (sessionProvider == null) {
-            CredentialsProvider cp = new CredentialsProvider() {
-                public Credentials getCredentials(HttpServletRequest request) throws LoginException, ServletException {
-                    return RepositoryAccessServlet.getCredentialsFromHeader(getServletContext(), request.getHeader(DavConstants.HEADER_AUTHORIZATION));
-                }
-            };
-            sessionProvider = new SessionProviderImpl(cp);
+            sessionProvider = new SessionProviderImpl(
+                new BasicCredentialsProvider(
+                    getInitParameter(INIT_PARAM_MISSING_AUTH_MAPPING))
+            );
         }
         return sessionProvider;
     }

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml Mon Nov  7 07:26:33 2005
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 <!DOCTYPE config [
-        <!ELEMENT config ((collection | noncollection)? , filter?) >
+        <!ELEMENT config (iomanager , (collection | noncollection)? , filter?) >
+
+        <!ELEMENT iomanager (class) >
 
         <!ELEMENT collection (nodetypes) >
         <!ELEMENT noncollection (nodetypes) >
@@ -22,6 +24,15 @@
 -->
 
 <config>
+    <!--
+    Defines the IOManager implementation that is responsible for passing import/export
+    request to the individual IO-handlers.
+    -->
+    <iomanager>
+        <!-- class element defines the manager to be used. The specified class
+             must implement the IOManager interface -->
+        <class name="org.apache.jackrabbit.server.io.DefaultIOManager" />
+    </iomanager>
     <!--
     Defines nodetypes, that should always be displayed as 'collection'.
     -->

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?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- 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 Mon Nov  7 07:26:33 2005
@@ -52,13 +52,34 @@
         </init-param>
 
         <!--
+            the following 3 parameters deal with registering the repository to
+            a RMI registry. if all parameters are omitted, the repository will
+            not be registered.
+        -->
+        <!--
         <init-param>
             <param-name>rmi-port</param-name>
             <param-value>0</param-value>
             <description>
                 The RMI port for registering the repository in the RMI Registry.
-                If equals 0, the default port is used. Omit this parameter, to
-                disable RMI server completely.
+                If equals 0, the default port is used.
+            </description>
+        </init-param>
+        <init-param>
+            <param-name>rmi-host</param-name>
+            <param-value>localhost</param-value>
+            <description>
+                The RMI host for registering the repository in the RMI Registry.
+                If equals "" or missing, the default host is used.
+            </description>
+        </init-param>
+        <init-param>
+            <param-name>rmi-uri</param-name>
+            <param-value></param-value>
+            <description>
+                The RMI uri for registering the repository in the RMI Registry.
+                If missing, the uri is composed using the other rmi parameters
+                and will have the format: //{rmi-host}:{rmi-port}/{repository-name}
             </description>
         </init-param>
         -->
@@ -171,13 +192,6 @@
             </description>
         </init-param>
         -->
-        <init-param>
-            <param-name>chain-catalog</param-name>
-            <param-value>/WEB-INF/catalog.xml</param-value>
-            <description>
-                the defines the commons-chain catalog for server tasks.
-            </description>
-        </init-param>
         <!--
             Parameter used to configure behaviour of webdav resources such as:
             - destinction between collections and non-collections

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavConstants.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavConstants.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavConstants.java Mon Nov  7 07:26:33 2005
@@ -135,12 +135,10 @@
     /**
      * modificationDate date format per RFC 1123
      */
-    public static SimpleDateFormat modificationDateFormat =
-	new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
+    public static SimpleDateFormat modificationDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
 
     /**
      * Simple date format for the creation date ISO representation (partial).
      */
-    public static SimpleDateFormat creationDateFormat =
-	new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+    public static SimpleDateFormat creationDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResource.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResource.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResource.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavResource.java Mon Nov  7 07:26:33 2005
@@ -18,8 +18,9 @@
 import org.apache.jackrabbit.webdav.property.*;
 import org.apache.jackrabbit.webdav.lock.*;
 import org.apache.jackrabbit.webdav.io.InputContext;
+import org.apache.jackrabbit.webdav.io.OutputContext;
 
-import java.io.InputStream;
+import java.io.IOException;
 
 /**
  * <code>DavResource</code> provides standard WebDAV functionality as specified
@@ -39,11 +40,6 @@
     public static final String METHODS = "OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, PROPPATCH, COPY, PUT, DELETE, MOVE, LOCK, UNLOCK";
 
     /**
-     * Constant indicating the undefined modification time.
-     */
-    public static final long UNDEFINED_MODIFICATIONTIME = -1;
-
-    /**
      * Returns a comma separted list of all compliance classes the given
      * resource is fulfilling.
      *
@@ -115,12 +111,14 @@
     public long getModificationTime();
 
     /**
-     * Returns a stream to the resource content in order to respond to a 'GET'
-     * request.
+     * Spools the resource properties and ev. content to the specified context
+     * (e.g. to respond to a 'GET' or 'HEAD' request). The context could e.g.
+     * wrap the servlet response.
      *
-     * @return stream to the resource content.
+     * @param outputContext
+     * @throws IOException
      */
-    public InputStream getStream();
+    public void spool(OutputContext outputContext) throws IOException;
 
     /**
      * Returns an array of all {@link DavPropertyName property names} available
@@ -190,18 +188,11 @@
      * Add the given resource as an internal member to this resource.
      *
      * @param resource {@link DavResource} to be added as internal member.
-     * @param inputCxt Context providing the content for the internal member.
-     * @throws DavException
-     */
-    public void addMember(DavResource resource, InputContext inputCxt) throws DavException;
-
-    /**
-     * Add the given resource as an internal member to this resource.
-     *
-     * @param resource webdav resource to be added as member.
+     * @param inputContext Context providing the properties and content for the
+     * internal member to be created or replaced.
      * @throws DavException
      */
-    public void addMember(DavResource resource) throws DavException;
+    public void addMember(DavResource resource, InputContext inputContext) throws DavException;
 
     /**
      * Returns an iterator over all internal members.

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavSession.java Mon Nov  7 07:26:33 2005
@@ -21,13 +21,13 @@
  * <code>DavSession</code> wraps a {@link Session repository session}
  * object, that is obtained on
  * {@link javax.jcr.Repository#login(javax.jcr.Credentials, String) login} to
- * the underlaying repository.
+ * the underlying repository.
  */
 public interface DavSession {
 
     /**
      * Adds a reference to this <code>DavSession</code> indicating that
-     * the underlaying {@link Session} object is needed for actions spanning over
+     * the underlying {@link Session} object is needed for actions spanning over
      * multiple requests.
      *
      * @param reference to be added.
@@ -36,8 +36,7 @@
 
     /**
      * Releasing a reference to this <code>DavSession</code>. If no more
-     * references are present, the underlaying {@link Session} may be discarded
-     * (e.g by calling {@link Session#logout()}.
+     * references are present, the underlying {@link Session} may be discarded.
      *
      * @param reference to be removed.
      */

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContext.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContext.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContext.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContext.java Mon Nov  7 07:26:33 2005
@@ -1,5 +1,6 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,69 +19,60 @@
 import java.io.InputStream;
 
 /**
- * <code>InputContext</code> class encapsulates the <code>InputStream</code>
- * and some header values as present in the POST, PUT or MKCOL request.
+ * <code>InputContext</code>...
  */
-public class InputContext {
+public interface InputContext {
 
-    private InputStream inputStream;
-    private String contentType;
-    private String contentLanguage;
+    /**
+     * Return true, if there are any data to be imported (and not only properties)
+     *
+     * @return
+     */
+    public boolean hasStream();
 
     /**
-     * Returns the input stream to be imported or <code>null</code> if no stream
-     * has been set or if the stream has been consumed.
+     * Returns the input stream of the resource to import.
      *
      * @return the input stream.
      */
-    public InputStream getInputStream() {
-        return inputStream;
-    }
+    public InputStream getInputStream();
 
     /**
-     * Sets the input stream to be imported. The input stream should be set to
-     * <code>null</code> if it has been consumed.
+     * Returns the modification time of the resource or the current time if
+     * the modification time has not been set.
      *
-     * @param inputStream the input stream
+     * @return the modification time.
      */
-    public void setInputStream(InputStream inputStream) {
-        this.inputStream = inputStream;
-    }
+    public long getModificationTime();
 
     /**
-     * Returns the content type of the resource to be imported or null, if
-     * no has previously been set.
+     * Returns the content language or <code>null</code>
      *
-     * @return the content type of the resource
+     * @return contentLanguage
      */
-    public String getContentType() {
-        return contentType;
-    }
+    public String getContentLanguage();
 
     /**
-     * Sets the content type of the resource.
+     * Returns the length of the data or -1 if the contentlength could not be
+     * determined.
      *
-     * @param contentType the content type.
+     * @return the content length
      */
-    public void setContentType(String contentType) {
-        this.contentType = contentType;
-    }
+    public long getContentLength();
 
     /**
-     * Returns the content language or <code>null</code>.
+     * Return the content type or <code>null</code>
      *
-     * @return contentLanguage
+     * @return
      */
-    public String getContentLanguage() {
-        return contentLanguage;
-    }
+    public String getContentType();
 
     /**
-     * Sets the content language.
+     * Returns the value of the given property or <code>null</code> if this property does
+     * not exist.
      *
-     * @param contentLanguage
+     * @param propertyName
+     * @return String property value or <code>null</code>
      */
-    public void setContentLanguage(String contentLanguage) {
-        this.contentLanguage = contentLanguage;
-    }
+    public String getProperty(String propertyName);
 }

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java?rev=331281&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java Mon Nov  7 07:26:33 2005
@@ -0,0 +1,83 @@
+/*
+ * 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.io;
+
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.apache.log4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.InputStream;
+import java.util.Date;
+
+/**
+ * <code>InputContextImpl</code> class encapsulates the <code>InputStream</code>
+ * and some header values as present in the POST, PUT or MKCOL request.
+ */
+public class InputContextImpl implements InputContext {
+
+    private static Logger log = Logger.getLogger(InputContextImpl.class);
+
+    private final HttpServletRequest request;
+    private final InputStream in;
+
+    public InputContextImpl(HttpServletRequest request, InputStream in) {
+        if (request == null) {
+            throw new IllegalArgumentException("DavResource and Request must not be null.");
+        }
+
+        this.request = request;
+        this.in = in;
+    }
+
+    public boolean hasStream() {
+        return in != null;
+    }
+
+    /**
+     * Returns the input stream of the resource to import.
+     *
+     * @return the input stream.
+     */
+    public InputStream getInputStream() {
+        return in;
+    }
+
+    public long getModificationTime() {
+        return new Date().getTime();
+    }
+
+    /**
+     * Returns the content language or <code>null</code>.
+     *
+     * @return contentLanguage
+     */
+    public String getContentLanguage() {
+        return request.getHeader(DavConstants.HEADER_CONTENT_LANGUAGE);
+    }
+
+    public long getContentLength() {
+        int length = request.getIntHeader(DavConstants.HEADER_CONTENT_LENGTH);
+        return Long.parseLong(length + "");
+    }
+
+    public String getContentType() {
+        return request.getHeader(DavConstants.HEADER_CONTENT_TYPE);
+    }
+
+    public String getProperty(String propertyName) {
+        return request.getHeader(propertyName);
+    }
+}

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

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContext.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContext.java?rev=331281&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContext.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContext.java Mon Nov  7 07:26:33 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.io;
+
+import java.io.OutputStream;
+
+/**
+ * <code>OutputContext</code>...
+ */
+public interface OutputContext {
+
+    /**
+     * Return true if the given export context can provide an output stream
+     */
+    public boolean hasStream();
+
+    /**
+     * Return the output stream to be used for the export or <code>null</code>
+     *
+     * @return
+     */
+    public OutputStream getOutputStream();
+
+    /**
+     * Sets the content language.
+     *
+     * @param contentLanguage
+     */
+    public void setContentLanguage(String contentLanguage);
+
+    /**
+     * Sets the length of the data.
+     *
+     * @param contentLength the content length
+     */
+    public void setContentLength(long contentLength);
+
+    /**
+     * Set the content type for the resource content
+     *
+     * @param contentType
+     */
+    public void setContentType(String contentType);
+    
+    /**
+     * Sets the modification time of the resource
+     *
+     * @param modificationTime the modification time
+     */
+    public void setModificationTime(long modificationTime);
+
+    /**
+     * Sets the ETag of the resource. A successfull export command
+     * may set this member.
+     *
+     * @param etag the ETag
+     */
+    public void setETag(String etag);
+
+    /**
+     * Allows to set additional properties that are not covered by an extra setter
+     * method.
+     *
+     * @param propertyName
+     * @param propertyValue
+     */
+    public void setProperty(String propertyName, String propertyValue);
+}

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

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContext.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContextImpl.java?rev=331281&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContextImpl.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContextImpl.java Mon Nov  7 07:26:33 2005
@@ -0,0 +1,87 @@
+/*
+ * 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.io;
+
+import org.apache.log4j.Logger;
+import org.apache.jackrabbit.webdav.DavConstants;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+
+/**
+ * <code>OutputContextImpl</code>...
+ */
+public class OutputContextImpl implements OutputContext {
+
+    private static Logger log = Logger.getLogger(OutputContextImpl.class);
+
+    private final HttpServletResponse response;
+    private final OutputStream out;
+
+    public OutputContextImpl(HttpServletResponse response, OutputStream out) {
+        if (response == null) {
+            throw new IllegalArgumentException("Response must not be null.");
+        }
+
+        this.response = response;
+        this.out = out;
+    }
+
+    public boolean hasStream() {
+        return out != null;
+    }
+
+    public OutputStream getOutputStream() {
+        return out;
+    }
+
+    public void setContentLanguage(String contentLanguage) {
+        if (contentLanguage != null) {
+            response.setHeader(DavConstants.HEADER_CONTENT_LANGUAGE, contentLanguage);
+        }
+    }
+
+    public void setContentLength(long contentLength) {
+        int length = Integer.parseInt(contentLength + "");
+        if (length >= 0) {
+            response.setContentLength(length);
+        }
+    }
+
+    public void setContentType(String contentType) {
+        if (contentType != null) {
+            response.setContentType(contentType);
+        }
+    }
+
+    public void setModificationTime(long modificationTime) {
+        if (modificationTime >= 0) {
+            response.addDateHeader(DavConstants.HEADER_LAST_MODIFIED, modificationTime);
+        }
+    }
+
+    public void setETag(String etag) {
+        if (etag != null) {
+            response.setHeader(DavConstants.HEADER_ETAG, etag);
+        }
+    }
+
+    public void setProperty(String propertyName, String propertyValue) {
+        if (propertyName != null && propertyValue != null) {
+            response.setHeader(propertyName, propertyValue);
+        }
+    }
+}
\ No newline at end of file

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

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/io/OutputContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java?rev=331281&r1=331280&r2=331281&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/search/SearchConstants.java Mon Nov  7 07:26:33 2005
@@ -30,7 +30,7 @@
      * Namespace definition.<br>
      * NOTE: For convenience reasons, the namespace is defined to be the default
      * {@link  DavConstants#NAMESPACE DAV:} namespace. This is not correct for the
-     * underlaying specification is still in a draft state. See also the editorial
+     * underlying specification is still in a draft state. See also the editorial
      * note inside the
      * <a href="http://greenbytes.de/tech/webdav/draft-reschke-webdav-search-latest.html#rfc.section.1.5">Internet Draft WebDAV Search</a>
      * document.