1
|
package eu.dnetlib.msro.workflows.nodes.hadoop;
|
2
|
|
3
|
import javax.annotation.Resource;
|
4
|
|
5
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
6
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
7
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
8
|
import eu.dnetlib.msro.workflows.procs.Env;
|
9
|
import eu.dnetlib.rmi.common.ResultSet;
|
10
|
import eu.dnetlib.rmi.data.MDStoreService;
|
11
|
import org.apache.commons.logging.Log;
|
12
|
import org.apache.commons.logging.LogFactory;
|
13
|
|
14
|
/**
|
15
|
* This jobNode reads all the metadata records from all the mongodb collections and generates an hdfs sequence file.
|
16
|
*
|
17
|
* @author claudio
|
18
|
*/
|
19
|
public class MDStoreBatchExporterJobNode extends SimpleJobNode {
|
20
|
|
21
|
private static final Log log = LogFactory.getLog(MDStoreBatchExporterJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
22
|
|
23
|
private String format;
|
24
|
|
25
|
private String layout;
|
26
|
|
27
|
private String interpretation;
|
28
|
|
29
|
private String outputEprParam;
|
30
|
|
31
|
@Resource
|
32
|
private UniqueServiceLocator serviceLocator;
|
33
|
|
34
|
@Override
|
35
|
public String execute(final Env env) throws Exception {
|
36
|
log.info("bulk reading MDStores: " + getFormat() + "-" + getLayout() + "-" + getInterpretation());
|
37
|
final ResultSet<String> rs =
|
38
|
getServiceLocator().getService(MDStoreService.class).bulkDeliverMDRecords(getFormat(), getLayout(), getInterpretation());
|
39
|
|
40
|
env.setAttribute(getOutputEprParam(), rs);
|
41
|
|
42
|
return Arc.DEFAULT_ARC;
|
43
|
}
|
44
|
|
45
|
public String getFormat() {
|
46
|
return format;
|
47
|
}
|
48
|
|
49
|
public void setFormat(final String format) {
|
50
|
this.format = format;
|
51
|
}
|
52
|
|
53
|
public String getLayout() {
|
54
|
return layout;
|
55
|
}
|
56
|
|
57
|
public void setLayout(final String layout) {
|
58
|
this.layout = layout;
|
59
|
}
|
60
|
|
61
|
public String getInterpretation() {
|
62
|
return interpretation;
|
63
|
}
|
64
|
|
65
|
public void setInterpretation(final String interpretation) {
|
66
|
this.interpretation = interpretation;
|
67
|
}
|
68
|
|
69
|
public String getOutputEprParam() {
|
70
|
return outputEprParam;
|
71
|
}
|
72
|
|
73
|
public void setOutputEprParam(final String outputEprParam) {
|
74
|
this.outputEprParam = outputEprParam;
|
75
|
}
|
76
|
|
77
|
public UniqueServiceLocator getServiceLocator() {
|
78
|
return serviceLocator;
|
79
|
}
|
80
|
|
81
|
}
|