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.cli.command;
13:
14: import java.io.File;
15: import java.io.InputStream;
16: import java.io.PrintStream;
17:
18: import org.tmatesoft.svn.cli.SVNCommand;
19: import org.tmatesoft.svn.core.SVNCancelException;
20: import org.tmatesoft.svn.core.SVNException;
21: import org.tmatesoft.svn.core.wc.SVNEvent;
22: import org.tmatesoft.svn.core.wc.admin.ISVNAdminEventHandler;
23: import org.tmatesoft.svn.core.wc.admin.SVNAdminClient;
24: import org.tmatesoft.svn.core.wc.admin.SVNAdminEvent;
25: import org.tmatesoft.svn.core.wc.admin.SVNAdminEventAction;
26:
27: /**
28: * @version 1.1.1
29: * @author TMate Software Ltd.
30: * @since 1.1.1
31: */
32: public class SVNAdminListTransactionsCommand extends SVNCommand
33: implements ISVNAdminEventHandler {
34: private PrintStream myOut;
35:
36: public void run(PrintStream out, PrintStream err)
37: throws SVNException {
38: if (!getCommandLine().hasPaths()) {
39: SVNCommand.println(out,
40: "svnadmin: Repository argument required");
41: System.exit(1);
42: }
43: File reposRoot = new File(getCommandLine().getPathAt(0));
44:
45: myOut = out;
46: SVNAdminClient adminClient = getClientManager()
47: .getAdminClient();
48: adminClient.setEventHandler(this );
49: adminClient.doListTransactions(reposRoot);
50: }
51:
52: public void run(InputStream in, PrintStream out, PrintStream err)
53: throws SVNException {
54: run(out, err);
55: }
56:
57: public void handleAdminEvent(SVNAdminEvent event, double progress)
58: throws SVNException {
59: if (event != null
60: && event.getAction() == SVNAdminEventAction.TRANSACTION_LISTED) {
61: String txnName = event.getTxnName();
62: SVNCommand.println(myOut, txnName);
63: }
64: }
65:
66: public void handleEvent(SVNEvent event, double progress)
67: throws SVNException {
68: }
69:
70: public void checkCancelled() throws SVNCancelException {
71: }
72:
73: }
|