1
|
package eu.dnetlib.msro.workflows.nodes.mdstore;
|
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.rmi.MSROException;
|
15
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
16
|
|
17
|
public class FetchMDStoreRecordsJobNode extends SimpleJobNode {
|
18
|
|
19
|
private static final Log log = LogFactory.getLog(FetchMDStoreRecordsJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
20
|
|
21
|
@Resource
|
22
|
private UniqueServiceLocator serviceLocator;
|
23
|
|
24
|
private String mdId;
|
25
|
private String mdFormat;
|
26
|
private String eprParam;
|
27
|
|
28
|
@Override
|
29
|
protected String execute(final NodeToken token) throws Exception {
|
30
|
if (getMdId() == null) {
|
31
|
setMdId(token.getEnv().getAttribute("mdId"));
|
32
|
}
|
33
|
if (getMdFormat() == null) {
|
34
|
setMdFormat(token.getEnv().getAttribute("mdFormat"));
|
35
|
}
|
36
|
|
37
|
log.info("getting MDRecords from: " + getMdId());
|
38
|
final W3CEndpointReference epr = serviceLocator.getService(MDStoreService.class, getMdId()).deliverMDRecords(getMdId(), "", "", "");
|
39
|
if (epr == null) { throw new MSROException("unable to read MDRecords from: " + getMdId()); }
|
40
|
token.getEnv().setAttribute(getEprParam(), epr.toString());
|
41
|
return Arc.DEFAULT_ARC;
|
42
|
}
|
43
|
|
44
|
public String getMdId() {
|
45
|
return mdId;
|
46
|
}
|
47
|
|
48
|
public void setMdId(final String mdId) {
|
49
|
this.mdId = mdId;
|
50
|
}
|
51
|
|
52
|
public String getMdFormat() {
|
53
|
return mdFormat;
|
54
|
}
|
55
|
|
56
|
public void setMdFormat(final String mdFormat) {
|
57
|
this.mdFormat = mdFormat;
|
58
|
}
|
59
|
|
60
|
public String getEprParam() {
|
61
|
return eprParam;
|
62
|
}
|
63
|
|
64
|
public void setEprParam(final String eprParam) {
|
65
|
this.eprParam = eprParam;
|
66
|
}
|
67
|
}
|