Revision 42158
Added by Michele Artini about 8 years ago
ValidateProfilesJobNode.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
17 | 17 |
import eu.dnetlib.msro.workflows.graph.Arc; |
18 |
import eu.dnetlib.msro.workflows.nodes.ProgressJobNode; |
|
19 | 18 |
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode; |
20 | 19 |
import eu.dnetlib.msro.workflows.procs.Env; |
21 |
import eu.dnetlib.msro.workflows.procs.WorkflowProcess;
|
|
20 |
import eu.dnetlib.msro.workflows.procs.Token;
|
|
22 | 21 |
import eu.dnetlib.msro.workflows.util.ProgressProvider; |
23 | 22 |
import eu.dnetlib.msro.workflows.util.WorkflowsConstants; |
24 | 23 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
25 | 24 |
import eu.dnetlib.rmi.manager.MSROException; |
26 | 25 |
|
27 |
public class ValidateProfilesJobNode extends SimpleJobNode implements ProgressJobNode {
|
|
26 |
public class ValidateProfilesJobNode extends SimpleJobNode { |
|
28 | 27 |
|
29 | 28 |
private static final Log log = LogFactory.getLog(ValidateProfilesJobNode.class); |
30 | 29 |
@Resource |
31 | 30 |
private UniqueServiceLocator serviceLocator; |
32 | 31 |
private int total = 0; |
33 | 32 |
private int current = 0; |
34 |
private WorkflowProcess process; |
|
35 | 33 |
|
36 | 34 |
@Override |
35 |
protected void beforeStart(final Token token) { |
|
36 |
token.setProgressProvider(new ProgressProvider() { |
|
37 |
|
|
38 |
@Override |
|
39 |
public String asString() { |
|
40 |
return ValidateProfilesJobNode.this.current + " / " + ValidateProfilesJobNode.this.total; |
|
41 |
} |
|
42 |
}); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
37 | 46 |
protected String execute(final Env env) throws Exception { |
38 | 47 |
|
39 | 48 |
final ISLookUpService lookup = this.serviceLocator.getService(ISLookUpService.class); |
... | ... | |
73 | 82 |
return Arc.DEFAULT_ARC; |
74 | 83 |
} |
75 | 84 |
|
76 |
@Override |
|
77 |
public ProgressProvider getProgressProvider() { |
|
78 |
return new ProgressProvider() { |
|
79 |
|
|
80 |
@Override |
|
81 |
public boolean isInaccurate() { |
|
82 |
return false; |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public int getTotalValue() { |
|
87 |
return ValidateProfilesJobNode.this.total; |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public int getCurrentValue() { |
|
92 |
return ValidateProfilesJobNode.this.current; |
|
93 |
} |
|
94 |
}; |
|
95 |
} |
|
96 |
|
|
97 | 85 |
} |
Also available in: Unified diff
progress provider refactoring