01 /*
02 * InfoHandler.java
03 * Copyright (c) 1998-2008, The University of Sheffield.
04 *
05 * This code is from the GATE project (http://gate.ac.uk/) and is free
06 * software licenced under the GNU General Public License version 3. It is
07 * distributed without any warranty. For more details see COPYING.txt in the
08 * top level directory (or at http://gatewiki.sf.net/COPYING.txt).
09 *
10 * Hamish Cunningham 8th January 2007
11 *
12 * Based on example code from SVNKit in the
13 * org.tmatesoft.svn.examples.wc
14 * package. Thanks TMate Software Ltd.
15 */
16 package gate.versioning.svnkit;
17
18 import org.tmatesoft.svn.core.SVNNodeKind;
19 import org.tmatesoft.svn.core.wc.ISVNInfoHandler;
20 import org.tmatesoft.svn.core.wc.SVNInfo;
21
22 import org.apache.log4j.Logger;
23
24 /*
25 * An implementation of ISVNInfoHandler that is used in Sandbox.java to display
26 * info on a working copy path. This implementation is passed to
27 *
28 * SVNWCClient.doInfo(File path, SVNRevision revision, boolean recursive,
29 * ISVNInfoHandler handler)
30 *
31 * For each item to be processed doInfo(..) collects information and creates an
32 * SVNInfo which keeps that information. Then doInfo(..) calls implementor's
33 * handler.handleInfo(SVNInfo) where it passes the gathered info.
34 */
35 public class InfoHandler implements ISVNInfoHandler {
36 /** Logger. */
37 static Logger lgr = Logger.getLogger(InfoHandler.class);
38
39 /*
40 * This is an implementation of ISVNInfoHandler.handleInfo(SVNInfo info). Just
41 * prints out information on a Working Copy path in the manner of the native
42 * SVN command line client.
43 */
44 public void handleInfo(SVNInfo info) {
45 lgr.info("-----------------INFO-----------------");
46 lgr.info("Local Path: " + info.getFile().getPath());
47 lgr.info("URL: " + info.getURL());
48 if(info.isRemote() && info.getRepositoryRootURL() != null) {
49 lgr.info("Repository Root URL: " + info.getRepositoryRootURL());
50 }
51 if(info.getRepositoryUUID() != null) {
52 lgr.info("Repository UUID: " + info.getRepositoryUUID());
53 }
54 lgr.info("Revision: " + info.getRevision().getNumber());
55 lgr.info("Node Kind: " + info.getKind().toString());
56 if(!info.isRemote()) {
57 lgr.info("Schedule: "
58 + (info.getSchedule() != null ? info.getSchedule() : "normal"));
59 }
60 lgr.info("Last Changed Author: " + info.getAuthor());
61 lgr.info("Last Changed Revision: "
62 + info.getCommittedRevision().getNumber());
63 lgr.info("Last Changed Date: " + info.getCommittedDate());
64 if(info.getPropTime() != null) {
65 lgr.info("Properties Last Updated: " + info.getPropTime());
66 }
67 if(info.getKind() == SVNNodeKind.FILE && info.getChecksum() != null) {
68 if(info.getTextTime() != null) {
69 lgr.info("Text Last Updated: " + info.getTextTime());
70 }
71 lgr.info("Checksum: " + info.getChecksum());
72 }
73 if(info.getLock() != null) {
74 if(info.getLock().getID() != null) {
75 lgr.info("Lock Token: " + info.getLock().getID());
76 }
77 lgr.info("Lock Owner: " + info.getLock().getOwner());
78 lgr.info("Lock Created: " + info.getLock().getCreationDate());
79 if(info.getLock().getExpirationDate() != null) {
80 lgr.info("Lock Expires: "
81 + info.getLock().getExpirationDate());
82 }
83 if(info.getLock().getComment() != null) {
84 lgr.info("Lock Comment: " + info.getLock().getComment());
85 }
86 }
87 }
88 }
|