use of org.codice.ddf.parser.ParserException in project ddf by codice.
the class XmlParser method getContext.
private JAXBContext getContext(List<String> contextPath, ClassLoader loader) throws ParserException {
String joinedPath = CTX_JOINER.join(contextPath);
JAXBContext jaxbContext;
try {
jaxbContext = jaxbContextCache.get(new CacheKey(joinedPath, loader));
} catch (ExecutionException e) {
LOGGER.info("Unable to create JAXB context using context path: {}", joinedPath, e);
throw new ParserException("Unable to create XmlParser", e.getCause());
}
return jaxbContext;
}
use of org.codice.ddf.parser.ParserException in project ddf by codice.
the class MetacardMarshaller method getRegistryPackageAsXml.
/**
* Converts the RegistryPackageType into an xml string
*
* @param registryPackage Registry package to convert
* @return Ebrim xml string
* @throws ParserException
*/
public String getRegistryPackageAsXml(RegistryPackageType registryPackage) throws ParserException {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
JAXBElement<RegistryPackageType> registryObjectTypeJAXBElement = EbrimConstants.RIM_FACTORY.createRegistryPackage(registryPackage);
parser.marshal(marshalConfigurator, registryObjectTypeJAXBElement, outputStream);
return new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new ParserException("Error parsing registry package to ebrim xml", e);
}
}
Aggregations