public W3CEndpointReference run() throws Exception { Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller(); try { return (W3CEndpointReference)unmarshaller.unmarshal(writer.getDocument()); } finally { JAXBUtils.closeUnmarshaller(unmarshaller); } } });
public EndpointReference run() throws Exception { Unmarshaller unmarshaller = null; try { unmarshaller = getJAXBContext().createUnmarshaller(); return (EndpointReference)unmarshaller.unmarshal(reader); } finally { try { StaxUtils.close(reader); } catch (XMLStreamException e) { // Ignore } JAXBUtils.closeUnmarshaller(unmarshaller); } } });
/** * Convert from EndpointReference to CXF internal 2005/08 EndpointReferenceType * * @param external the javax.xml.ws.EndpointReference * @return CXF internal 2005/08 EndpointReferenceType */ public static EndpointReferenceType convertToInternal(EndpointReference external) { if (external instanceof W3CEndpointReference) { Unmarshaller um = null; try { DocumentFragment frag = DOMUtils.getEmptyDocument().createDocumentFragment(); DOMResult result = new DOMResult(frag); external.writeTo(result); W3CDOMStreamReader reader = new W3CDOMStreamReader(frag); // CXF internal 2005/08 EndpointReferenceType should be // compatible with W3CEndpointReference //jaxContext = ContextUtils.getJAXBContext(); JAXBContext context = JAXBContext .newInstance(new Class[] {org.apache.cxf.ws.addressing.ObjectFactory.class}); um = context.createUnmarshaller(); return um.unmarshal(reader, EndpointReferenceType.class).getValue(); } catch (JAXBException e) { throw new IllegalArgumentException("Could not unmarshal EndpointReference", e); } finally { JAXBUtils.closeUnmarshaller(um); } } return null; }
public W3CEndpointReference run() throws Exception { Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller(); try { return (W3CEndpointReference)unmarshaller.unmarshal(writer.getDocument()); } finally { JAXBUtils.closeUnmarshaller(unmarshaller); } } });
public static Object unmarshall(JAXBContext c, XMLStreamReader reader) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(reader); } finally { closeUnmarshaller(u); } }
public static <T> JAXBElement<T> unmarshall(JAXBContext c, XMLStreamReader reader, Class<T> cls) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(reader, cls); } finally { closeUnmarshaller(u); } } public static Object unmarshall(JAXBContext c,
public static Object unmarshall(JAXBContext c, Element e) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(e); } finally { closeUnmarshaller(u); } } public static <T> JAXBElement<T> unmarshall(JAXBContext c, Element e, Class<T> cls) throws JAXBException {
public static Object unmarshall(JAXBContext c, Source s) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(s); } finally { closeUnmarshaller(u); } } public static <T> JAXBElement<T> unmarshall(JAXBContext c,
public static <T> JAXBElement<T> unmarshall(JAXBContext c, Element e, Class<T> cls) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(e, cls); } finally { closeUnmarshaller(u); } } public static Object unmarshall(JAXBContext c, Source s) throws JAXBException {
public static <T> JAXBElement<T> unmarshall(JAXBContext c, XMLStreamReader reader, Class<T> cls) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(reader, cls); } finally { closeUnmarshaller(u); } } public static Object unmarshall(JAXBContext c,
public static Object unmarshall(JAXBContext c, Element e) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(e); } finally { closeUnmarshaller(u); } } public static <T> JAXBElement<T> unmarshall(JAXBContext c, Element e, Class<T> cls) throws JAXBException {
public static Object unmarshall(JAXBContext c, XMLStreamReader reader) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(reader); } finally { closeUnmarshaller(u); } }
public static <T> JAXBElement<T> unmarshall(JAXBContext c, Element e, Class<T> cls) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(e, cls); } finally { closeUnmarshaller(u); } } public static Object unmarshall(JAXBContext c, Source s) throws JAXBException {
public static Object unmarshall(JAXBContext c, Source s) throws JAXBException { Unmarshaller u = c.createUnmarshaller(); try { u.setEventHandler(null); return u.unmarshal(s); } finally { closeUnmarshaller(u); } } public static <T> JAXBElement<T> unmarshall(JAXBContext c,
public EndpointReference run() throws Exception { Unmarshaller unmarshaller = null; try { unmarshaller = getJAXBContext().createUnmarshaller(); return (EndpointReference)unmarshaller.unmarshal(reader); } finally { try { StaxUtils.close(reader); } catch (XMLStreamException e) { // Ignore } JAXBUtils.closeUnmarshaller(unmarshaller); } } });
protected static <T> T unmarshalFactoryString(String s, JAXBContext ctx, Class<T> cls) { StringReader reader = new StringReader(s); XMLStreamReader data = StaxUtils.createXMLStreamReader(reader); Unmarshaller u = null; try { u = ctx.createUnmarshaller(); JAXBElement<?> obj = u.unmarshal(data, cls); return cls.cast(obj.getValue()); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { try { StaxUtils.close(data); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } JAXBUtils.closeUnmarshaller(u); } }
@SuppressWarnings("unchecked") protected T getData(Element element) { Object obj = null; Unmarshaller um = getUnmarshaller(); try { obj = um.unmarshal(element); } catch (JAXBException ex) { LogUtils.log(LOG, Level.SEVERE, "UNMARSHAL_ELEMENT_EXC", ex); } finally { JAXBUtils.closeUnmarshaller(um); } if (obj instanceof JAXBElement<?>) { JAXBElement<?> el = (JAXBElement<?>)obj; obj = el.getValue(); } if (null != obj && LOG.isLoggable(Level.FINE)) { LOG.fine("Unmarshaled element into object of type: " + obj.getClass().getName() + " value: " + obj); } return (T)obj; }
protected static <T> T unmarshalFactoryString(String s, JAXBContext ctx, Class<T> cls) { StringReader reader = new StringReader(s); XMLStreamReader data = StaxUtils.createXMLStreamReader(reader); Unmarshaller u = null; try { u = ctx.createUnmarshaller(); JAXBElement<?> obj = u.unmarshal(data, cls); return cls.cast(obj.getValue()); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { try { StaxUtils.close(data); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } JAXBUtils.closeUnmarshaller(u); } }
@SuppressWarnings("unchecked") protected T getData(Element element) { Object obj = null; Unmarshaller um = getUnmarshaller(); try { obj = um.unmarshal(element); } catch (JAXBException ex) { LogUtils.log(LOG, Level.SEVERE, "UNMARSHAL_ELEMENT_EXC", ex); } finally { JAXBUtils.closeUnmarshaller(um); } if (obj instanceof JAXBElement<?>) { JAXBElement<?> el = (JAXBElement<?>)obj; obj = el.getValue(); } if (null != obj && LOG.isLoggable(Level.FINE)) { LOG.fine("Unmarshaled element into object of type: " + obj.getClass().getName() + " value: " + obj); } return (T)obj; }
public Object read(QName name, T input, Class<?> type) { Unmarshaller um = createUnmarshaller(); try { Object obj = JAXBEncoderDecoder.unmarshall(um, input, name, type, unwrapJAXBElement); onCompleteUnmarshalling(); return obj; } finally { JAXBUtils.closeUnmarshaller(um); } }