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
|
* @author cmathew
|
17
|
* @since 14 Oct 2015
|
18
|
*/
|
19
|
public class RemotingProgressMonitor
|
20
|
extends RestServiceProgressMonitor
|
21
|
implements IRemotingProgressMonitor {
|
22
|
|
23
|
private static final long serialVersionUID = -3173248814638886884L;
|
24
|
|
25
|
private Serializable result;
|
26
|
private List<String> reports = new ArrayList<>();
|
27
|
private boolean serviceDone;
|
28
|
|
29
|
public RemotingProgressMonitor() {
|
30
|
}
|
31
|
|
32
|
@Override
|
33
|
public Object getResult() {
|
34
|
return result;
|
35
|
}
|
36
|
|
37
|
@Override
|
38
|
public void setResult(Serializable result) {
|
39
|
this.result = result;
|
40
|
if (serviceDone){
|
41
|
super.done();
|
42
|
}
|
43
|
}
|
44
|
|
45
|
@Override
|
46
|
public List<String> getReports() {
|
47
|
return reports;
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
public void addReport(String report) {
|
52
|
reports.add(report);
|
53
|
}
|
54
|
|
55
|
@Override
|
56
|
public void done() {
|
57
|
serviceDone = true;
|
58
|
if (result != null){
|
59
|
super.done();
|
60
|
}
|
61
|
}
|
62
|
|
63
|
@Override
|
64
|
public boolean isMonitorThreadRunning() {
|
65
|
RemotingProgressMonitorThread monitorThread = RemotingProgressMonitorThread.getMonitorThread(this);
|
66
|
return monitorThread != null;
|
67
|
}
|
68
|
}
|