01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.repository;
17:
18: import org.outerx.daisy.x10.LockInfoDocument;
19:
20: import java.util.Date;
21:
22: /**
23: * Provides information about a lock on a document variant.
24: *
25: * <p>If the method {@link #hasLock()} returns false, there is no lock
26: * on the document and the output of the other methods is irrelevant and
27: * unspecified.
28: *
29: * <p>Note that so called "optimistic locking" always happens automatically,
30: * next to this explicit locking facility.
31: */
32: public interface LockInfo {
33: boolean hasLock();
34:
35: /**
36: * Get the id of the user holding the lock.
37: */
38: long getUserId();
39:
40: /**
41: * Get the time when the lock was acquired.
42: */
43: Date getTimeAcquired();
44:
45: /**
46: * Gets the duration of the lock, in milliseconds. This is the
47: * total duration, to be counted from the time this lock was
48: * acquired, NOT the remaining duration. This can be -1, meaning
49: * the lock does never expire.
50: */
51: long getDuration();
52:
53: /**
54: * Get the type of lock. See {@link Document#lock(long, LockType)} for
55: * more info on the type of locks.
56: */
57: LockType getType();
58:
59: /**
60: * Get an XML document describing this lock.
61: */
62: LockInfoDocument getXml();
63: }
|