use of javax.xml.bind.Unmarshaller in project ORCID-Source by ORCID.
the class BlackBoxBaseRC3 method unmarshall.
public Object unmarshall(Reader reader, Class<?> type) {
try {
JAXBContext context = JAXBContext.newInstance(type);
Unmarshaller unmarshaller = context.createUnmarshaller();
return unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.Unmarshaller in project ORCID-Source by ORCID.
the class OrcidRecordToSolrDocumentTest method getRecord.
private Record getRecord(String name) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Record.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
InputStream inputStream = this.getClass().getResourceAsStream(name);
return (Record) unmarshaller.unmarshal(inputStream);
}
use of javax.xml.bind.Unmarshaller in project ORCID-Source by ORCID.
the class OrcidClientGroup method unmarshall.
public static OrcidClientGroup unmarshall(InputStream input) {
try {
JAXBContext context = JAXBContext.newInstance(OrcidClientGroup.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
return (OrcidClientGroup) unmarshaller.unmarshal(input);
} catch (JAXBException e) {
// XXX Should be more specific exception
throw new RuntimeException("Unable to unmarshall client group" + e);
}
}
use of javax.xml.bind.Unmarshaller in project ORCID-Source by ORCID.
the class OrcidMessage method unmarshall.
public static OrcidMessage unmarshall(Reader reader) {
try {
JAXBContext context = JAXBContext.newInstance(OrcidMessage.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
return (OrcidMessage) unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
// XXX Should be more specific exception
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.Unmarshaller in project ORCID-Source by ORCID.
the class ValidateV2_1SamplesTest method unmarshall.
private Object unmarshall(Reader reader, Class<?> type, String schemaPath) throws SAXException, URISyntaxException {
try {
JAXBContext context = JAXBContext.newInstance(type);
Unmarshaller unmarshaller = context.createUnmarshaller();
if (schemaPath != null) {
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new File(getClass().getResource(schemaPath).toURI()));
unmarshaller.setSchema(schema);
}
return unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
Aggregations