use of org.jibx.runtime.IUnmarshallingContext in project RESTdoclet by IG-Group.
the class JiBXUtils method unmarshallController.
/**
* Static method for unmarshalling a controller.
*
* @param file the file the controller has to be unmarshalled from.
* @return the unmarshalled controller.
* @throws JiBXException if JiBX fails.
* @throws FileNotFoundException if the input file can't be found.
*/
public static Controller unmarshallController(final File file) throws JiBXException, FileNotFoundException {
final IBindingFactory factory = BindingDirectory.getFactory(Controller.class);
final IUnmarshallingContext context = factory.createUnmarshallingContext();
final InputStream stream = new FileInputStream(file);
return (Controller) context.unmarshalDocument(stream, ENCODING);
}
use of org.jibx.runtime.IUnmarshallingContext in project RESTdoclet by IG-Group.
the class JiBXUtils method unmarshallServices.
/**
* Static method for unmarshalling services.
*
* @param input the input-stream services have to be unmarshalled from.
* @return the unmarshalled services..
* @throws JiBXException if JiBX fails.
* @throws FileNotFoundException if the input file can't be found.
*/
public static Services unmarshallServices(final InputStream input) throws JiBXException, FileNotFoundException {
final IBindingFactory factory = BindingDirectory.getFactory(Services.class);
final IUnmarshallingContext context = factory.createUnmarshallingContext();
return (Services) context.unmarshalDocument(input, ENCODING);
}
use of org.jibx.runtime.IUnmarshallingContext in project RESTdoclet by IG-Group.
the class JiBXUtils method unmarshallService.
/**
* Static method for unmarshalling a service.
*
* @param input the input-stream the service has to be unmarshalled from.
* @return the unmarshalled service.
* @throws JiBXException if JiBX fails.
*/
public static Service unmarshallService(final InputStream input) throws JiBXException {
final IBindingFactory factory = BindingDirectory.getFactory(Service.class);
final IUnmarshallingContext context = factory.createUnmarshallingContext();
return (Service) context.unmarshalDocument(input, ENCODING);
}
use of org.jibx.runtime.IUnmarshallingContext in project camel by apache.
the class JibxDataFormat method unmarshal.
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
Class<?> unmarshallType = exchange.getIn().getHeader(UNMARSHALL_CLASS, Class.class);
if (unmarshallType == null) {
unmarshallType = getUnmarshallClass();
}
ObjectHelper.notNull(unmarshallType, "unmarshallClass or CamelJibxUnmarshallClass header");
IBindingFactory bindingFactory = createBindingFactory(unmarshallType, bindingName);
IUnmarshallingContext unmarshallingContext = bindingFactory.createUnmarshallingContext();
return unmarshallingContext.unmarshalDocument(stream, null);
}
Aggregations