1 /* 2 * $Id: Lock.java,v 1.2 2004/07/24 00:16:22 benjmestrallet Exp $ 3 * 4 * Copyright 2002-2004 Day Management AG, Switzerland. 5 * 6 * Licensed under the Day RI License, Version 2.0 (the "License"), 7 * as a reference implementation of the following specification: 8 * 9 * Content Repository API for Java Technology, revision 0.12 10 * <http://www.jcp.org/en/jsr/detail?id=170> 11 * 12 * You may not use this file except in compliance with the License. 13 * You may obtain a copy of the License files at 14 * 15 * http://www.day.com/content/en/licenses/day-ri-license-2.0 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 */ 24 package javax.jcr.lock; 25 26 import javax.jcr.Item; 27 28 29 /** 30 * Represents a lock placed on an item. 31 * <p/> 32 * <b>Level 2 only</b> 33 * <p/> 34 * A lock is associated with an item and a user (not a ticket) 35 * 36 * @author Peeter Piegaze 37 */ 38 public interface Lock { 39 40 /** 41 * Returns the user ID of the user who has this lock. 42 * 43 * @return a user ID. 44 */ 45 public String getOwner(); 46 47 /** 48 * Returns the type of this lock. This standard specifies only one 49 * type of lock: <code>LockType.WRITE_LOCK</code> though more can be 50 * supported by a specific JCR implementation. 51 * 52 * @return the type of this lock. 53 * @see LockCapabilities#getSupportedLockTypes 54 * @see LockType 55 */ 56 public int getType(); 57 58 /** 59 * Returns <code>true</code> if this lock is a shared lock. 60 * 61 * @return <code>true</code> if this is a shered lock, <code>false</code> 62 * otherwise. 63 */ 64 public boolean isShared(); 65 66 /** 67 * Returns the locked item. 68 * 69 * @return an <code>Item</code>. 70 */ 71 public Item getItem(); 72 } 73