private EprNew convertEndpointReferenceType(final AbsItfEndpointReferenceType odlDesc, final Class<EprImpl> eprimpl) throws WSAddressingException { EprNew newDesc = null; try { // create new description final Constructor c = eprimpl.getConstructors()[0]; newDesc = (EprNew) c.newInstance(odlDesc); } catch (final IllegalArgumentException e) { throw new WSAddressingException(e); } catch (final InstantiationException e) { throw new WSAddressingException(e); } catch (final IllegalAccessException e) { throw new WSAddressingException(e); } catch (final InvocationTargetException e) { throw new WSAddressingException(e); } return newDesc; }
public WSAddressingException(final String faultCode, final String msg, final Throwable t) { super(msg, t); this.setFaultCode(faultCode); }
public ServiceRefImpl(final ServiceRefType model, final BPELElementImpl parent) { super(Constants._ServiceRef_QNAME, model, parent); try { if(this.model.getAny() instanceof Element) { this.epr = this.getReader().readEndpointReferenceType(((Element)this.model.getAny()).getOwnerDocument()); } else if((this.model.getAny() instanceof JAXBElement)&& (((JAXBElement)this.model.getAny()).getValue() instanceof com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType)) { this.epr = new EndpointReferenceTypeImpl(new URI("."), (com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType) ((JAXBElement)this.model.getAny()).getValue(), null); } else if(this.model.getAny() instanceof com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType) { this.epr = new EndpointReferenceTypeImpl(new URI("."), (com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType) this.model.getAny(), null); } } catch (final WSAddressingException e) { BPELStaticAnalysisImpl.getInstance().addError(new BPELErrorImpl(this, new BPELException("In one serviceRef => " + e.getMessage(), e))); } catch (final URISyntaxException e) { BPELStaticAnalysisImpl.getInstance().addError(new BPELErrorImpl(this, new BPELException("In one serviceRef => " + e.getMessage(), e))); } }
/** * Convert all wsdl element */ private RefNew convertReferenceParametersType(final AbsItfReferenceParametersType oldRef, final Class<RefImpl> refimpl) throws WSAddressingException { RefNew newRef = null; try { final Constructor c = refimpl.getConstructors()[0]; newRef = (RefNew) c.newInstance((AbsItfReferenceParametersType)oldRef); } catch (final IllegalArgumentException e) { throw new WSAddressingException(e); } catch (final InstantiationException e) { throw new WSAddressingException(e); } catch (final IllegalAccessException e) { throw new WSAddressingException(e); } catch (final InvocationTargetException e) { throw new WSAddressingException(e); } return newRef; }
/** * Private object initializations */ public static void createDefaultContext() throws WSAddressingException { final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); try { WSAddressingJAXBContext.jaxbContext = JAXBContext .newInstance(defaultObjectFactories.toArray(new Class[defaultObjectFactories.size()])); } catch (final JAXBException e) { throw new WSAddressingException(e); } }
public static void createContextWithOtherObjectFactories(List<Class> addedObjectFactories) throws WSAddressingException { final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); List<Class> objectFactories = new ArrayList<Class>(); objectFactories.addAll(defaultObjectFactories); if(addedObjectFactories != null) { objectFactories.addAll(addedObjectFactories); } try { WSAddressingJAXBContext.jaxbContext = JAXBContext .newInstance(objectFactories.toArray(new Class[objectFactories.size()])); } catch (final JAXBException e) { throw new WSAddressingException(e); } }
public WSAddressingWriterImpl() throws WSAddressingException { try { WSAddressingJAXBContext.createDefaultContext(); } catch (final WSAddressingException e) { throw new WSAddressingException(e); } }
public JAXBElement<MonitoringPropertiesType> convertElement2MonitoringPropertiesType(final Element pltElmt) throws WSAddressingException { JAXBElement<MonitoringPropertiesType> res = null; try { res = WSAddressing4AgreementJAXBContext.getJaxbContext().createUnmarshaller().unmarshal(pltElmt, MonitoringPropertiesType.class); } catch (final JAXBException e) { throw new WSAddressingException( "Failed to build Java bindings from WSDL descriptor XML document", e); } return res; }
public WSAddressingReaderImpl() throws WSAddressingException { try { WSAddressingJAXBContext.createDefaultContext(); } catch (final WSAddressingException e) { throw new WSAddressingException(e); } }
public WSAddressingReaderImpl(final List<Class> addedObjectFactories) throws WSAddressingException { try { WSAddressingJAXBContext.createContextWithOtherObjectFactories(addedObjectFactories); } catch (final WSAddressingException e) { throw new WSAddressingException(e); } }
/** * Private object initializations */ public static void createDefaultContext() throws WSAddressingException { final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // The EndpointReference schema resource is in the Jar where the class // is // loaded final URL schemaUrl = WSAddressing4AgreementJAXBContext.class.getResource("/" + "schema/ws-addr4agreement.xsd"); try { factory.newSchema(new StreamSource[] { new StreamSource(schemaUrl.openStream()) }); WSAddressing4AgreementJAXBContext.jaxbContext = JAXBContext .newInstance(defaultObjectFactories.toArray(new Class[defaultObjectFactories.size()])); } catch (final SAXException e) { throw new WSAddressingException(e); } catch (final IOException e) { throw new WSAddressingException(e); } catch (final JAXBException e) { throw new WSAddressingException(e); } }
public WSAddressingWriterImpl(List<Class> addedObjectFactories) throws WSAddressingException { try { WSAddressingJAXBContext.createContextWithOtherObjectFactories(addedObjectFactories); } catch (final WSAddressingException e) { throw new WSAddressingException(e); } }
public EndpointReferenceType readEndpointReferenceType(final URI uri) throws WSAddressingException { EndpointReferenceType desc = null; try { InputStream input = null; final File f = new File(uri.getPath()); if (f.exists()) { input = new FileInputStream(f); } else { input = uri.toURL().openStream(); } desc = this.readEndpointReferenceType(uri, new InputSource(input)); } catch (final MalformedURLException e) { throw new WSAddressingException("Can not get wsdl at: " + uri, e); } catch (final IOException e) { throw new WSAddressingException("Can not get wsdl at: " + uri, e); } catch (final SchemaException e) { throw new WSAddressingException("Can not get wsdl at: " + uri, e); } catch (final XmlException e) { throw new WSAddressingException("Can not get wsdl at: " + uri, e); } return desc; }
private static com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType convertStream2EndpointReferenceType( final Source stream) throws WSAddressingException { try { // TODO : Check if it is a Thread safe method final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType> schemaBinding = WSAddressingReaderImpl .getJaxbContext().createUnmarshaller().unmarshal(stream, com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType.class); return schemaBinding.getValue(); } catch (final JAXBException e) { throw new WSAddressingException( "Failed to build Java bindings from SchemaImpl descriptor XML document", e); } }
public static void createContextWithOtherObjectFactories(List<Class> addedObjectFactories) throws WSAddressingException { final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // The EndpointReference schema resource is in the Jar where the class // is // loaded final URL schemaUrl = WSAddressing4AgreementJAXBContext.class.getResource("/" + "schema/ws-addr4agreement.xsd"); List<Class> objectFactories = new ArrayList<Class>(); objectFactories.addAll(defaultObjectFactories); if(addedObjectFactories != null) { objectFactories.addAll(addedObjectFactories); } try { factory.newSchema(new StreamSource[] { new StreamSource(schemaUrl.openStream()) }); WSAddressing4AgreementJAXBContext.jaxbContext = JAXBContext .newInstance(objectFactories.toArray(new Class[objectFactories.size()])); } catch (final SAXException e) { throw new WSAddressingException(e); } catch (final IOException e) { throw new WSAddressingException(e); } catch (final JAXBException e) { throw new WSAddressingException(e); } }
private Element convertPolicy2Element(Policy p) throws WSAddressingException { Element res = null; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(out); p.serialize(writer); out.close(); String policy = out.toString() + "</wsp:Policy>"; InputStream input = new ByteArrayInputStream(policy.getBytes()); Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input); res = doc.getDocumentElement(); } catch (XMLStreamException e) { throw new WSAddressingException(e); } catch (IOException e) { throw new WSAddressingException(e); } catch (SAXException e) { throw new WSAddressingException(e); } catch (ParserConfigurationException e) { throw new WSAddressingException(e); } return res; }
@SuppressWarnings("unchecked") private static Document convertEndpointReferenceType2DOMElement(final QName tagName, final com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType def) throws WSAddressingException { Document doc = null; try { doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); // TODO : Check if it is a Thread safe method @SuppressWarnings("rawtypes") final JAXBElement element = new JAXBElement(tagName, def.getClass(), def); WSAddressingWriterImpl.getJaxbContext().createMarshaller().marshal(element, doc); } catch (final JAXBException ex) { throw new WSAddressingException( "Failed to build XML binding from SchemaImpl descriptor Java classes", ex); } catch (final ParserConfigurationException ex) { throw new WSAddressingException( "Failed to build XML binding from SchemaImpl descriptor Java classes", ex); } return doc; }
@SuppressWarnings("unchecked") private static String convertEndpointReferenceType2String( final com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType def) throws WSAddressingException { try { final StringWriter stringWriter = new StringWriter(); // TODO : Check if it is a Thread safe method @SuppressWarnings("rawtypes") final JAXBElement element = new JAXBElement(new QName(Constants.WSADDRESSING_NAMESPACE, Constants.ENDPOINT_ROOT_TAG), def.getClass(), def); WSAddressingWriterImpl.getJaxbContext().createMarshaller() .marshal(element, stringWriter); return stringWriter.toString(); } catch (final JAXBException e) { throw new WSAddressingException( "Failed to build XML binding from Agreement descriptor Java classes", e); } }
public EndpointReferenceType readEndpointReferenceType(final URI uri, final InputSource source) throws WSAddressingException { EndpointReferenceType desc = null; try { final Unmarshaller unmarshaller = WSAddressingJAXBContext.getJaxbContext() .createUnmarshaller(); final XMLReader xmlReader = XMLReaderFactory.createXMLReader(); final EasyXMLFilter filter = new EasyXMLFilter(xmlReader); final SAXSource saxSource = new SAXSource(filter, source); // TODO use SAX validation instead of JAXB validation // turn off the JAXB provider's default validation mechanism to // avoid duplicate validation // SchemaReaderImpl.getUnMarshaller().setValidating( false ); final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType> eprBinding = unmarshaller.unmarshal( saxSource, com.ebmwebsourcing.wsstar.jaxb.addressing.EndpointReferenceType.class); desc = new EndpointReferenceTypeImpl(uri, eprBinding.getValue(), this.getFeatures()); } catch (final XmlException e) { throw new WSAddressingException(e); } catch (final JAXBException e) { throw new WSAddressingException(e); } catch (final SAXException e) { throw new WSAddressingException(e); } return desc; }
public EndpointReferenceType readEndpointReferenceType(final Document document) throws WSAddressingException { EndpointReferenceType desc = null; try { URI uri = new URI("."); if(document.getDocumentURI() != null) { uri = new URI(document.getDocumentURI()); } desc = this.readEndpointReferenceType(uri, SourceHelper.convertDOMSource2InputSource(new DOMSource( document))); } catch (final URISyntaxException e) { throw new WSAddressingException(e); } catch (final XmlException e) { throw new WSAddressingException(e); } return desc; }