1
|
package eu.dnetlib.msro.workflows.nodes.actionmanager;
|
2
|
|
3
|
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
|
4
|
import eu.dnetlib.msro.workflows.nodes.BlackboardJobNode;
|
5
|
import eu.dnetlib.msro.workflows.procs.Env;
|
6
|
import eu.dnetlib.msro.workflows.procs.Token;
|
7
|
import eu.dnetlib.rmi.data.hadoop.actionmanager.ActionManagerService;
|
8
|
import org.apache.commons.lang3.StringUtils;
|
9
|
|
10
|
/**
|
11
|
* Created by claudio on 14/04/16.
|
12
|
*/
|
13
|
public class PromoteActionsHDFSJobNode extends BlackboardJobNode {
|
14
|
|
15
|
public static final String ALL_SETS = "ALL SETS";
|
16
|
|
17
|
private String set;
|
18
|
|
19
|
private String tableName;
|
20
|
|
21
|
@Override
|
22
|
protected String obtainServiceId(final Env env) {
|
23
|
return getServiceLocator().getServiceId(ActionManagerService.class);
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
protected void prepareJob(final BlackboardJob job, final Token token) throws Exception {
|
28
|
job.setAction("PROMOTE_FROM_HDFS");
|
29
|
if (!StringUtils.isBlank(getSet()) && !getSet().equals(ALL_SETS)) {
|
30
|
job.getParameters().put("set", getSet());
|
31
|
token.getEnv().setAttribute("set", getSet());
|
32
|
}
|
33
|
|
34
|
job.getParameters().put("targetTable", getTableName());
|
35
|
}
|
36
|
|
37
|
public String getSet() {
|
38
|
return this.set;
|
39
|
}
|
40
|
|
41
|
public void setSet(final String set) {
|
42
|
this.set = set;
|
43
|
}
|
44
|
|
45
|
public String getTableName() {
|
46
|
return tableName;
|
47
|
}
|
48
|
|
49
|
public void setTableName(final String tableName) {
|
50
|
this.tableName = tableName;
|
51
|
}
|
52
|
}
|