Source Code Cross Referenced for CmsRepositoryLockInfo.java in  » Content-Management-System » opencms » org » opencms » repository » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » opencms » org.opencms.repository 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/repository/CmsRepositoryLockInfo.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:47 $
004:         * Version: $Revision: 1.5 $
005:         *
006:         * This library is part of OpenCms -
007:         * the Open Source Content Management System
008:         *
009:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010:         *
011:         * This library is free software; you can redistribute it and/or
012:         * modify it under the terms of the GNU Lesser General Public
013:         * License as published by the Free Software Foundation; either
014:         * version 2.1 of the License, or (at your option) any later version.
015:         *
016:         * This library is distributed in the hope that it will be useful,
017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019:         * Lesser General Public License for more details.
020:         *
021:         * For further information about Alkacon Software GmbH, please see the
022:         * company website: http://www.alkacon.com
023:         *
024:         * For further information about OpenCms, please see the
025:         * project website: http://www.opencms.org
026:         * 
027:         * You should have received a copy of the GNU Lesser General Public
028:         * License along with this library; if not, write to the Free Software
029:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030:         */
031:
032:        package org.opencms.repository;
033:
034:        import java.util.Date;
035:
036:        /**
037:         * The class represents a lock to a {@link I_CmsRepositoryItem}.<p>
038:         * 
039:         * @author Peter Bonrad
040:         * 
041:         * @version $Revision: 1.5 $
042:         * 
043:         * @since 6.2.4
044:         */
045:        public class CmsRepositoryLockInfo {
046:
047:            /** The lock scope "exclusive". */
048:            public static final String SCOPE_EXCLUSIVE = "exclusive";
049:
050:            /** The default scope for locks. */
051:            public static final String DEFAULT_SCOPE = SCOPE_EXCLUSIVE;
052:
053:            /** Infinite timeout for the lock. */
054:            public static final int TIMEOUT_INFINITE_VALUE = -1;
055:
056:            /** The lock type "write". */
057:            public static final String TYPE_WRITE = "write";
058:
059:            /** The default type for locks. */
060:            public static final String DEFAULT_TYPE = TYPE_WRITE;
061:
062:            /** Default depth is infinite. */
063:            public static final int DEPTH_INFINITY_VALUE = 3; // To limit tree browsing a bit
064:
065:            /** The lock scope "shared". */
066:            public static final String SCOPE_SHARED = "shared";
067:
068:            /** The creation date of the lock. */
069:            private Date m_creationDate = new Date();
070:
071:            /** The depth the lock is valid for (0 for the resource or "Infinity" for inheriting). */
072:            private int m_depth = 0;
073:
074:            /** The time when the lock expires. */
075:            private long m_expiresAt = TIMEOUT_INFINITE_VALUE;
076:
077:            /** The owner of the lock. */
078:            private String m_owner = "";
079:
080:            /** The path of the resource item the lock belongs to. */
081:            private String m_path = "/";
082:
083:            /** The scope of the lock (shared or exclusive). */
084:            private String m_scope = DEFAULT_SCOPE;
085:
086:            /** The type of the lock (write or read). */
087:            private String m_type = DEFAULT_TYPE;
088:
089:            /** The login name of the current user. */
090:            private String m_username = "";
091:
092:            /**
093:             * Empty default constructor.<p>
094:             */
095:            public CmsRepositoryLockInfo() {
096:
097:                // empty default constructor
098:            }
099:
100:            /**
101:             * Returns the creationDate.<p>
102:             *
103:             * @return the creationDate
104:             */
105:            public Date getCreationDate() {
106:
107:                return m_creationDate;
108:            }
109:
110:            /**
111:             * Returns the depth.<p>
112:             *
113:             * @return the depth
114:             */
115:            public int getDepth() {
116:
117:                return m_depth;
118:            }
119:
120:            /**
121:             * Returns the expiresAt.<p>
122:             *
123:             * @return the expiresAt
124:             */
125:            public long getExpiresAt() {
126:
127:                return m_expiresAt;
128:            }
129:
130:            /**
131:             * Returns the owner.<p>
132:             *
133:             * @return the owner
134:             */
135:            public String getOwner() {
136:
137:                return m_owner;
138:            }
139:
140:            /**
141:             * Returns the path.<p>
142:             *
143:             * @return the path
144:             */
145:            public String getPath() {
146:
147:                return m_path;
148:            }
149:
150:            /**
151:             * Returns the scope.<p>
152:             *
153:             * @return the scope
154:             */
155:            public String getScope() {
156:
157:                return m_scope;
158:            }
159:
160:            /**
161:             * Returns the type.<p>
162:             *
163:             * @return the type
164:             */
165:            public String getType() {
166:
167:                return m_type;
168:            }
169:
170:            /**
171:             * Returns the username.<p>
172:             *
173:             * @return the username
174:             */
175:            public String getUsername() {
176:
177:                return m_username;
178:            }
179:
180:            /**
181:             * Return true if the lock has expired.
182:             * 
183:             * @return true if the lock has expired
184:             */
185:            public boolean hasExpired() {
186:
187:                return (System.currentTimeMillis() > m_expiresAt);
188:            }
189:
190:            /**
191:             * Return true if the lock is exclusive.
192:             * 
193:             * @return true if the lock is exclusive
194:             */
195:            public boolean isExclusive() {
196:
197:                return (m_scope.equals("exclusive"));
198:
199:            }
200:
201:            /**
202:             * Sets the depth.<p>
203:             *
204:             * @param depth the depth to set
205:             */
206:            public void setDepth(int depth) {
207:
208:                m_depth = depth;
209:            }
210:
211:            /**
212:             * Sets the expiresAt.<p>
213:             *
214:             * @param expiresAt the expiresAt to set
215:             */
216:            public void setExpiresAt(long expiresAt) {
217:
218:                m_expiresAt = expiresAt;
219:            }
220:
221:            /**
222:             * Sets the owner.<p>
223:             *
224:             * @param owner the owner to set
225:             */
226:            public void setOwner(String owner) {
227:
228:                m_owner = owner;
229:            }
230:
231:            /**
232:             * Sets the path.<p>
233:             *
234:             * @param path the path to set
235:             */
236:            public void setPath(String path) {
237:
238:                m_path = path;
239:            }
240:
241:            /**
242:             * Sets the scope.<p>
243:             *
244:             * @param scope the scope to set
245:             */
246:            public void setScope(String scope) {
247:
248:                m_scope = scope;
249:            }
250:
251:            /**
252:             * Sets the type.<p>
253:             *
254:             * @param type the type to set
255:             */
256:            public void setType(String type) {
257:
258:                m_type = type;
259:            }
260:
261:            /**
262:             * Sets the username.<p>
263:             *
264:             * @param username the username to set
265:             */
266:            public void setUsername(String username) {
267:
268:                m_username = username;
269:            }
270:
271:            /**
272:             * Get a string representation of this lock info.<p>
273:             * 
274:             * @return a string representation of this lock
275:             */
276:            public String toString() {
277:
278:                String result = "Type:" + m_type + "\n";
279:                result += "Scope:" + m_scope + "\n";
280:                result += "Depth:" + m_depth + "\n";
281:                result += "Owner:" + m_owner + "\n";
282:                result += "Expiration:" + new Date(m_expiresAt) + "\n";
283:
284:                return result;
285:            }
286:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.