001: /*
002: * Copyright (c) 2000, Jacob Smullyan.
003: *
004: * This is part of SkunkDAV, a WebDAV client. See http://skunkdav.sourceforge.net/
005: * for the latest version.
006: *
007: * SkunkDAV is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License as published
009: * by the Free Software Foundation; either version 2, or (at your option)
010: * any later version.
011: *
012: * SkunkDAV is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with SkunkDAV; see the file COPYING. If not, write to the Free
019: * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
020: * 02111-1307, USA.
021: */
022:
023: package org.skunk.dav.client;
024:
025: /**
026: * a struct that stores information pertaining to a lock.
027: */
028: public class Lock {
029: private LockScope lockScope;
030: private LockType lockType;
031: private Depth depth;
032: private Timeout timeout;
033: private String lockToken;
034: private String owner;
035:
036: public Lock(LockScope lockScope, LockType lockType, Depth depth,
037: Timeout timeout, String lockToken, String owner) {
038: this .lockScope = lockScope;
039: this .lockType = lockType;
040: this .depth = depth;
041: this .timeout = timeout;
042: this .lockToken = lockToken;
043: this .owner = owner;
044: }
045:
046: public Lock(LockScope lockScope, LockType lockType) {
047: this (lockScope, lockType, null, null, null, null);
048: }
049:
050: public LockScope getLockScope() {
051: return lockScope;
052: }
053:
054: public LockType getLockType() {
055: return lockType;
056: }
057:
058: public Depth getDepth() {
059: return depth;
060: }
061:
062: public Timeout getTimeout() {
063: return timeout;
064: }
065:
066: public String getLockToken() {
067: return lockToken;
068: }
069:
070: public String getOwner() {
071: return owner;
072: }
073:
074: public String toString() {
075: StringBuffer sb = new StringBuffer("Lock [scope=");
076: sb.append(lockScope);
077: sb.append(", type=");
078: sb.append(lockType);
079: if (depth != null) {
080: sb.append(", depth=");
081: sb.append(depth);
082: }
083: if (timeout != null) {
084: sb.append(", timeout=");
085: sb.append(timeout);
086: }
087: if (lockToken != null) {
088: sb.append(", lockToken=");
089: sb.append(lockToken);
090: }
091: if (owner != null) {
092: sb.append(", owner=");
093: sb.append(owner);
094: }
095: sb.append(']');
096: return sb.toString();
097: }
098:
099: }
100:
101: /* $Log: Lock.java,v $
102: /* Revision 1.5 2000/12/19 22:06:15 smulloni
103: /* adding documentation.
104: /*
105: /* Revision 1.4 2000/12/03 23:53:25 smulloni
106: /* added license and copyright preamble to java files.
107: /*
108: /* Revision 1.3 2000/11/09 23:34:53 smullyan
109: /* log added to every Java file, with the help of python. Lock stealing
110: /* implemented, and treatment of locks made more robust.
111: /* */
|