Source Code Cross Referenced for SVNInfo.java in  » Source-Control » tmatesoft-SVN » org » tmatesoft » svn » core » wc » 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.wc 
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:        package org.tmatesoft.svn.core.wc;
013:
014:        import java.io.File;
015:        import java.util.Date;
016:
017:        import org.tmatesoft.svn.core.SVNDirEntry;
018:        import org.tmatesoft.svn.core.SVNException;
019:        import org.tmatesoft.svn.core.SVNLock;
020:        import org.tmatesoft.svn.core.SVNNodeKind;
021:        import org.tmatesoft.svn.core.SVNURL;
022:        import org.tmatesoft.svn.core.internal.util.SVNTimeUtil;
023:        import org.tmatesoft.svn.core.internal.wc.admin.SVNEntry;
024:
025:        /**
026:         * The <b>SVNInfo</b> class is a wrapper for versioned item's (located either
027:         * in a Working Copy or a repository) information details. When running an 
028:         * info operation invoking a doInfo() method of the <b>SVNWCClient</b> class
029:         * all collected item information data is packed inside an <b>SVNInfo</b> object
030:         * and depending on the exact doInfo() method being in use is either dispatched to
031:         * an implementation of <b>ISVNInfoHandler</b> or just returned by the method (per
032:         * single item info operation).
033:         * 
034:         * <p>
035:         * There are two approaches how to process <b>SVNInfo</b> objects:<br />
036:         * 1. Implementing an <b>ISVNInfoHandler</b>:
037:         * <pre class="javacode">
038:         * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.ISVNInfoHandler;
039:         * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.SVNInfo;
040:         * ...
041:         * 
042:         * <span class="javakeyword">public class</span> MyCustomInfoHandler <span class="javakeyword">implements</span> ISVNInfoHandler {
043:         *     <span class="javakeyword">public void</span> handleInfo(SVNInfo info) {
044:         *         <span class="javacomment">//parsing info here</span> 
045:         *         ...
046:         *     }
047:         * }</pre><br />
048:         * ...and providing an info handler implementation to an <b>SVNWCClient</b>'s 
049:         * doInfo() method:
050:         * <pre class="javacode">
051:         * ...
052:         * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.SVNWCClient;
053:         * ...
054:         * 
055:         * SVNWCClient wcClient;
056:         * ...
057:         * 
058:         * wcClient.doInfo(...., <span class="javakeyword">new</span> MyCustomInfoHandler());
059:         * ...</pre><br />
060:         * 2. Or process an <b>SVNInfo</b> like this:
061:         * <pre class="javacode">
062:         * ...
063:         * SVNInfo info = wcClient.doInfo(<span class="javakeyword">new</span> File(myPath), SVNRevision.WORKING);
064:         * <span class="javacomment">//parsing info here</span>
065:         * ...</pre>
066:         * </p> 
067:         * 
068:         * @version 1.1.1
069:         * @author  TMate Software Ltd.
070:         * @see     ISVNInfoHandler
071:         * @see     SVNWCClient
072:         * @see     <a target="_top" href="http://svnkit.com/kb/examples/">Examples</a>
073:         */
074:        public class SVNInfo {
075:
076:            private File myFile;
077:            private String myPath;
078:            private SVNURL myURL;
079:            private SVNRevision myRevision;
080:            private SVNNodeKind myKind;
081:            private SVNURL myRepositoryRootURL;
082:            private String myRepositoryUUID;
083:            private SVNRevision myCommittedRevision;
084:            private Date myCommittedDate;
085:            private String myAuthor;
086:            private SVNLock myLock;
087:            private boolean myIsRemote;
088:            private String mySchedule;
089:            private SVNURL myCopyFromURL;
090:            private SVNRevision myCopyFromRevision;
091:            private Date myTextTime;
092:            private Date myPropTime;
093:            private String myChecksum;
094:            private File myConflictOldFile;
095:            private File myConflictNewFile;
096:            private File myConflictWrkFile;
097:            private File myPropConflictFile;
098:
099:            static SVNInfo createInfo(File file, SVNEntry entry)
100:                    throws SVNException {
101:                if (entry == null) {
102:                    return null;
103:                }
104:                SVNLock lock = null;
105:                if (entry.getLockToken() != null) {
106:                    lock = new SVNLock(null, entry.getLockToken(), entry
107:                            .getLockOwner(), entry.getLockComment(),
108:                            SVNTimeUtil.parseDate(entry.getLockCreationDate()),
109:                            null);
110:                }
111:                return new SVNInfo(file, entry.getSVNURL(), entry
112:                        .getRepositoryRootURL(), entry.getRevision(), entry
113:                        .getKind(), entry.getUUID(), entry
114:                        .getCommittedRevision(), entry.getCommittedDate(),
115:                        entry.getAuthor(), entry.getSchedule(), entry
116:                                .getCopyFromSVNURL(), entry
117:                                .getCopyFromRevision(), entry.getTextTime(),
118:                        entry.getPropTime(), entry.getChecksum(), entry
119:                                .getConflictOld(), entry.getConflictNew(),
120:                        entry.getConflictWorking(), entry.getPropRejectFile(),
121:                        lock);
122:            }
123:
124:            static SVNInfo createInfo(String path, SVNURL reposRootURL,
125:                    String uuid, SVNURL url, SVNRevision revision,
126:                    SVNDirEntry dirEntry, SVNLock lock) {
127:                if (dirEntry == null) {
128:                    return null;
129:                }
130:                return new SVNInfo(path, url, revision, dirEntry.getKind(),
131:                        uuid, reposRootURL, dirEntry.getRevision(), dirEntry
132:                                .getDate(), dirEntry.getAuthor(), lock);
133:            }
134:
135:            protected SVNInfo(File file, SVNURL url, SVNURL rootURL,
136:                    long revision, SVNNodeKind kind, String uuid,
137:                    long committedRevision, String committedDate,
138:                    String author, String schedule, SVNURL copyFromURL,
139:                    long copyFromRevision, String textTime, String propTime,
140:                    String checksum, String conflictOld, String conflictNew,
141:                    String conflictWorking, String propRejectFile, SVNLock lock) {
142:                myFile = file;
143:                myURL = url;
144:                myRevision = SVNRevision.create(revision);
145:                myKind = kind;
146:                myRepositoryUUID = uuid;
147:                myRepositoryRootURL = rootURL;
148:
149:                myCommittedRevision = SVNRevision.create(committedRevision);
150:                myCommittedDate = committedDate != null ? SVNTimeUtil
151:                        .parseDate(committedDate) : null;
152:                myAuthor = author;
153:
154:                mySchedule = schedule;
155:                myChecksum = checksum;
156:                myTextTime = textTime != null ? SVNTimeUtil.parseDate(textTime)
157:                        : null;
158:                myPropTime = propTime != null ? SVNTimeUtil.parseDate(propTime)
159:                        : null;
160:
161:                myCopyFromURL = copyFromURL;
162:                myCopyFromRevision = SVNRevision.create(copyFromRevision);
163:
164:                myLock = lock;
165:
166:                if (file != null) {
167:                    if (conflictOld != null) {
168:                        myConflictOldFile = new File(file.getParentFile(),
169:                                conflictOld);
170:                    }
171:                    if (conflictNew != null) {
172:                        myConflictNewFile = new File(file.getParentFile(),
173:                                conflictNew);
174:                    }
175:                    if (conflictWorking != null) {
176:                        myConflictWrkFile = new File(file.getParentFile(),
177:                                conflictWorking);
178:                    }
179:                    if (propRejectFile != null) {
180:                        myPropConflictFile = new File(file.getParentFile(),
181:                                propRejectFile);
182:                    }
183:                }
184:
185:                myIsRemote = false;
186:            }
187:
188:            protected SVNInfo(String path, SVNURL url, SVNRevision revision,
189:                    SVNNodeKind kind, String uuid, SVNURL reposRootURL,
190:                    long comittedRevision, Date date, String author,
191:                    SVNLock lock) {
192:                myIsRemote = true;
193:                myURL = url;
194:                myRevision = revision;
195:                myKind = kind;
196:                myRepositoryRootURL = reposRootURL;
197:                myRepositoryUUID = uuid;
198:
199:                myCommittedDate = date;
200:                myCommittedRevision = SVNRevision.create(comittedRevision);
201:                myAuthor = author;
202:
203:                myLock = lock;
204:                myPath = path;
205:            }
206:
207:            /**
208:             * Gets the item's last commit author. This is the value of the item's 
209:             * {@link org.tmatesoft.svn.core.SVNProperty#LAST_AUTHOR} property.
210:             * 
211:             * @return the author who last changed (committed) the item 
212:             */
213:            public String getAuthor() {
214:                return myAuthor;
215:            }
216:
217:            /**
218:             * Gets the file item's checksum. This is the value of the file item's
219:             * {@link org.tmatesoft.svn.core.SVNProperty#CHECKSUM} property. 
220:             * 
221:             * @return the file item's checksum
222:             */
223:            public String getChecksum() {
224:                return myChecksum;
225:            }
226:
227:            /**
228:             * Gets the item's last commit date. This is the value of the item's
229:             * {@link org.tmatesoft.svn.core.SVNProperty#COMMITTED_DATE}
230:             * property. 
231:             * 
232:             * @return the item's last commit date
233:             */
234:            public Date getCommittedDate() {
235:                return myCommittedDate;
236:            }
237:
238:            /**
239:             * Gets the item's last committed revision. This is the value of the item's
240:             * {@link org.tmatesoft.svn.core.SVNProperty#COMMITTED_REVISION} property. 
241:             * 
242:             * @return the item's last committed revision.
243:             */
244:            public SVNRevision getCommittedRevision() {
245:                return myCommittedRevision;
246:            }
247:
248:            /**
249:             * Gets the temporary file that contains all latest changes from the 
250:             * repository which led to a conflict with local changes. This file is
251:             * at the HEAD revision.
252:             * 
253:             * <p>
254:             * Taken from the item's {@link org.tmatesoft.svn.core.SVNProperty#CONFLICT_NEW}
255:             * property.
256:             * 
257:             * @return  an autogenerated temporary file just as it is in the latest 
258:             *          revision in the repository 
259:             */
260:            public File getConflictNewFile() {
261:                return myConflictNewFile;
262:            }
263:
264:            /**
265:             * Gets the temporary BASE revision file of that working file that is
266:             * currently in conflict with changes received from the repository. This
267:             * file does not contain the latest user's modifications, only 'pristine'
268:             * contents.  
269:             * 
270:             * <p>
271:             * Taken from the item's {@link org.tmatesoft.svn.core.SVNProperty#CONFLICT_OLD}
272:             * property.
273:             * 
274:             * @return an autogenerated temporary file just as the conflicting file was
275:             *         before any modifications to it
276:             */
277:            public File getConflictOldFile() {
278:                return myConflictOldFile;
279:            }
280:
281:            /**
282:             * Gets the temporary <i>'.mine'</i> file with all current local changes to the 
283:             * original file. That is if the file item is in conflict with changes that 
284:             * came during an update this temporary file is created to get the snapshot
285:             * of the user's file with only the user's local modifications and nothing 
286:             * more.  
287:             * 
288:             * <p>
289:             * Taken from the item's {@link org.tmatesoft.svn.core.SVNProperty#CONFLICT_WRK}
290:             * property.
291:             * 
292:             * @return an autogenerated temporary file with only the user's modifications 
293:             */
294:            public File getConflictWrkFile() {
295:                return myConflictWrkFile;
296:            }
297:
298:            /**
299:             * Gets the revision of the item's ancestor from which the item was 
300:             * copied.
301:             * 
302:             * @return the ancestor's revision (taken from the 
303:             *         {@link org.tmatesoft.svn.core.SVNProperty#COPYFROM_REVISION} property)
304:             */
305:            public SVNRevision getCopyFromRevision() {
306:                return myCopyFromRevision;
307:            }
308:
309:            /**
310:             * Gets the URL (repository location) of the ancestor from which the
311:             * item was copied.
312:             * 
313:             * @return the item ancestor's URL (taken from the 
314:             *         {@link org.tmatesoft.svn.core.SVNProperty#COPYFROM_URL} property)
315:             */
316:            public SVNURL getCopyFromURL() {
317:                return myCopyFromURL;
318:            }
319:
320:            /**
321:             * Gets the item's local path. Applicable for local info operation 
322:             * invocations, however if an info operation is invoked for remote 
323:             * items, use {@link #getPath()} instead. 
324:             * 
325:             * @return  the item's local path
326:             */
327:            public File getFile() {
328:                return myFile;
329:            }
330:
331:            /**
332:             * Finds out whether the item for which this <b>SVNInfo</b> is generated
333:             * is local (located in a user's Working Copy) or remote (located in a 
334:             * repository). It depends on the type of an info operation to perform - 
335:             * that is on an {@link SVNWCClient}'s doInfo() method to use. Also
336:             * applicability of some methods of the <b>SVNInfo</b> class depends
337:             * on the item's location that can be determined calling this method.   
338:             *  
339:             * @return <span class="javakeyword">true</span> if the item is located
340:             *         in a repository, otherwise <span class="javakeyword">false</span>
341:             *         and the item is in a Working Copy
342:             */
343:            public boolean isRemote() {
344:                return myIsRemote;
345:            }
346:
347:            /**
348:             * Gets the item's node kind. Used to find out whether the item is
349:             * a file, directory, etc. 
350:             * 
351:             * @return  the item's node kind
352:             */
353:            public SVNNodeKind getKind() {
354:                return myKind;
355:            }
356:
357:            /**
358:             * Gets the file item's lock. Used to get lock information - lock 
359:             * token, comment, etc. 
360:             * 
361:             * @return the file item's lock.
362:             */
363:            public SVNLock getLock() {
364:                return myLock;
365:            }
366:
367:            /**
368:             * Gets the item's path (relative to the repository root). Applicable for 
369:             * remote info operation invocations, however if an info operation is 
370:             * invoked for Working Copy items, use {@link #getFile()} instead. 
371:             * 
372:             * @return  the item's path in the repository
373:             */
374:            public String getPath() {
375:                return myPath;
376:            }
377:
378:            /**
379:             * Gets the <i>'.prej'</i> file containing details on properties conflicts.
380:             * If the item's properties are in conflict with those that came
381:             * during an update this file will contain a conflict description. 
382:             * This is the value of the item's {@link org.tmatesoft.svn.core.SVNProperty#PROP_REJECT_FILE}
383:             * property.
384:             * 
385:             * @return  the properties conflicts file
386:             */
387:            public File getPropConflictFile() {
388:                return myPropConflictFile;
389:            }
390:
391:            /**
392:             * Gets the value of the item's
393:             * {@link org.tmatesoft.svn.core.SVNProperty#PROP_TIME} property.
394:             * It corresponds to the last time when properties were committed.
395:             * 
396:             * @return the value of the item's prop-time property  
397:             */
398:            public Date getPropTime() {
399:                return myPropTime;
400:            }
401:
402:            /**
403:             * Gets the repository root url (where the repository itself
404:             * is installed). Applicable only for remote info operation invocations 
405:             * (for items in a repository).
406:             * 
407:             * @return the repository's root URL
408:             */
409:            public SVNURL getRepositoryRootURL() {
410:                return myRepositoryRootURL;
411:            }
412:
413:            /**
414:             * Gets the repository Universal Unique IDentifier (UUID). This is the
415:             * value of the {@link org.tmatesoft.svn.core.SVNProperty#UUID} 
416:             * property.
417:             * 
418:             * @return the repository UUID
419:             */
420:            public String getRepositoryUUID() {
421:                return myRepositoryUUID;
422:            }
423:
424:            /**
425:             * Gets the item's revision.
426:             * 
427:             * @return the item's revision
428:             */
429:            public SVNRevision getRevision() {
430:                return myRevision;
431:            }
432:
433:            /**
434:             * Gets the item's schedule status. Schedule status is inapplicable
435:             * when running a remote info operation (for items in a repository).
436:             * If it's a local info operation and the return value is 
437:             * <span class="javakeyword">null</span> then it corresponds to the
438:             * SVN's <i>'normal'</i> schedule status. 
439:             * 
440:             * @return the item's schedule status
441:             */
442:            public String getSchedule() {
443:                return mySchedule;
444:            }
445:
446:            /**
447:             * Gets the value of the item's {@link org.tmatesoft.svn.core.SVNProperty#TEXT_TIME}
448:             * property. It corresponds to the last commit time. 
449:             * 
450:             * @return the value of the item's text-time property
451:             */
452:            public Date getTextTime() {
453:                return myTextTime;
454:            }
455:
456:            /**
457:             * Gets the item's URL - its repository location.
458:             * 
459:             * @return the item's URL
460:             */
461:            public SVNURL getURL() {
462:                return myURL;
463:            }
464:
465:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.