KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > edit > AlreadyLockedException


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.modules.edit;
14
15 import com.openedit.OpenEditException;
16 import com.openedit.users.User;
17
18
19 /**
20  * This exception indicates that a client attempted to claim a lock that was already claimed by a
21  * different user.
22  *
23  * @author Eric Galluzzo
24  */

25 public class AlreadyLockedException extends OpenEditException
26 {
27     protected String JavaDoc fieldPath;
28     protected User fieldLockOwner;
29
30     /**
31      * Create a new exception denoting that the given path is already locked by the given user.
32      *
33      * @param inPath The path that the client attempted to lock
34      * @param inUser The user that has the path already locked
35      */

36     public AlreadyLockedException(String JavaDoc inPath, User inUser)
37     {
38         super("Path \"" + inPath + " \" is already locked by " + inUser.getUserName());
39         setPath(inPath);
40         setLockOwner(inUser);
41     }
42
43     /**
44      * Returns the owner of the existing lock.
45      *
46      * @return User
47      */

48     public User getLockOwner()
49     {
50         return fieldLockOwner;
51     }
52
53     /**
54      * Returns the path.
55      *
56      * @return String
57      */

58     public String JavaDoc getPath()
59     {
60         return fieldPath;
61     }
62
63     /**
64      * Sets the owner of the existing lock.
65      *
66      * @param lockOwner The {@link User} to set
67      */

68     protected void setLockOwner(User lockOwner)
69     {
70         fieldLockOwner = lockOwner;
71     }
72
73     /**
74      * Sets the path.
75      *
76      * @param path The path to set
77      */

78     protected void setPath(String JavaDoc path)
79     {
80         fieldPath = path;
81     }
82 }
83
Popular Tags