01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.data;
17:
18: /**
19: * A request for a Lock that last the duration of a transaction.
20: *
21: * <p>
22: * The single instance of this class is available as
23: * <code>FeatureLock.TRANSACTION</code>.
24: * </p>
25: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/data/CurrentTransactionLock.java $
26: */
27: class CurrentTransactionLock implements FeatureLock {
28: /**
29: * Transaction locks do not require Authorization.
30: *
31: * <p>
32: * Authorization is based on being on "holding" the Transaction rather than
33: * supplying an authorization id.
34: * </p>
35: *
36: * @return <code>CURRENT_TRANSACTION</code> to aid in debugging.
37: *
38: * @see org.geotools.data.FeatureLock#getAuthorization()
39: */
40: public String getAuthorization() {
41: return toString();
42: }
43:
44: /**
45: * Transaciton locks are not held for a duration.
46: *
47: * <p>
48: * Any locking performed against the current Transaction is expected to
49: * expire when the transaction finishes with a close or rollback
50: * </p>
51: *
52: * @return <code>-1</code> representing an invalid duration
53: *
54: * @see org.geotools.data.FeatureLock#getDuration()
55: */
56: public long getDuration() {
57: return -1;
58: }
59:
60: public String toString() {
61: return "CURRENT_TRANSACTION";
62: }
63: }
|