01: /*
02: * ====================================================================
03: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
04: *
05: * This software is licensed as described in the file COPYING, which
06: * you should have received as part of this distribution. The terms
07: * are also available at http://svnkit.com/license.html
08: * If newer versions of this license are posted there, you may use a
09: * newer version instead, at your option.
10: * ====================================================================
11: */
12: package org.tmatesoft.svn.examples.wc;
13:
14: import org.tmatesoft.svn.core.SVNNodeKind;
15: import org.tmatesoft.svn.core.wc.ISVNInfoHandler;
16: import org.tmatesoft.svn.core.wc.SVNInfo;
17:
18: /*
19: * An implementation of ISVNInfoHandler that is used in WorkingCopy.java to
20: * display info on a working copy path. This implementation is passed to
21: *
22: * SVNWCClient.doInfo(File path, SVNRevision revision, boolean recursive,
23: * ISVNInfoHandler handler)
24: *
25: * For each item to be processed doInfo(..) collects information and creates an
26: * SVNInfo which keeps that information. Then doInfo(..) calls implementor's
27: * handler.handleInfo(SVNInfo) where it passes the gathered info.
28: */
29: public class InfoHandler implements ISVNInfoHandler {
30: /*
31: * This is an implementation of ISVNInfoHandler.handleInfo(SVNInfo info).
32: * Just prints out information on a Working Copy path in the manner of the
33: * native SVN command line client.
34: */
35: public void handleInfo(SVNInfo info) {
36: System.out.println("-----------------INFO-----------------");
37: System.out.println("Local Path: " + info.getFile().getPath());
38: System.out.println("URL: " + info.getURL());
39: if (info.isRemote() && info.getRepositoryRootURL() != null) {
40: System.out.println("Repository Root URL: "
41: + info.getRepositoryRootURL());
42: }
43: if (info.getRepositoryUUID() != null) {
44: System.out.println("Repository UUID: "
45: + info.getRepositoryUUID());
46: }
47: System.out.println("Revision: "
48: + info.getRevision().getNumber());
49: System.out.println("Node Kind: " + info.getKind().toString());
50: if (!info.isRemote()) {
51: System.out.println("Schedule: "
52: + (info.getSchedule() != null ? info.getSchedule()
53: : "normal"));
54: }
55: System.out.println("Last Changed Author: " + info.getAuthor());
56: System.out.println("Last Changed Revision: "
57: + info.getCommittedRevision().getNumber());
58: System.out.println("Last Changed Date: "
59: + info.getCommittedDate());
60: if (info.getPropTime() != null) {
61: System.out.println("Properties Last Updated: "
62: + info.getPropTime());
63: }
64: if (info.getKind() == SVNNodeKind.FILE
65: && info.getChecksum() != null) {
66: if (info.getTextTime() != null) {
67: System.out.println("Text Last Updated: "
68: + info.getTextTime());
69: }
70: System.out.println("Checksum: " + info.getChecksum());
71: }
72: if (info.getLock() != null) {
73: if (info.getLock().getID() != null) {
74: System.out.println("Lock Token: "
75: + info.getLock().getID());
76: }
77: System.out.println("Lock Owner: "
78: + info.getLock().getOwner());
79: System.out.println("Lock Created: "
80: + info.getLock().getCreationDate());
81: if (info.getLock().getExpirationDate() != null) {
82: System.out.println("Lock Expires: "
83: + info.getLock().getExpirationDate());
84: }
85: if (info.getLock().getComment() != null) {
86: System.out.println("Lock Comment: "
87: + info.getLock().getComment());
88: }
89: }
90: }
91: }
|