You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by je...@apache.org on 2002/03/19 22:54:52 UTC

cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties LockDiscoveryProperty.java

jericho     02/03/19 13:54:52

  Modified:    src/webdav/client/src/org/apache/webdav/lib
                        WebdavResource.java Lock.java
               src/webdav/client/src/org/apache/webdav/lib/methods
                        LockMethod.java
               src/webdav/client/src/org/apache/webdav/cmd Client.java
               src/webdav/client/src/org/apache/webdav/lib/properties
                        LockDiscoveryProperty.java
  Log:
  #Subject: Provide an easier and precise argument with int.
  - Deprecate the lock methods with short arguments in WebdavResource.
  - Add the lock methods with int arguments in WebdavResource.
  - Deprecate the setTimeout method in LockMehod.
  - Add the setTimeout method with int argument in LockMethod.
  - Replace the getTimeout method with returing long in LockMethod.
  - Deprecate the LockMethod constructors
  - Add the new Lock LockMethod constructors with int argument.
  - Replace the timeout property from long to int in Lock, LockMethod, LockDiscoveryProperty.
  - RFC2518: The timeout value for TimeType "Second" MUST NOT be greater than 2^32-1.
  - Bug reported by Didier Berguerand <di...@imtf.ie>
  
  Revision  Changes    Path
  1.35      +33 -7     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java
  
  Index: WebdavResource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- WebdavResource.java	14 Mar 2002 03:55:32 -0000	1.34
  +++ WebdavResource.java	19 Mar 2002 21:54:51 -0000	1.35
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v 1.34 2002/03/14 03:55:32 jericho Exp $
  - * $Revision: 1.34 $
  - * $Date: 2002/03/14 03:55:32 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v 1.35 2002/03/19 21:54:51 jericho Exp $
  + * $Revision: 1.35 $
  + * $Date: 2002/03/19 21:54:51 $
    *
    * ====================================================================
    *
  @@ -3330,7 +3330,7 @@
               owner = defaultOwner + "@" + httpURL.getHost();
           }
           
  -        boolean result = lockMethod(httpURL.getPath(), owner, (short) 120);
  +        boolean result = lockMethod(httpURL.getPath(), owner, 120);
           if (result)
               refresh();
           return result;
  @@ -3347,7 +3347,7 @@
        * @exception HttpException
        * @exception IOException
        */
  -    public boolean lockMethod(String owner, short timeout)
  +    public boolean lockMethod(String owner, int timeout)
           throws HttpException, IOException {
           
           boolean result = lockMethod(httpURL.getPath(), owner, timeout);
  @@ -3375,7 +3375,7 @@
               owner = defaultOwner + "@" + httpURL.getHost();
           }
           
  -        return lockMethod(path, owner, (short) 120);
  +        return lockMethod(path, owner, 120);
       }
       
       
  @@ -3389,7 +3389,7 @@
        * @exception HttpException
        * @exception IOException
        */
  -    public boolean lockMethod(String path, String owner, short timeout)
  +    public boolean lockMethod(String path, String owner, int timeout)
           throws HttpException, IOException {
           
           setClient();
  @@ -3418,6 +3418,32 @@
           return false;
       }
       
  +
  +    /*
  +     * Execute the LOCK method for this WebdavResource.
  +     *
  +     * @see lockMethod
  +     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
  +     */
  +    public boolean lockMethod(String owner, short timeout)
  +        throws HttpException, IOException {
  +
  +        return lockMethod(owner, (int) timeout);
  +    }
  +
  +
  +    /*
  +     * Execute the LOCK method for the given path.
  +     *
  +     * @see lockMethod
  +     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
  +     */
  +    public boolean lockMethod(String path, String owner, short timeout)
  +        throws HttpException, IOException {
  +
  +        return lockMethod(path, owner, (int) timeout);
  +    }    
  +
       
       /*
        * Execute the Unlock method for this WebdavResource.
  
  
  
  1.4       +17 -7     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Lock.java
  
  Index: Lock.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Lock.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Lock.java	23 Sep 2001 13:14:10 -0000	1.3
  +++ Lock.java	19 Mar 2002 21:54:51 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Lock.java,v 1.3 2001/09/23 13:14:10 dirkv Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/09/23 13:14:10 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Lock.java,v 1.4 2002/03/19 21:54:51 jericho Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/03/19 21:54:51 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * @author <a href="mailto:jericho@thinkfree.com">Park, Sung-Gu</a>
    * @author Remy Maucherat
    * @author Dirk Verbeeck
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class Lock {
   
  @@ -119,7 +119,7 @@
        * Default constructor for the activelock.
        */
       public Lock(int lockScope, int lockType, int depth, String owner, 
  -                long timeout, String lockToken) {
  +                int timeout, String lockToken) {
           this.lockScope = lockScope;
           this.lockType = lockType;
           this.depth = depth;
  @@ -129,6 +129,16 @@
       }
   
   
  +    /**
  +     * Default constructor for the activelock.
  +     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
  +     */
  +    public Lock(int lockScope, int lockType, int depth, String owner, 
  +                long timeout, String lockToken) {
  +        this(lockScope, lockType, depth, owner, (int) timeout, lockToken);
  +    }
  +
  +
       // ------------------------------------------------------ Instance Variable
   
   
  @@ -144,7 +154,7 @@
       protected String owner = null;
   
   
  -    protected long timeout = -1;
  +    protected int timeout = -1;
   
   
       protected String lockToken = null;
  @@ -198,7 +208,7 @@
        *
        * @return The timeout vlaue. If it's not set, it could be -1.
        */
  -    public long getTimeout() {
  +    public int getTimeout() {
           return timeout;
       }
   
  
  
  
  1.27      +44 -9     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LockMethod.java
  
  Index: LockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LockMethod.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- LockMethod.java	28 Jan 2002 14:28:29 -0000	1.26
  +++ LockMethod.java	19 Mar 2002 21:54:51 -0000	1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LockMethod.java,v 1.26 2002/01/28 14:28:29 juergen Exp $
  - * $Revision: 1.26 $
  - * $Date: 2002/01/28 14:28:29 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LockMethod.java,v 1.27 2002/03/19 21:54:51 jericho Exp $
  + * $Revision: 1.27 $
  + * $Date: 2002/03/19 21:54:51 $
    *
    * ====================================================================
    *
  @@ -156,7 +156,8 @@
   
       public static final short TYPE_WRITE = LockEntryProperty.TYPE_WRITE;
   
  -    public static final long TIMEOUT_INFINITY = Long.MAX_VALUE;
  +    // The timeout value for TimeType "Second" MUST NOT be greater than 2^32-1.
  +    public static final int TIMEOUT_INFINITY = Integer.MAX_VALUE;
   
   
       // ----------------------------------------------------- Instance Variables
  @@ -190,7 +191,7 @@
       /**
        * Lock timeout.
        */
  -    private long timeout = TIMEOUT_INFINITY;
  +    private int timeout = TIMEOUT_INFINITY;
   
   
       /**
  @@ -228,7 +229,7 @@
       /**
        * Method constructor.
        */
  -    public LockMethod(String path, String refreshOpaqueToken, long timeout) {
  +    public LockMethod(String path, String refreshOpaqueToken, int timeout) {
           this(path);
           this.refreshOpaqueToken = refreshOpaqueToken;
           setTimeout(timeout);
  @@ -238,13 +239,29 @@
       /**
        * Method constructor.
        */
  -    public LockMethod(String path, String owner, short scope, long timeout) {
  +    public LockMethod(String path, String owner, short scope, int timeout) {
           this(path);
           setOwner(owner);
           setScope(scope);
           setTimeout(timeout);
       }
   
  +    /**
  +     * Method constructor.
  +     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
  +     */
  +    public LockMethod(String path, String refreshOpaqueToken, long timeout) {
  +        this(path, refreshOpaqueToken, (int) timeout);
  +    }
  +
  +
  +    /**
  +     * Method constructor.
  +     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
  +     */
  +    public LockMethod(String path, String owner, short scope, long timeout) {
  +        this(path, owner, scope, (int) timeout);
  +    }
   
       // ------------------------------------------------------------- Properties
   
  @@ -360,18 +377,36 @@
       }
   
   
  -    public long getTimeout() {
  +    /**
  +     * get the timeout value.
  +     * 
  +     * @return timeout
  +     */
  +    public int getTimeout() {
           return this.timeout;
       }
   
   
  -    public void setTimeout(long timeout) {
  +    /**
  +     * Set the timeout value.
  +     *
  +     * @return timeout
  +     */
  +    public void setTimeout(int timeout) {
           checkNotUsed();
           if (timeout < 0) {
               throw new IllegalArgumentException("invalid timeout value: " +
                                                      timeout);
           }
           this.timeout = timeout;
  +    }
  +
  +    /**
  +     * Set the timeout value.
  +     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
  +     */
  +    public void setTimeout(long timeout) {
  +        setTimeout((int) timeout);
       }
   
   
  
  
  
  1.3       +4 -4      jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Client.java	11 Jan 2002 13:29:41 -0000	1.2
  +++ Client.java	19 Mar 2002 21:54:51 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java,v 1.2 2002/01/11 13:29:41 dirkv Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/01/11 13:29:41 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Client.java,v 1.3 2002/03/19 21:54:51 jericho Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/03/19 21:54:51 $
    *
    * ====================================================================
    *
  @@ -1819,7 +1819,7 @@
               if (owner!=null) 
                   out.println("   owner: " + owner);
                   
  -            long timeout=locks[i].getTimeout();
  +            int timeout=locks[i].getTimeout();
               if (timeout!=-1)
                   out.println("   timeout: " + timeout);
               
  
  
  
  1.12      +6 -6      jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java
  
  Index: LockDiscoveryProperty.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LockDiscoveryProperty.java	12 Oct 2001 20:37:44 -0000	1.11
  +++ LockDiscoveryProperty.java	19 Mar 2002 21:54:52 -0000	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v 1.11 2001/10/12 20:37:44 dirkv Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/10/12 20:37:44 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v 1.12 2002/03/19 21:54:52 jericho Exp $
  + * $Revision: 1.12 $
  + * $Date: 2002/03/19 21:54:52 $
    *
    * ====================================================================
    *
  @@ -89,7 +89,7 @@
    * @author <a href="mailto:jericho@thinkfree.com">Park, Sung-Gu</a>
    * @author Remy Maucherat
    * @author Dirk Verbeeck
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public class LockDiscoveryProperty extends BaseProperty {
   
  @@ -204,14 +204,14 @@
           child = DOMUtils.getFirstElement(element, "DAV:", "owner");
           owner = DOMUtils.getTextValue(child);
   
  -        long t = -1;
  +        int t = -1;
           child = DOMUtils.getFirstElement(element, "DAV:", "timeout");
           if (child != null) {
               String timeout = DOMUtils.getTextValue(child);
               int at = timeout.indexOf('-');
               if (at > 0) {
                   try {
  -                    t = Long.parseLong(timeout.substring(at + 1));
  +                    t = Integer.parseInt(timeout.substring(at + 1));
                   } catch (NumberFormatException e) {
                   }
               }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>