1
|
package eu.dnetlib.msro.oai.workflows.nodes;
|
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
|
public class ReadMDStoreJobNode extends SimpleJobNode {
|
17
|
|
18
|
private static final Log log = LogFactory.getLog(ReadMDStoreJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
19
|
|
20
|
/**
|
21
|
* Name of the env attribute where the output epr will be saved.
|
22
|
*/
|
23
|
private String eprParam;
|
24
|
|
25
|
// info about the metadata format of the records I'm reading
|
26
|
private String mdFormatName;
|
27
|
private String mdFormatLayout;
|
28
|
private String mdFormatInterpretation;
|
29
|
|
30
|
/** Name of the datasource whose records I am reading **/
|
31
|
private String datasource;
|
32
|
|
33
|
/**
|
34
|
* Identifier of the input mdstore.
|
35
|
*/
|
36
|
private String mdstoreId;
|
37
|
|
38
|
@Resource
|
39
|
private UniqueServiceLocator serviceLocator;
|
40
|
|
41
|
@Override
|
42
|
protected String execute(final NodeToken token) throws Exception {
|
43
|
|
44
|
/*
|
45
|
* public W3CEndpointReference deliverMDRecords( String mdId, String from, String until, String recordFilter) throws
|
46
|
* MDStoreServiceException;
|
47
|
*/
|
48
|
W3CEndpointReference epr = serviceLocator.getService(MDStoreService.class, mdstoreId).deliverMDRecords(mdstoreId, null, null, null);
|
49
|
log.debug("Created W3CEndpointReference to read from mdstoreId = " + mdstoreId);
|
50
|
token.getEnv().setAttribute(eprParam, epr.toString());
|
51
|
token.getEnv().setAttribute("oai_formatName", mdFormatName);
|
52
|
token.getEnv().setAttribute("oai_formatLayout", mdFormatLayout);
|
53
|
token.getEnv().setAttribute("oai_formatInterpretation", mdFormatInterpretation);
|
54
|
token.getEnv().setAttribute("oai_recordSource", datasource);
|
55
|
return Arc.DEFAULT_ARC;
|
56
|
}
|
57
|
|
58
|
public String getEprParam() {
|
59
|
return eprParam;
|
60
|
}
|
61
|
|
62
|
public void setEprParam(final String eprParam) {
|
63
|
this.eprParam = eprParam;
|
64
|
}
|
65
|
|
66
|
public String getMdFormatName() {
|
67
|
return mdFormatName;
|
68
|
}
|
69
|
|
70
|
public void setMdFormatName(final String mdFormatName) {
|
71
|
this.mdFormatName = mdFormatName;
|
72
|
}
|
73
|
|
74
|
public String getMdFormatLayout() {
|
75
|
return mdFormatLayout;
|
76
|
}
|
77
|
|
78
|
public void setMdFormatLayout(final String mdFormatLayout) {
|
79
|
this.mdFormatLayout = mdFormatLayout;
|
80
|
}
|
81
|
|
82
|
public String getMdFormatInterpretation() {
|
83
|
return mdFormatInterpretation;
|
84
|
}
|
85
|
|
86
|
public void setMdFormatInterpretation(final String mdFormatInterpretation) {
|
87
|
this.mdFormatInterpretation = mdFormatInterpretation;
|
88
|
}
|
89
|
|
90
|
public String getDatasource() {
|
91
|
return datasource;
|
92
|
}
|
93
|
|
94
|
public void setDatasource(final String datasource) {
|
95
|
this.datasource = datasource;
|
96
|
}
|
97
|
|
98
|
public String getMdstoreId() {
|
99
|
return mdstoreId;
|
100
|
}
|
101
|
|
102
|
public void setMdstoreId(final String mdstoreId) {
|
103
|
this.mdstoreId = mdstoreId;
|
104
|
}
|
105
|
|
106
|
}
|