jmetzner    02/04/14 15:42:51

  Modified:    java/scratchpad/src/org/apache/xindice/webdav WebDav.java
                        webdav.roles
               java/scratchpad/src/org/apache/xindice/webdav/methods
                        Copy.java DAVMethod.java Delete.java Get.java
                        Head.java Mkcol.java Move.java Options.java
                        Post.java Propfind.java Proppatch.java Put.java
                        Trace.java
  Log:
  Database Access added
  
  Revision  Changes    Path
  1.3       +15 -2     
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/WebDav.java
  
  Index: WebDav.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/WebDav.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebDav.java       5 Apr 2002 21:31:55 -0000       1.2
  +++ WebDav.java       14 Apr 2002 22:42:50 -0000      1.3
  @@ -82,12 +82,13 @@
   import org.apache.log.Hierarchy;
   
   import org.apache.xindice.webdav.methods.DAVMethod;
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    *  This is the entry point for the Xindice WebDAV implementation.
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: WebDav.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $
  + * @version $Id: WebDav.java,v 1.3 2002/04/14 22:42:50 jmetzner Exp $
    */
   
   public class WebDav 
  @@ -110,6 +111,9 @@
     /** The Log channel */
     private Logger logger;
   
  +  /** The DataSource */
  +  private DAVDataSource dataSource;
  +
     /** Empty constructor, as per Avalon specs */ 
     public WebDav() { }
   
  @@ -147,6 +151,15 @@
         manager.setLogger(getLogger());
         manager.setRoleManager(drm);
         manager.configure(config);
  +  
  +      // set datasource component
  +      ComponentSelector selector = (ComponentSelector) 
manager.lookup(DAVDataSource.ROLE + "Selector");
  +      Configuration dataSourceConfig = this.config.getChild("datasource");
  +      this.dataSource = 
(DAVDataSource)selector.select(dataSourceConfig.getAttribute("select"));
  +      this.dataSource.configure(dataSourceConfig);
  +      // set webroot - TODO get from servlet container
  +      this.dataSource.setWebRoot("/xindav/webdav");
  +      
       }  catch (Exception e) { 
         this.getLogger().error("Error initializing the application: ", e);
   
  @@ -200,7 +213,7 @@
   
         DAVMethod command = (DAVMethod)selector.select(req.getMethod());
   
  -      command.execute(req, res);
  +      command.execute(req, res, this.dataSource);
       }  catch (Exception e) { 
         e.printStackTrace(System.out);
       }  
  
  
  
  1.2       +6 -1      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/webdav.roles
  
  Index: webdav.roles
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/webdav.roles,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- webdav.roles      4 Apr 2002 07:51:51 -0000       1.1
  +++ webdav.roles      14 Apr 2002 22:42:50 -0000      1.2
  @@ -16,5 +16,10 @@
       <hint shorthand="trace" class="org.apache.xindice.webdav.methods.Trace" 
/> 
       <hint shorthand="propfind" 
class="org.apache.xindice.webdav.methods.Propfind" /> 
       <hint shorthand="proppatch" 
class="org.apache.xindice.webdav.methods.Proppatch" /> 
  -  </role>      
  +  </role>
  +  <role name="org.apache.xindice.webdav.datasource.DAVDataSourceSelector"
  +        shorthand="datasource"
  +        
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
 
  +    <hint shorthand="xmldb" 
class="org.apache.xindice.webdav.datasource.xmldb.XMLDBDataSource" />
  +  </role>
   </role-list>
  
  
  
  1.3       +7 -6      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Copy.java
  
  Index: Copy.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Copy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Copy.java 5 Apr 2002 21:31:55 -0000       1.2
  +++ Copy.java 14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,23 +59,24 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Copy command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Copy.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Copy.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Copy extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Copy";
  -
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  -
  +  
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
  +     
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Copy is not yet implemented");
   
  
  
  
  1.3       +5 -2      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/DAVMethod.java
  
  Index: DAVMethod.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/DAVMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DAVMethod.java    5 Apr 2002 21:31:55 -0000       1.2
  +++ DAVMethod.java    14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,11 +59,13 @@
   
   import org.apache.avalon.framework.component.Component;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
  +
   /**
    * The main WebDAV interface.
    *
    * @author <a href="[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: DAVMethod.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $
  + * @version $Id: DAVMethod.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $
    */
   
   public interface DAVMethod extends Component {
  @@ -71,7 +73,8 @@
   
     String ROLE = "org.apache.xindice.webdav.methods.DAVMethod";
   
  -  void execute(HttpServletRequest req, HttpServletResponse res)
  +  void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource)
       throws ServletException, IOException;
   
   }
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Delete.java
  
  Index: Delete.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Delete.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Delete.java       5 Apr 2002 21:31:55 -0000       1.2
  +++ Delete.java       14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Delete command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Delete.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Delete.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Delete extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Delete";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Delete is not yet implemented");
  
  
  
  1.3       +75 -8     
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Get.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Get.java  5 Apr 2002 21:31:55 -0000       1.2
  +++ Get.java  14 Apr 2002 22:42:51 -0000      1.3
  @@ -52,6 +52,8 @@
   package org.apache.xindice.webdav.methods;
   
   import java.io.IOException;
  +import java.io.PrintWriter;
  +import java.util.Enumeration;
   
   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
  @@ -59,27 +61,92 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
  +import org.apache.xindice.webdav.datasource.DAVObject;
  +import org.apache.xindice.webdav.datasource.DAVResource;
  +import org.apache.xindice.webdav.datasource.DAVCollection;
  +import org.apache.xindice.webdav.datasource.DAVObjectException;
  +import org.apache.xindice.webdav.datasource.DAVObjectNotFoundException;
   
   /** 
    * This class implements the Get command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Get.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Get.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Get extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Get";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
  -     if (this.getLogger().isDebugEnabled())
  -       this.getLogger().debug("Method Get is not yet implemented");
  -
  -     res.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
  +     String path = req.getPathInfo();
  +     if(path == null) {
  +       path = "/";
  +     }
  +     if (this.getLogger().isDebugEnabled()) {
  +       this.getLogger().debug("GET: Requested path: "+path);
  +     }
  +     PrintWriter writer = res.getWriter();
  +     
  +     try {
  +       DAVObject davObject = dataSource.getDAVObject(path);
  +
  +       if(davObject instanceof DAVCollection) {
  +         DAVCollection collection = (DAVCollection) davObject;
  +         
  +         DAVObject[] childs = collection.getChilds();
  +
  +         res.setContentType("text/html");
  +         writer.println("<html><head><title>collection listing for 
"+path+"</title>"
  +             +"</head><body><h1>collection listing for "+path+"</h1>");
  +
  +         for(int i=0; i<childs.length; i++) {
  +           if(childs[i].isCollection()) {
  +             writer.print("child collection: ");
  +           } else {
  +             writer.print("child resource:&nbsp;&nbsp;&nbsp; ");
  +           }
  +           writer.println("<a 
href='"+childs[i].getWebURL()+"'>"+childs[i].getName()+"</a><br />");
  +           for(Enumeration propertyKeys = childs[i].getProperties().keys();
  +             propertyKeys.hasMoreElements();) {
  +             String key = (String)propertyKeys.nextElement();
  +             String value = (String)childs[i].getProperties().get(key);
  +             writer.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+key+": 
"+value+"<br />");
  +           }
  +         }
  +
  +         writer.println("</body></html>");
  +         
  +       } else if(davObject instanceof DAVResource) {
  +         DAVResource resource = (DAVResource) davObject;
  +
  +         res.setContentType("text/xml");
  +         writer.println(resource.getContent());
  +         
  +       } else {
  +         if (this.getLogger().isWarnEnabled()) {
  +           this.getLogger().warn("Could not get cast object "+path+" to 
resource/collection!");
  +         }
  +         res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +       }
  +    } catch (DAVObjectNotFoundException donfe) {
  +      if (this.getLogger().isWarnEnabled()) {
  +        this.getLogger().warn("Object "+path+" not found!");
  +      }
  +      res.sendError(HttpServletResponse.SC_NOT_FOUND);
  +    } catch (DAVObjectException doe) {
  +      if (this.getLogger().isWarnEnabled()) {
  +        this.getLogger().warn("Error with object "+path);
  +      }
  +      doe.printStackTrace();
  +      res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +    }
  +     
     }
   
   }
  
  
  
  1.3       +35 -9     
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Head.java
  
  Index: Head.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Head.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Head.java 5 Apr 2002 21:31:55 -0000       1.2
  +++ Head.java 14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,27 +59,53 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
  +import org.apache.xindice.webdav.datasource.DAVObject;
  +import org.apache.xindice.webdav.datasource.DAVObjectException;
  +import org.apache.xindice.webdav.datasource.DAVObjectNotFoundException;
   
   /** 
    * This class implements the Head command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Head.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Head.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Head extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Head";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  -
  -     if (this.getLogger().isDebugEnabled())
  -       this.getLogger().debug("Method Head is not yet implemented");
  -
  -     res.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
  +    
  +    String path = req.getPathInfo();
  +    if(path == null) {
  +      path = "/";
  +    }
  +    if (this.getLogger().isDebugEnabled()) {
  +      this.getLogger().debug("HEAD: Requested path: "+path);
  +    }
  +    
  +    try {
  +      DAVObject davObject = dataSource.getDAVObject(path);
  +      
  +      res.setHeader("Last-Modified", 
  +          davObject.getProperty("modificationDate"));
  +          
  +    } catch (DAVObjectNotFoundException donfe) {
  +      if (this.getLogger().isWarnEnabled()) {
  +        this.getLogger().warn("Object "+path+" not found!");
  +      }
  +      res.sendError(HttpServletResponse.SC_NOT_FOUND);
  +    } catch (DAVObjectException doe) {
  +      if (this.getLogger().isWarnEnabled()) {
  +        this.getLogger().warn("Error with object "+path);
  +      }
  +      doe.printStackTrace();
  +      res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +    } 
     }
   
   }
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Mkcol.java
  
  Index: Mkcol.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Mkcol.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Mkcol.java        5 Apr 2002 21:31:55 -0000       1.2
  +++ Mkcol.java        14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Mkcol command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Mkcol.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Mkcol.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Mkcol extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Mkcol";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Mkcol is not yet implemented");
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Move.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Move.java 5 Apr 2002 21:31:55 -0000       1.2
  +++ Move.java 14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Move command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Move.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Move.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Move extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Move";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Move is not yet implemented");
  
  
  
  1.3       +44 -8     
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Options.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Options.java      5 Apr 2002 21:31:55 -0000       1.2
  +++ Options.java      14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,27 +59,63 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
  +import org.apache.xindice.webdav.datasource.DAVObject;
  +import org.apache.xindice.webdav.datasource.DAVObjectException;
  +import org.apache.xindice.webdav.datasource.DAVObjectNotFoundException;
   
   /** 
    * This class implements the Options command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Options.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Options.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Options extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Options";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
  -     if (this.getLogger().isDebugEnabled())
  -       this.getLogger().debug("Method Options is not yet implemented");
  -
  -     res.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
  +    String path = req.getPathInfo();
  +    if(path == null) {
  +      path = "/";
  +    }
  +    if (this.getLogger().isDebugEnabled()) {
  +      this.getLogger().debug("OPTIONS: Requested path: "+path);
  +    }
  +    
  +    try {
  +      DAVObject davObject = dataSource.getDAVObject(path);
  +      
  +      res.addHeader("DAV", "1");
  +      
  +      String methodsAllowed = null;      
  +      methodsAllowed = "OPTIONS, GET, HEAD, POST, DELETE, TRACE, "
  +        + "PROPFIND, PROPPATCH, COPY, MOVE";
  +      if (davObject.isCollection()) {
  +        methodsAllowed += ", PUT, MKCOL";
  +      }      
  +      res.addHeader("Allow", methodsAllowed);
  +      
  +      res.addHeader("MS-Author-Via", "DAV");
  +
  +    
  +    } catch (DAVObjectNotFoundException donfe) {
  +      if (this.getLogger().isWarnEnabled()) {
  +        this.getLogger().warn("Object "+path+" not found!");
  +      }
  +      res.sendError(HttpServletResponse.SC_NOT_FOUND);
  +    } catch (DAVObjectException doe) {
  +      if (this.getLogger().isWarnEnabled()) {
  +        this.getLogger().warn("Error with object "+path);
  +      }
  +      doe.printStackTrace();
  +      res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +    }
     }
   
   }
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Post.java
  
  Index: Post.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Post.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Post.java 5 Apr 2002 21:31:55 -0000       1.2
  +++ Post.java 14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Post command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Post.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Post.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Post extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Post";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Post is not yet implemented");
  
  
  
  1.3       +5 -5      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Propfind.java
  
  Index: Propfind.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Propfind.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Propfind.java     5 Apr 2002 21:31:55 -0000       1.2
  +++ Propfind.java     14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,23 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Propfind command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Propfind.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Propfind.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Propfind extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Propfind";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  -
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Propfind is not yet implemented");
   
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Proppatch.java
  
  Index: Proppatch.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Proppatch.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Proppatch.java    5 Apr 2002 21:31:55 -0000       1.2
  +++ Proppatch.java    14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Proppatch command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Proppatch.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Proppatch.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Proppatch extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Proppatch";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Proppatch is not yet implemented");
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Put.java
  
  Index: Put.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Put.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Put.java  5 Apr 2002 21:31:55 -0000       1.2
  +++ Put.java  14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Put command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Put.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Put.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Put extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Put";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Put is not yet implemented");
  
  
  
  1.3       +5 -4      
xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Trace.java
  
  Index: Trace.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/webdav/methods/Trace.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Trace.java        5 Apr 2002 21:31:55 -0000       1.2
  +++ Trace.java        14 Apr 2002 22:42:51 -0000      1.3
  @@ -59,22 +59,23 @@
   
   import org.apache.avalon.framework.logger.AbstractLoggable;
   
  +import org.apache.xindice.webdav.datasource.DAVDataSource;
   
   /** 
    * This class implements the Trace command for WebDAV operations on
    * Xindice. 
    * 
  - * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Gianugo Rabellino</a>
  - * @version $Id: Trace.java,v 1.2 2002/04/05 21:31:55 gianugo Exp $ 
  + * @version $Id: Trace.java,v 1.3 2002/04/14 22:42:51 jmetzner Exp $ 
    */
   
   public class Trace extends AbstractLoggable implements DAVMethod {
   
     static String ROLE = DAVMethod.ROLE + "/Trace";
   
  -  public void execute(HttpServletRequest req, HttpServletResponse res)
  -    throws ServletException, IOException {
  +  public void execute(HttpServletRequest req, HttpServletResponse res,
  +    DAVDataSource dataSource) throws ServletException, IOException {
   
        if (this.getLogger().isDebugEnabled())
          this.getLogger().debug("Method Trace is not yet implemented");
  
  
  

Reply via email to