dirkv       01/10/07 13:47:48

  Modified:    src/webdav/client/src/org/apache/webdav/cmd Slide.java
  Log:
  New command:
  propgetall [<path>]  or propfindall [<path>]
  Print value of all properties
  
  Revision  Changes    Path
  1.42      +46 -3     
jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java
  
  Index: Slide.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- Slide.java        2001/10/07 20:43:11     1.41
  +++ Slide.java        2001/10/07 20:47:48     1.42
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.41 
2001/10/07 20:43:11 dirkv Exp $
  - * $Revision: 1.41 $
  - * $Date: 2001/10/07 20:43:11 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.42 
2001/10/07 20:47:48 dirkv Exp $
  + * $Revision: 1.42 $
  + * $Date: 2001/10/07 20:47:48 $
    *
    * ====================================================================
    *
  @@ -92,6 +92,8 @@
   import org.apache.webdav.lib.Privilege;
   import org.apache.webdav.lib.Lock;
   import org.apache.webdav.lib.PropertyName;
  +import org.apache.webdav.lib.ResponseEntity;
  +import org.apache.webdav.lib.Property;
   
   /**
    * The Slide client, the command line version for WebDAV client.
  @@ -1068,6 +1070,45 @@
                               e.getMessage());
                       }
                   } else
  +                if (todo.equalsIgnoreCase("propgetall") ||
  +                    todo.equalsIgnoreCase("propfindall")) {
  +                    int count = params.size();
  +                    String path;
  +                    if (count > 1) {
  +                        System.out.println("Propgetall/propfindall has a maximum of 
1 argument");
  +                        continue;
  +                    }
  +                    if (count==1) {
  +                        path=checkUri((String)params.pop());
  +                    }
  +                    else {
  +                        path=webdavResource.getPath();
  +                    }
  +
  +                    try {
  +                        System.out.print("Getting properties '" + path + "': ");
  +
  +                        Enumeration responses = webdavResource.propfindMethod(path, 
DepthSupport.DEPTH_0);
  +                        if (!responses.hasMoreElements()) {
  +                            System.err.println("failed (no response received).");
  +                            System.err.println(webdavResource.getStatusMessage());
  +                            continue;
  +                        }
  +                        else {
  +                            System.out.println();
  +                        }
  +                        ResponseEntity response = (ResponseEntity) 
responses.nextElement();
  +                        Enumeration properties = response.getProperties();
  +                        while (properties.hasMoreElements()){
  +                            Property property = (Property)properties.nextElement();
  +                            System.out.println("   " + property.getName() + " : " + 
property.getPropertyAsString());
  +                        }
  +                    } catch (HttpException we) {
  +                        System.err.println("Warning: " + we.getMessage());
  +                    } catch (IOException e) {
  +                        System.err.println("Error: Check! " + e.getMessage());
  +                    }
  +                } else
                   if (todo.equalsIgnoreCase("propput") ||
                       todo.equalsIgnoreCase("proppatch")) {
                       if (params.size() == 3) {
  @@ -1618,6 +1659,8 @@
               "Displays locks on specified resource");
           System.out.println("  propget path property ...     " +
               "Print value of specified property");
  +        System.out.println("  propgetall [<path>]           " +
  +            "Print value of all properties");
           System.out.println("  propput path property value   " +
               "Set property with given value");
           System.out.println("  set URLencode {on|off}        " +
  
  
  


Reply via email to