private void processHandlerElement(Element el, List<Handler> chain) { try { JAXBContext ctx = getContextForPortComponentHandlerType(); PortComponentHandlerType pt = JAXBUtils.unmarshall(ctx, el, PortComponentHandlerType.class).getValue(); chain.addAll(buildHandlerChain(pt, classLoader)); } catch (JAXBException e) { throw new IllegalArgumentException("Could not unmarshal handler chain", e); } }
public Object getPayload(JAXBContext arg0) { try { Source s = getPayload(); if (s instanceof DOMSource) { DOMSource ds = (DOMSource)s; ds.setNode(org.apache.cxf.helpers.DOMUtils.getDomElement(ds.getNode())); Node parent = ds.getNode().getParentNode(); Node next = ds.getNode().getNextSibling(); if (parent instanceof DocumentFragment) { parent.removeChild(ds.getNode()); } try { return JAXBUtils.unmarshall(arg0, ds); } finally { if (parent instanceof DocumentFragment) { parent.insertBefore(ds.getNode(), next); } } } return JAXBUtils.unmarshall(arg0, getPayload()); } catch (JAXBException e) { throw new WebServiceException(e); } }
public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) { SOAPMessage msg = getMessage(); SOAPHeader header; try { header = msg.getSOAPPart().getEnvelope().getHeader(); if (header == null || !header.hasChildNodes()) { return new Object[0]; } List<Object> ret = new ArrayList<>(); Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements()); while (it.hasNext()) { SOAPHeaderElement she = it.next(); if ((allRoles || roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(JAXBUtils.unmarshall(context, she)); } } return ret.toArray(new Object[0]); } catch (SOAPException | JAXBException e) { throw new WebServiceException(e); } }
protected <T> T getJaxbObject(Element parent, Class<T> c) { try { JAXBElement<T> ele = JAXBUtils.unmarshall(getContext(c), parent, c); return ele.getValue(); } catch (JAXBException e) { LOG.warning("Unable to parse property due to " + e); return null; } }
protected <T> T getJaxbObject(Element parent, Class<T> c) { try { JAXBElement<T> ele = JAXBUtils.unmarshall(getContext(c), parent, c); return ele.getValue(); } catch (JAXBException e) { LOG.warning("Unable to parse property due to " + e); return null; } }
protected <T> T getJaxbObject(Element parent, Class<T> c) { try { JAXBElement<T> ele = JAXBUtils.unmarshall(getContext(c), parent, c); return ele.getValue(); } catch (JAXBException e) { LOG.warning("Unable to parse property due to " + e); return null; } }
protected <T> T getJaxbObject(Element parent, Class<T> c) { try { JAXBElement<T> ele = JAXBUtils.unmarshall(getContext(c), parent, c); return ele.getValue(); } catch (JAXBException e) { LOG.warning("Unable to parse property due to " + e); return null; } }
private void processHandlerElement(Element el, List<Handler> chain) { try { JAXBContext ctx = getContextForPortComponentHandlerType(); PortComponentHandlerType pt = JAXBUtils.unmarshall(ctx, el, PortComponentHandlerType.class).getValue(); chain.addAll(buildHandlerChain(pt, classLoader)); } catch (JAXBException e) { throw new IllegalArgumentException("Could not unmarshal handler chain", e); } }
public Object createJAXBBean(String v) { XMLStreamReader reader = StaxUtils.createXMLStreamReader(new StringReader(v)); try { JAXBElement<?> el = JAXBUtils.unmarshall(ctx, reader, cls); if (el != null) { return el.getValue(); } return null; } catch (JAXBException e) { throw new RuntimeException(e); } finally { try { reader.close(); } catch (XMLStreamException e) { //ignore } } } }
private Plugin getPlugin(InputStream is) throws JAXBException { try { Document doc = StaxUtils.read(is); return JAXBUtils.unmarshall(jaxbContext, doc.getDocumentElement(), Plugin.class).getValue(); } catch (XMLStreamException xse) { throw new JAXBException(xse); } finally { try { is.close(); } catch (IOException e) { //ignore } } }
public Object createJAXBBean(String v) { XMLStreamReader reader = StaxUtils.createXMLStreamReader(new StringReader(v)); try { JAXBElement<?> el = JAXBUtils.unmarshall(ctx, reader, cls); if (el != null) { return el.getValue(); } return null; } catch (JAXBException e) { throw new RuntimeException(e); } finally { try { reader.close(); } catch (XMLStreamException e) { //ignore } } } }
private Plugin getPlugin(InputStream is) throws JAXBException { try { Document doc = StaxUtils.read(is); return JAXBUtils.unmarshall(jaxbContext, doc.getDocumentElement(), Plugin.class).getValue(); } catch (XMLStreamException xse) { throw new JAXBException(xse); } finally { try { is.close(); } catch (IOException e) { //ignore } } }
public static <T> T createJAXBBean(JAXBContext context, String s, Class<T> c) { StringReader reader = new StringReader(s); XMLStreamReader data = StaxUtils.createXMLStreamReader(reader); try { T obj = null; if (c != null) { obj = JAXBUtils.unmarshall(context, data, c).getValue(); } else { Object o = JAXBUtils.unmarshall(context, data); if (o instanceof JAXBElement<?>) { JAXBElement<?> el = (JAXBElement<?>)o; @SuppressWarnings("unchecked") T ot = (T)el.getValue(); obj = ot; } } return obj; } catch (JAXBException e) { throw new RuntimeException(e); } finally { try { StaxUtils.close(data); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } }
public static <T> T createJAXBBean(JAXBContext context, String s, Class<T> c) { StringReader reader = new StringReader(s); XMLStreamReader data = StaxUtils.createXMLStreamReader(reader); try { T obj = null; if (c != null) { obj = JAXBUtils.unmarshall(context, data, c).getValue(); } else { Object o = JAXBUtils.unmarshall(context, data); if (o instanceof JAXBElement<?>) { JAXBElement<?> el = (JAXBElement<?>)o; @SuppressWarnings("unchecked") T ot = (T)el.getValue(); obj = ot; } } return obj; } catch (JAXBException e) { throw new RuntimeException(e); } finally { try { StaxUtils.close(data); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } }
public Object getPayload(JAXBContext arg0) { try { Source s = getPayload(); if (s instanceof DOMSource) { DOMSource ds = (DOMSource)s; ds.setNode(org.apache.cxf.helpers.DOMUtils.getDomElement(ds.getNode())); Node parent = ds.getNode().getParentNode(); Node next = ds.getNode().getNextSibling(); if (parent instanceof DocumentFragment) { parent.removeChild(ds.getNode()); } try { return JAXBUtils.unmarshall(arg0, ds); } finally { if (parent instanceof DocumentFragment) { parent.insertBefore(ds.getNode(), next); } } } return JAXBUtils.unmarshall(arg0, getPayload()); } catch (JAXBException e) { throw new WebServiceException(e); } }
public static Object createTLSClientParameters(String s) { StringReader reader = new StringReader(s); XMLStreamReader data = StaxUtils.createXMLStreamReader(reader); try { JAXBElement<TLSClientParametersType> type = JAXBUtils.unmarshall(getContext(), data, TLSClientParametersType.class); TLSClientParametersType cpt = type.getValue(); return createTLSClientParametersFromType(cpt); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { try { StaxUtils.close(data); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } }
public static Object createTLSClientParameters(String s) { StringReader reader = new StringReader(s); XMLStreamReader data = StaxUtils.createXMLStreamReader(reader); try { JAXBElement<TLSClientParametersType> type = JAXBUtils.unmarshall(getContext(), data, TLSClientParametersType.class); TLSClientParametersType cpt = type.getValue(); return createTLSClientParametersFromType(cpt); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { try { StaxUtils.close(data); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } }
public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) { SOAPMessage msg = getMessage(); SOAPHeader header; try { header = msg.getSOAPPart().getEnvelope().getHeader(); if (header == null || !header.hasChildNodes()) { return new Object[0]; } List<Object> ret = new ArrayList<>(); Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements()); while (it.hasNext()) { SOAPHeaderElement she = it.next(); if ((allRoles || roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(JAXBUtils.unmarshall(context, she)); } } return ret.toArray(new Object[0]); } catch (SOAPException | JAXBException e) { throw new WebServiceException(e); } }
public DomainExpression build(Element e) { Object obj = null; try { obj = JAXBUtils.unmarshall(createJAXBContext(), e); } catch (JAXBException ex) { throw new PolicyException(new Message("EPR_DOMAIN_EXPRESSION_BUILD_EXC", BUNDLE, (Object[])null), ex); } if (obj instanceof JAXBElement<?>) { JAXBElement<?> el = (JAXBElement<?>)obj; obj = el.getValue(); } EndpointReferenceDomainExpression eprde = new EndpointReferenceDomainExpression(); eprde.setEndpointReference((EndpointReferenceType)obj); return eprde; }
public DomainExpression build(Element e) { Object obj = null; try { obj = JAXBUtils.unmarshall(createJAXBContext(), e); } catch (JAXBException ex) { throw new PolicyException(new Message("EPR_DOMAIN_EXPRESSION_BUILD_EXC", BUNDLE, (Object[])null), ex); } if (obj instanceof JAXBElement<?>) { JAXBElement<?> el = (JAXBElement<?>)obj; obj = el.getValue(); } EndpointReferenceDomainExpression eprde = new EndpointReferenceDomainExpression(); eprde.setEndpointReference((EndpointReferenceType)obj); return eprde; }