1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.camel.component.file.remote; |
18 |
|
|
19 |
|
import java.io.ByteArrayOutputStream; |
20 |
|
|
21 |
|
import org.apache.camel.impl.ScheduledPollEndpoint; |
22 |
|
|
23 |
0 |
public abstract class RemoteFileEndpoint<T extends RemoteFileExchange> extends ScheduledPollEndpoint<T> { |
24 |
|
private RemoteFileBinding binding; |
25 |
|
private RemoteFileConfiguration configuration; |
26 |
|
|
27 |
|
public RemoteFileEndpoint(String uri, RemoteFileComponent component, RemoteFileConfiguration configuration) { |
28 |
6 |
super(uri, component); |
29 |
6 |
this.configuration = configuration; |
30 |
6 |
} |
31 |
|
|
32 |
|
protected RemoteFileBinding createRemoteFileBinding() { |
33 |
0 |
return new RemoteFileBinding(); |
34 |
|
} |
35 |
|
|
36 |
|
public T createExchange() { |
37 |
0 |
return (T) new RemoteFileExchange(getContext(), getBinding()); |
38 |
|
} |
39 |
|
|
40 |
|
public T createExchange(String fullFileName, ByteArrayOutputStream outputStream) { |
41 |
0 |
return (T) new RemoteFileExchange(getContext(), getBinding(), getConfiguration().getHost(), fullFileName, outputStream); |
42 |
|
} |
43 |
|
|
44 |
|
public RemoteFileBinding getBinding() { |
45 |
0 |
if (binding == null) { |
46 |
0 |
binding = createRemoteFileBinding(); |
47 |
|
} |
48 |
0 |
return binding; |
49 |
|
} |
50 |
|
|
51 |
|
public void setBinding(RemoteFileBinding binding) { |
52 |
0 |
this.binding = binding; |
53 |
0 |
} |
54 |
|
|
55 |
|
public boolean isSingleton() { |
56 |
6 |
return true; |
57 |
|
} |
58 |
|
|
59 |
|
public RemoteFileConfiguration getConfiguration() { |
60 |
40 |
return configuration; |
61 |
|
} |
62 |
|
} |