1 |
26600
|
sandro.lab
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.repohi;
|
2 |
|
|
|
3 |
|
|
import java.io.StringReader;
|
4 |
32798
|
michele.ar
|
import javax.annotation.Resource;
|
5 |
|
|
|
6 |
26600
|
sandro.lab
|
import com.googlecode.sarasvati.Arc;
|
7 |
|
|
import com.googlecode.sarasvati.NodeToken;
|
8 |
|
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
9 |
32798
|
michele.ar
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
10 |
26600
|
sandro.lab
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
11 |
|
|
import eu.dnetlib.msro.workflows.util.WorkflowsConstants;
|
12 |
48139
|
alessia.ba
|
import org.dom4j.Document;
|
13 |
|
|
import org.dom4j.Node;
|
14 |
|
|
import org.dom4j.io.SAXReader;
|
15 |
26600
|
sandro.lab
|
|
16 |
|
|
public class RetrieveInterfaceInfoJobNode extends SimpleJobNode {
|
17 |
|
|
|
18 |
32798
|
michele.ar
|
@Resource
|
19 |
|
|
private UniqueServiceLocator serviceLocator;
|
20 |
26600
|
sandro.lab
|
|
21 |
|
|
@Override
|
22 |
|
|
protected String execute(final NodeToken token) throws Exception {
|
23 |
|
|
|
24 |
|
|
String datasourceId = token.getFullEnv().getAttribute(WorkflowsConstants.DATAPROVIDER_ID);
|
25 |
|
|
String interfaceID = token.getFullEnv().getAttribute(WorkflowsConstants.DATAPROVIDER_INTERFACE);
|
26 |
32798
|
michele.ar
|
final String profile = serviceLocator.getService(ISLookUpService.class).getResourceProfile(datasourceId);
|
27 |
|
|
final Document doc = new SAXReader().read(new StringReader(profile));
|
28 |
26600
|
sandro.lab
|
final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id='" + interfaceID + "']");
|
29 |
|
|
|
30 |
|
|
String contentDescription = ifcNode.valueOf("./@contentDescription");
|
31 |
|
|
token.getEnv().setAttribute("objectStoreContentDescription", contentDescription);
|
32 |
|
|
|
33 |
37002
|
sandro.lab
|
final Node acProtNode = doc.selectSingleNode("//INTERFACE[@id='" + interfaceID + "']/ACCESS_PROTOCOL");
|
34 |
|
|
|
35 |
|
|
String basePath = acProtNode.valueOf("./@basePath");
|
36 |
|
|
token.getEnv().setAttribute("objectStoreBasePath", basePath);
|
37 |
|
|
|
38 |
26600
|
sandro.lab
|
return Arc.DEFAULT_ARC;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
}
|