1
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.dhp;
|
2
|
|
3
|
import eu.dnetlib.dhp.utils.DHPUtils;
|
4
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
5
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
6
|
import org.apache.commons.logging.Log;
|
7
|
import org.apache.commons.logging.LogFactory;
|
8
|
|
9
|
import com.googlecode.sarasvati.Arc;
|
10
|
import com.googlecode.sarasvati.NodeToken;
|
11
|
|
12
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
import org.springframework.beans.factory.annotation.Value;
|
15
|
|
16
|
public class PrepareEnvTransformHadoopJobNode extends SimpleJobNode {
|
17
|
|
18
|
private static final Log log = LogFactory.getLog(PrepareEnvTransformHadoopJobNode.class);
|
19
|
|
20
|
private String ruleId;
|
21
|
|
22
|
@Autowired
|
23
|
private UniqueServiceLocator serviceLocator;
|
24
|
|
25
|
private String mdstoreInput;
|
26
|
|
27
|
private String mdstoreOutput;
|
28
|
|
29
|
@Value("${dnet.openaire.dhp.transformation.app.path}")
|
30
|
private String oozieWfPath;
|
31
|
|
32
|
@Override
|
33
|
protected String execute(final NodeToken token) throws Exception {
|
34
|
|
35
|
final String trRule = serviceLocator.getService(ISLookUpService.class).getResourceProfile(getRuleId());
|
36
|
|
37
|
token.getEnv().setAttribute("oozieWfPath", getOozieWfPath());
|
38
|
token.getEnv().setAttribute("timestamp", "" + System.currentTimeMillis());
|
39
|
token.getEnv().setAttribute("workflowId", token.getProcess().getEnv().getAttribute("system:processId"));
|
40
|
token.getEnv().setAttribute("mdstoreInput", getMdstoreInput());
|
41
|
token.getEnv().setAttribute("mdstoreOutput", getMdstoreOutput());
|
42
|
token.getEnv().setAttribute("transformationRule", DHPUtils.compressString(trRule));
|
43
|
return Arc.DEFAULT_ARC;
|
44
|
|
45
|
}
|
46
|
|
47
|
public String getRuleId() {
|
48
|
return ruleId;
|
49
|
}
|
50
|
|
51
|
public void setRuleId(String ruleId) {
|
52
|
this.ruleId = ruleId;
|
53
|
}
|
54
|
|
55
|
public UniqueServiceLocator getServiceLocator() {
|
56
|
return serviceLocator;
|
57
|
}
|
58
|
|
59
|
public void setServiceLocator(UniqueServiceLocator serviceLocator) {
|
60
|
this.serviceLocator = serviceLocator;
|
61
|
}
|
62
|
|
63
|
public String getMdstoreInput() {
|
64
|
return mdstoreInput;
|
65
|
}
|
66
|
|
67
|
public void setMdstoreInput(String mdstoreInput) {
|
68
|
this.mdstoreInput = mdstoreInput;
|
69
|
}
|
70
|
|
71
|
public String getMdstoreOutput() {
|
72
|
return mdstoreOutput;
|
73
|
}
|
74
|
|
75
|
public void setMdstoreOutput(String mdstoreOutput) {
|
76
|
this.mdstoreOutput = mdstoreOutput;
|
77
|
}
|
78
|
|
79
|
public String getOozieWfPath() {
|
80
|
return oozieWfPath;
|
81
|
}
|
82
|
|
83
|
public void setOozieWfPath(String oozieWfPath) {
|
84
|
this.oozieWfPath = oozieWfPath;
|
85
|
}
|
86
|
}
|