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 re...@apache.org on 2001/05/16 02:41:24 UTC

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

remm        01/05/15 17:41:24

  Added:       src/webdav/client/src/org/apache/webdav/lib Lock.java
  Log:
  - Add a new Lock object.
  
  Revision  Changes    Path
  1.1                  jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Lock.java
  
  Index: Lock.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Lock.java,v 1.1 2001/05/16 00:41:21 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2001/05/16 00:41:21 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.webdav.lib;
  
  /**
   * This class represents a lock on a resource.
   *  <!ELEMENT activelock (lockscope, locktype, depth, owner?, timeout?,
   * locktoken?) >
   *
   * @author <a href="mailto:jericho@thinkfree.com">Park, Sung-Gu</a>
   * @version $Revision: 1.1 $
   */
  public class Lock {
  
  
      // -------------------------------------------------------------- Constants
  
  
      /**
       * The property name.
       */
      public static final String TAG_NAME = "activelock";
  
  
      /**
       * The write constant in the locktype.
       */
      public static final int TYPE_WRITE = 0;
  
  
      /**
       * The exclusive constant in the lockscope.
       */
      public static final int SCOPE_EXCLUSIVE = 0;
  
  
      /**
       * The shared constant in the lockscope.
       */
      public static final int SCOPE_SHARED = 1;
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Default constructor for the lock.
       */
      public Lock(int lockScope, int lockType, int depth, String owner, 
                  long timeout, String lockToken) {
          this.lockScope = lockScope;
          this.lockType = lockType;
          this.depth = depth;
          this.owner = owner;
          this.timeout = timeout;
          this.lockToken = lockToken;
      }
  
  
      // ------------------------------------------------------ Instance Variable
  
  
      protected int lockScope = -1;
  
  
      protected int lockType = -1;
  
  
      protected int depth = -1;
  
  
      protected String owner = null;
  
  
      protected long timeout = -1;
  
  
      protected String lockToken = null;
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Get whether a lock is an exclusive lock, or a shared lock.
       *
       * @return The lock scope.  If it's not set, it could be -1.
       */
      public int getLockScope() {
          return lockScope;
      }
  
  
      /**
       * Get the access type of a lock.
       *
       * @return The lock type. If it's not set, it could be -1.
       */
      public int getLockType() {
          return lockType;
      }
  
  
      /**
       * Get the value of the depth.
       *
       * @return The depth vlaue. If it's not set, it could be -1.
       */
      public int getDepth() {
          return depth;
      }
      
  
      /**
       * Get information about the principal taking out a lock.
       *
       * @return The owner.
       */
      public String getOwner() {
          return owner;
      }
  
  
      /**
       * Get the timeout associated with a lock.
       *
       * @return The timeout vlaue. If it's not set, it could be -1.
       */
      public long getTimeout() {
          return timeout;
      }
  
  
      /**
       * Get the access type of a lock.
       *
       * @return The lock token.
       */
      public String getLockToken() {
          return lockToken;
      }
  
  
  }