1 package ch
.cyberduck
.core
.threading
;
4 * Copyright (c) 2002-2013 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 feedback@cyberduck.ch
20 import ch
.cyberduck
.core
.Cache
;
21 import ch
.cyberduck
.core
.ConnectionService
;
22 import ch
.cyberduck
.core
.Controller
;
23 import ch
.cyberduck
.core
.HostKeyCallback
;
24 import ch
.cyberduck
.core
.HostKeyCallbackFactory
;
25 import ch
.cyberduck
.core
.LoginCallbackFactory
;
26 import ch
.cyberduck
.core
.LoginService
;
27 import ch
.cyberduck
.core
.Path
;
28 import ch
.cyberduck
.core
.ProgressListener
;
29 import ch
.cyberduck
.core
.Session
;
30 import ch
.cyberduck
.core
.TranscriptListener
;
31 import ch
.cyberduck
.core
.exception
.ConnectionCanceledException
;
36 public abstract class ControllerBackgroundAction
<T
> extends SessionBackgroundAction
<T
> {
38 private Controller controller
;
40 public ControllerBackgroundAction(final Controller controller
,
41 final Session
<?
> session
,
42 final Cache
<Path
> cache
) {
43 super(session
, cache
, controller
, controller
, controller
,
44 LoginCallbackFactory
.get(controller
),
45 HostKeyCallbackFactory
.get(controller
, session
.getHost().getProtocol()));
46 this.controller
= controller
;
49 public ControllerBackgroundAction(final Controller controller
,
50 final Session
<?
> session
,
51 final Cache
<Path
> cache
,
52 final ProgressListener progress
,
53 final TranscriptListener transcript
) {
54 super(session
, cache
, controller
, progress
, transcript
,
55 LoginCallbackFactory
.get(controller
),
56 HostKeyCallbackFactory
.get(controller
, session
.getHost().getProtocol()));
57 this.controller
= controller
;
60 public ControllerBackgroundAction(final ConnectionService connection
,
61 final Controller controller
,
62 final Session
<?
> session
,
63 final Cache
<Path
> cache
,
64 final ProgressListener progress
,
65 final TranscriptListener transcript
) {
66 super(connection
, session
, cache
, controller
, progress
, transcript
);
67 this.controller
= controller
;
70 public ControllerBackgroundAction(final LoginService login
,
71 final Controller controller
,
72 final Session
<?
> session
,
73 final Cache
<Path
> cache
,
74 final ProgressListener progress
,
75 final TranscriptListener transcript
,
76 final HostKeyCallback key
) {
77 super(login
, session
, cache
, controller
, progress
, transcript
, key
);
78 this.controller
= controller
;
82 public void prepare() throws ConnectionCanceledException
{
83 this.addListener(controller
);
88 public void finish() {
90 this.removeListener(controller
);