Project

General

Profile

1
package eu.dnetlib.msro.openaireplus.workflows.nodes.hbase;
2

    
3
import javax.xml.ws.wsaddressing.W3CEndpointReference;
4

    
5
import org.apache.commons.logging.Log;
6
import org.apache.commons.logging.LogFactory;
7
import org.springframework.beans.factory.annotation.Required;
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.tools.ServiceLocator;
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
 * 
19
 * @author claudio
20
 * 
21
 */
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
	private ServiceLocator<MDStoreService> mdstoreLocator;
35

    
36
	@Override
37
	public String execute(final NodeToken token) throws Exception {
38
		log.info("bulk reading MDStores: " + getFormat() + "-" + getLayout() + "-" + getInterpretation());
39
		W3CEndpointReference epr = getMdstoreLocator().getService().bulkDeliverMDRecords(getFormat(), getLayout(), getInterpretation());
40
		token.getEnv().setAttribute(getOutputEprParam(), epr.toString());
41

    
42
		return Arc.DEFAULT_ARC;
43
	}
44

    
45
	public String getFormat() {
46
		return format;
47
	}
48

    
49
	public void setFormat(String format) {
50
		this.format = format;
51
	}
52

    
53
	public String getLayout() {
54
		return layout;
55
	}
56

    
57
	public void setLayout(String layout) {
58
		this.layout = layout;
59
	}
60

    
61
	public String getInterpretation() {
62
		return interpretation;
63
	}
64

    
65
	public void setInterpretation(String interpretation) {
66
		this.interpretation = interpretation;
67
	}
68

    
69
	public String getOutputEprParam() {
70
		return outputEprParam;
71
	}
72

    
73
	public void setOutputEprParam(String outputEprParam) {
74
		this.outputEprParam = outputEprParam;
75
	}
76

    
77
	public ServiceLocator<MDStoreService> getMdstoreLocator() {
78
		return mdstoreLocator;
79
	}
80

    
81
	@Required
82
	public void setMdstoreLocator(ServiceLocator<MDStoreService> mdstoreLocator) {
83
		this.mdstoreLocator = mdstoreLocator;
84
	}
85

    
86
}
(5-5/10)