Revision 35357
Added by Alessia Bardi over 9 years ago
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/nodes/transform/MdBuilderJobNode.java | ||
---|---|---|
44 | 44 |
final String inputEpr = token.getEnv().getAttribute(inputEprParam); |
45 | 45 |
|
46 | 46 |
if ((inputEpr == null) || inputEpr.isEmpty()) throw new MSROException("InputEprParam (" + inputEprParam + ") not found in ENV"); |
47 |
|
|
47 |
StringTemplate st = null; |
|
48 | 48 |
try { |
49 |
final StringTemplate st = new StringTemplate(IOUtils.toString(getMdBuilderTemplateXslt().getInputStream()));
|
|
49 |
st = new StringTemplate(IOUtils.toString(getMdBuilderTemplateXslt().getInputStream())); |
|
50 | 50 |
st.setAttribute("datasourceId", datasourceId); |
51 | 51 |
st.setAttribute("xpath", getMetadataIdentifierPath()); |
52 | 52 |
st.setAttribute("baseurl", getBaseUrl()); |
... | ... | |
75 | 75 |
} |
76 | 76 |
} |
77 | 77 |
} |
78 |
|
|
78 | 79 |
final W3CEndpointReference epr = xsltMappedResultSetFactory.createMappedResultSet(new EPRUtils().getEpr(inputEpr), st.toString()); |
79 | 80 |
|
80 | 81 |
token.getEnv().setAttribute(outputEprParam, epr.toString()); |
... | ... | |
85 | 86 |
+ datasourceId, e); |
86 | 87 |
} catch (IOException e) { |
87 | 88 |
throw new MSROException("Error parsing template: " + getMdBuilderTemplateXslt().getFilename(), e); |
89 |
} catch (Exception e) { |
|
90 |
log.error(st.toString()); |
|
91 |
throw new MSROException(e); |
|
88 | 92 |
} |
89 | 93 |
} |
90 | 94 |
|
... | ... | |
103 | 107 |
|
104 | 108 |
private String getMetadataNamespace() { |
105 | 109 |
try { |
106 |
String xQuery = |
|
107 |
"let $x := /*[.//RESOURCE_IDENTIFIER/@value='{datasourceId}']//INTERFACE[@id='{interfaceId}']/ACCESS_PROTOCOL/@format/string() " |
|
108 |
+ "return /*[.//RESOURCE_TYPE/@value='MetadataFormatDSResourceType']//METADATAFORMAT[@Prefix=$x]/@NameSpace/string()"; |
|
110 |
String xQuery = "let $x := /*[.//RESOURCE_IDENTIFIER/@value='{datasourceId}']//INTERFACE[@id='{interfaceId}']/ACCESS_PROTOCOL/@format/string() " |
|
111 |
+ "return /*[.//RESOURCE_TYPE/@value='MetadataFormatDSResourceType']//METADATAFORMAT[@Prefix=$x]/@NameSpace/string()"; |
|
109 | 112 |
xQuery = xQuery.replace("{interfaceId}", datasourceInterface).replace("{datasourceId}", datasourceId); |
110 | 113 |
return serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xQuery); |
111 | 114 |
} catch (ISLookUpException e) { |
Also available in: Unified diff
print the template if a generic exception is caught.