Project

General

Profile

1 35797 claudio.at
package eu.dnetlib.msro.workflows.hadoop;
2
3
import javax.annotation.Resource;
4
import javax.xml.ws.wsaddressing.W3CEndpointReference;
5
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.data.mdstore.MDStoreService;
13
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
14
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
15
16
/**
17
 * This jobNode reads all the metadata records from all the mongodb collections and generates an hdfs sequence file.
18 38424 claudio.at
 *
19 35797 claudio.at
 * @author claudio
20 38424 claudio.at
 *
21 35797 claudio.at
 */
22
public class MDStoreBatchExporterJobNode extends SimpleJobNode {
23
24
	private static final Log log = LogFactory.getLog(MDStoreBatchExporterJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
25
26
	private String format;
27
28
	private String layout;
29
30
	private String interpretation;
31
32
	private String outputEprParam;
33
34
	@Resource
35
	private UniqueServiceLocator serviceLocator;
36
37
	@Override
38
	public String execute(final NodeToken token) throws Exception {
39
		log.info("bulk reading MDStores: " + getFormat() + "-" + getLayout() + "-" + getInterpretation());
40 38424 claudio.at
		final W3CEndpointReference epr =
41
				getServiceLocator().getService(MDStoreService.class).bulkDeliverMDRecords(getFormat(), getLayout(), getInterpretation());
42 35797 claudio.at
		token.getEnv().setAttribute(getOutputEprParam(), epr.toString());
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 38424 claudio.at
	public UniqueServiceLocator getServiceLocator() {
80
		return serviceLocator;
81
	}
82
83 35797 claudio.at
}