1 package ch
.cyberduck
.cli
;
4 * Copyright (c) 2002-2014 David Kocher. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * Bug fixes, suggestions and comments should be sent to:
18 * feedback@cyberduck.io
21 import ch
.cyberduck
.core
.AbstractController
;
22 import ch
.cyberduck
.core
.Host
;
23 import ch
.cyberduck
.core
.ProgressListener
;
24 import ch
.cyberduck
.core
.TranscriptListener
;
25 import ch
.cyberduck
.core
.exception
.BackgroundException
;
26 import ch
.cyberduck
.core
.threading
.MainAction
;
31 public class TerminalController
extends AbstractController
{
33 private TranscriptListener transcript
;
35 private ProgressListener progress
;
37 public TerminalController(final ProgressListener progress
,
38 final TranscriptListener transcript
) {
39 this.transcript
= transcript
;
40 this.progress
= progress
;
44 public void invoke(final MainAction runnable
, final boolean wait
) {
49 public boolean alert(final Host host
, final BackgroundException failure
, final StringBuilder transcript
) {
50 return new TerminalAlertCallback().alert(host
, failure
, transcript
);
54 protected void failure(final Exception trace
, final Exception failure
) {
55 trace
.initCause(failure
);
56 trace
.printStackTrace(System
.err
);
61 public void message(final String message
) {
62 progress
.message(message
);
66 public void log(final boolean request
, final String message
) {
67 transcript
.log(request
, message
);