1 |
29397
|
claudio.at
|
package eu.dnetlib.msro.openaireplus.workflows.nodes;
|
2 |
|
|
|
3 |
|
|
import com.googlecode.sarasvati.Arc;
|
4 |
|
|
import com.googlecode.sarasvati.NodeToken;
|
5 |
|
|
import eu.dnetlib.msro.openaireplus.workflows.nodes.index.ContextLoader;
|
6 |
|
|
import eu.dnetlib.msro.rmi.MSROException;
|
7 |
|
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
8 |
48139
|
alessia.ba
|
import org.apache.commons.lang.StringUtils;
|
9 |
|
|
import org.apache.commons.logging.Log;
|
10 |
|
|
import org.apache.commons.logging.LogFactory;
|
11 |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
12 |
29397
|
claudio.at
|
|
13 |
|
|
public class LoadContextsJobNode extends SimpleJobNode {
|
14 |
|
|
|
15 |
|
|
public static final String CONTEXTMAP = "contextmap";
|
16 |
|
|
|
17 |
|
|
/**
|
18 |
|
|
* logger.
|
19 |
|
|
*/
|
20 |
|
|
private static final Log log = LogFactory.getLog(LoadContextsJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
21 |
|
|
|
22 |
|
|
@Autowired
|
23 |
|
|
private ContextLoader contextLoader;
|
24 |
|
|
|
25 |
|
|
@Override
|
26 |
|
|
protected String execute(final NodeToken token) throws Exception {
|
27 |
|
|
|
28 |
|
|
log.info("start preparing job");
|
29 |
|
|
|
30 |
|
|
String contexts = contextLoader.load();
|
31 |
|
|
|
32 |
|
|
if (StringUtils.isBlank(contexts)) throw new MSROException("empty contexts");
|
33 |
|
|
|
34 |
|
|
token.getEnv().setAttribute(CONTEXTMAP, contexts);
|
35 |
|
|
|
36 |
|
|
return Arc.DEFAULT_ARC;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
}
|