Project

General

Profile

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