1
|
package eu.dnetlib.msro.worker.nodes.mdstore;
|
2
|
|
3
|
import org.apache.commons.logging.Log;
|
4
|
import org.apache.commons.logging.LogFactory;
|
5
|
|
6
|
import com.googlecode.sarasvati.NodeToken;
|
7
|
import com.googlecode.sarasvati.env.Env;
|
8
|
|
9
|
import eu.dnetlib.msro.worker.WorkflowConstants;
|
10
|
import eu.dnetlib.msro.worker.nodes.ProgressBlackboardJobNode;
|
11
|
import eu.dnetlib.rmi.blackboard.FeedMDStoreMessage;
|
12
|
import eu.dnetlib.rmi.objects.resultSet.ResultSet;
|
13
|
import eu.dnetlib.rmi.soap.MDStoreService;
|
14
|
|
15
|
public class StoreMDStoreRecordsJobNode extends ProgressBlackboardJobNode<FeedMDStoreMessage> {
|
16
|
|
17
|
private static final Log log = LogFactory.getLog(StoreMDStoreRecordsJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
18
|
|
19
|
private String resultSetParam;
|
20
|
private String mdId;
|
21
|
private String storingType;
|
22
|
|
23
|
@Override
|
24
|
protected String obtainServiceId(final NodeToken token) {
|
25
|
return getServiceLocator().getServiceId(MDStoreService.class, mdId);
|
26
|
}
|
27
|
|
28
|
@Override
|
29
|
protected FeedMDStoreMessage prepareMessage(final NodeToken token) {
|
30
|
@SuppressWarnings("unchecked")
|
31
|
final ResultSet<String> rs = (ResultSet<String>) token.getEnv().getTransientAttribute(resultSetParam);
|
32
|
return new FeedMDStoreMessage(mdId, storingType, rs);
|
33
|
}
|
34
|
|
35
|
@Override
|
36
|
protected void saveResponseInEnv(final FeedMDStoreMessage m, final Env env) {
|
37
|
log.info("Number of stored records: " + m.getSize());
|
38
|
env.setAttribute(WorkflowConstants.MAIN_LOG_PREFIX + "total", m.getSize());
|
39
|
}
|
40
|
|
41
|
public String getResultSetParam() {
|
42
|
return resultSetParam;
|
43
|
}
|
44
|
|
45
|
public void setResultSetParam(final String resultSetParam) {
|
46
|
this.resultSetParam = resultSetParam;
|
47
|
}
|
48
|
|
49
|
public String getMdId() {
|
50
|
return mdId;
|
51
|
}
|
52
|
|
53
|
public void setMdId(final String mdId) {
|
54
|
this.mdId = mdId;
|
55
|
}
|
56
|
|
57
|
public String getStoringType() {
|
58
|
return storingType;
|
59
|
}
|
60
|
|
61
|
public void setStoringType(final String storingType) {
|
62
|
this.storingType = storingType;
|
63
|
}
|
64
|
|
65
|
}
|