1
|
/**
|
2
|
* Copyright (C) 2015 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.common.monitor;
|
10
|
|
11
|
import java.io.Serializable;
|
12
|
import java.util.ArrayList;
|
13
|
import java.util.List;
|
14
|
|
15
|
|
16
|
/**
|
17
|
* @author cmathew
|
18
|
* @since 14 Oct 2015
|
19
|
*/
|
20
|
public class RemotingProgressMonitor
|
21
|
extends RestServiceProgressMonitor
|
22
|
implements IRemotingProgressMonitor {
|
23
|
|
24
|
private static final long serialVersionUID = -3173248814638886884L;
|
25
|
|
26
|
private Serializable result;
|
27
|
private List<String> reports = new ArrayList<>();
|
28
|
private boolean serviceDone;
|
29
|
|
30
|
public RemotingProgressMonitor() {
|
31
|
|
32
|
}
|
33
|
|
34
|
@Override
|
35
|
public Object getResult() {
|
36
|
return result;
|
37
|
}
|
38
|
|
39
|
@Override
|
40
|
public void setResult(Serializable result) {
|
41
|
this.result = result;
|
42
|
if (serviceDone){
|
43
|
super.done();
|
44
|
}
|
45
|
}
|
46
|
|
47
|
@Override
|
48
|
public List<String> getReports() {
|
49
|
return reports;
|
50
|
}
|
51
|
|
52
|
@Override
|
53
|
public void addReport(String report) {
|
54
|
reports.add(report);
|
55
|
}
|
56
|
|
57
|
@Override
|
58
|
public void done() {
|
59
|
serviceDone = true;
|
60
|
if (result != null){
|
61
|
super.done();
|
62
|
}
|
63
|
}
|
64
|
|
65
|
@Override
|
66
|
public boolean isMonitorThreadRunning() {
|
67
|
RemotingProgressMonitorThread monitorThread = RemotingProgressMonitorThread.getMonitorThread(this);
|
68
|
return monitorThread != null;
|
69
|
}
|
70
|
}
|