Source Code Cross Referenced for SVNDirEntry.java in  » Source-Control » tmatesoft-SVN » org » tmatesoft » svn » core » 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 » Source Control » tmatesoft SVN » org.tmatesoft.svn.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ====================================================================
003:         * Copyright (c) 2004-2008 TMate Software Ltd.  All rights reserved.
004:         *
005:         * This software is licensed as described in the file COPYING, which
006:         * you should have received as part of this distribution.  The terms
007:         * are also available at http://svnkit.com/license.html
008:         * If newer versions of this license are posted there, you may use a
009:         * newer version instead, at your option.
010:         * ====================================================================
011:         */
012:
013:        package org.tmatesoft.svn.core;
014:
015:        import java.util.Date;
016:
017:        /**
018:         * The <b>SVNDirEntry</b> class is a representation of a versioned 
019:         * directory entry.
020:         * 
021:         * <p>
022:         * <b>SVNDirEntry</b> keeps an entry name, entry kind (is it a file or directory), 
023:         * file size (in case an entry is a file), the last changed revision, the date when 
024:         * the entry was last changed, the name of the author who last changed the entry, the
025:         * commit log message for the last changed revision. <b>SVNDirEntry</b> also knows 
026:         * if the entry has any properties. 
027:         * 
028:         * @version 1.1.1
029:         * @author  TMate Software Ltd.
030:         * @see 	ISVNDirEntryHandler
031:         */
032:        public class SVNDirEntry implements  Comparable {
033:
034:            private String myName;
035:            private SVNNodeKind myKind;
036:            private long mySize;
037:            private boolean myHasProperties;
038:            private long myRevision;
039:            private Date myCreatedDate;
040:            private String myLastAuthor;
041:            private String myPath;
042:            private String myCommitMessage;
043:            private SVNLock myLock;
044:            private SVNURL myURL;
045:
046:            /**
047:             * Constructs an instance of <b>SVNDirEntry</b>.
048:             * 
049:             * @param url           a url of this entry 
050:             * @param name 			an entry name
051:             * @param kind 			the node kind for the entry
052:             * @param size 			the entry size in bytes
053:             * @param hasProperties <span class="javakeyword">true</span> if the 
054:             *                      entry has properties, otherwise <span class="javakeyword">false</span>
055:             * @param revision      the last changed revision of the entry
056:             * @param createdDate 	the date the entry was last changed
057:             * @param lastAuthor 	the person who last changed the entry
058:             */
059:            public SVNDirEntry(SVNURL url, String name, SVNNodeKind kind,
060:                    long size, boolean hasProperties, long revision,
061:                    Date createdDate, String lastAuthor) {
062:                myURL = url;
063:                myName = name;
064:                myKind = kind;
065:                mySize = size;
066:                myHasProperties = hasProperties;
067:                myRevision = revision;
068:                myCreatedDate = createdDate;
069:                myLastAuthor = lastAuthor;
070:            }
071:
072:            /**
073:             * Returns the entry's URL.
074:             * 
075:             * @return this entry's URL.
076:             */
077:            public SVNURL getURL() {
078:                return myURL;
079:            }
080:
081:            /**
082:             * Constructs an instance of <b>SVNDirEntry</b>.
083:             * 
084:             * @param url           a url of this entry 
085:             * @param name          an entry name
086:             * @param kind          the node kind for the entry
087:             * @param size          the entry size in bytes
088:             * @param hasProperties <span class="javakeyword">true</span> if the 
089:             *                      entry has properties, otherwise <span class="javakeyword">false</span>
090:             * @param revision      the last changed revision of the entry
091:             * @param createdDate   the date the entry was last changed
092:             * @param lastAuthor    the person who last changed the entry
093:             * @param commitMessage the log message of the last change commit
094:             */
095:            public SVNDirEntry(SVNURL url, String name, SVNNodeKind kind,
096:                    long size, boolean hasProperties, long revision,
097:                    Date createdDate, String lastAuthor, String commitMessage) {
098:                myURL = url;
099:                myName = name;
100:                myKind = kind;
101:                mySize = size;
102:                myHasProperties = hasProperties;
103:                myRevision = revision;
104:                myCreatedDate = createdDate;
105:                myLastAuthor = lastAuthor;
106:                myCommitMessage = commitMessage;
107:            }
108:
109:            /**
110:             * Gets the the directory entry name
111:             * 
112:             * @return 	the name of this entry
113:             */
114:            public String getName() {
115:                return myName;
116:            }
117:
118:            /**
119:             * Returns the file size in bytes (if this entry is a file).
120:             *
121:             * @return  the size of this entry in bytes
122:             */
123:            public long getSize() {
124:                return mySize;
125:            }
126:
127:            /**
128:             * Returns the file size in bytes (if this entry is a file).
129:             *
130:             * @deprecated use {@link #getSize()} instead
131:             * @return 	the size of this entry in bytes
132:             */
133:            public long size() {
134:                return getSize();
135:            }
136:
137:            /**
138:             * Tells if the entry has any properties.
139:             * 
140:             * @return 	<span class="javakeyword">true</span> if has, 
141:             *          <span class="javakeyword">false</span> otherwise
142:             */
143:            public boolean hasProperties() {
144:                return myHasProperties;
145:            }
146:
147:            /**
148:             * Returns the entry node kind.
149:             * 
150:             * @return  the node kind of this entry 
151:             * @see 	SVNNodeKind
152:             */
153:            public SVNNodeKind getKind() {
154:                return myKind;
155:            }
156:
157:            /**
158:             * Returns the date the entry was last changed.
159:             * 
160:             * @return 	the datestamp when the entry was last changed
161:             */
162:            public Date getDate() {
163:                return myCreatedDate;
164:            }
165:
166:            /**
167:             * Gets the last changed revision of this entry.
168:             * 
169:             * @return 	the revision of this entry when it was last changed 
170:             */
171:            public long getRevision() {
172:                return myRevision;
173:            }
174:
175:            /**
176:             * Retrieves the name of the author who last changed this entry.
177:             * 
178:             * @return 	the last author's name.
179:             */
180:            public String getAuthor() {
181:                return myLastAuthor;
182:            }
183:
184:            /**
185:             * Returns the entry's path.
186:             * 
187:             * <p>
188:             * This method always returns the name of an entry (i.e. 
189:             * a path relative to the parent folder) when an <b>SVNDirEntry</b> 
190:             * object is provided by an {@link org.tmatesoft.svn.core.io.SVNRepository} 
191:             * driver.
192:             * 
193:             * <p>
194:             * This property (relative path) is longer than just an entry name only when 
195:             * an <b>SVNDirEntry</b> object is obtained via a recursive call to 
196:             * a <code>doList()</code> method of the {@link org.tmatesoft.svn.core.wc.SVNLogClient} class. 
197:             * In that case an <b>SVNDirEntry</b> object located deep in the hierarchy 
198:             * will return a path relative to the URL <code>doList()</code> was called for.
199:             * 
200:             * @return a path relative to a repository location or 
201:             *         <span class="javakeyword">null</span> if no path is
202:             *         specified
203:             */
204:            public String getRelativePath() {
205:                return myPath == null ? getName() : myPath;
206:            }
207:
208:            /**
209:             * @deprecated use {@link #getRelativePath()} instead.
210:             */
211:            public String getPath() {
212:                return getRelativePath();
213:            }
214:
215:            /**
216:             * Returns the commit log message for the revision of this entry.
217:             * 
218:             * @return a commit log message
219:             */
220:            public String getCommitMessage() {
221:                return myCommitMessage;
222:            }
223:
224:            /**
225:             * Gets the lock object for this entry (if it's locked).
226:             * 
227:             * @return a lock object or <span class="javakeyword">null</span>
228:             */
229:            public SVNLock getLock() {
230:                return myLock;
231:            }
232:
233:            /**
234:             * This method is used by SVNKit internals and not intended for users (from an API point of view).
235:             * 
236:             * @param path this entry's path
237:             */
238:            public void setRelativePath(String path) {
239:                myPath = path;
240:            }
241:
242:            /**
243:             * This method is used by SVNKit internals and not intended for users (from an API point of view).
244:             * 
245:             * @param message a commit message
246:             */
247:            public void setCommitMessage(String message) {
248:                myCommitMessage = message;
249:            }
250:
251:            /**
252:             * Sets the lock object for this entry (if it's locked).
253:             * 
254:             * @param lock a lock object
255:             */
256:            public void setLock(SVNLock lock) {
257:                myLock = lock;
258:            }
259:
260:            /**
261:             * Retirns a string representation of this object. 
262:             * 
263:             * @return 	a string representation of this directory entry
264:             */
265:            public String toString() {
266:                StringBuffer result = new StringBuffer();
267:                result.append("name=");
268:                result.append(myName);
269:                result.append(", kind=");
270:                result.append(myKind);
271:                result.append(", size=");
272:                result.append(mySize);
273:                result.append(", hasProps=");
274:                result.append(myHasProperties);
275:                result.append(", lastchangedrev=");
276:                result.append(myRevision);
277:                if (myLastAuthor != null) {
278:                    result.append(", lastauthor=");
279:                    result.append(myLastAuthor);
280:                }
281:                if (myCreatedDate != null) {
282:                    result.append(", lastchangeddate=");
283:                    result.append(myCreatedDate);
284:                }
285:                return result.toString();
286:            }
287:
288:            /**
289:             * Compares this object with another one.
290:             * 
291:             * @param   o an object to compare with
292:             * @return    <ul>
293:             *            <li>-1 - if <code>o</code> is either <span class="javakeyword">null</span>,
294:             *            or is not an instance of <b>SVNDirEntry</b>, or this entry's URL is lexicographically 
295:             *            less than the name of <code>o</code>; 
296:             *            </li>
297:             *            <li>1 - if this entry's URL is lexicographically greater than the name of <code>o</code>;
298:             *            </li>
299:             *            <li>0 - if and only if <code>o</code> has got the same URL as this one has
300:             *            </li>
301:             *            </ul>
302:             */
303:            public int compareTo(Object o) {
304:                if (o == null || o.getClass() != SVNDirEntry.class) {
305:                    return -1;
306:                }
307:                SVNNodeKind otherKind = ((SVNDirEntry) o).getKind();
308:                if (otherKind != getKind()) {
309:                    return getKind().compareTo(otherKind);
310:                }
311:                String otherURL = ((SVNDirEntry) o).getURL().toString();
312:                return myURL.toString().compareTo(otherURL);
313:            }
314:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.