InputStream in = wsDDUrl.openStream(); try { return (Webservices) JaxbJavaee.unmarshalJavaee(Webservices.class, in); } catch (Exception e) { throw new DeploymentException("Could not read descriptor document", e);
public static JavaWsdlMapping readJaxrpcMapping(JarFile moduleFile, String jaxrpcMappingPath) throws DeploymentException { InputStream jaxrpcInputStream; try { ZipEntry zipEntry = moduleFile.getEntry(jaxrpcMappingPath); if (zipEntry == null) { throw new DeploymentException("The JAX-RPC mapping file " + jaxrpcMappingPath + " specified in webservices.xml could not be found."); } jaxrpcInputStream = moduleFile.getInputStream(zipEntry); } catch (IOException e) { throw new DeploymentException("Could not open stream to jaxrpc mapping document", e); } try { return (JavaWsdlMapping) JaxbJavaee.unmarshalJavaee(JavaWsdlMapping.class, jaxrpcInputStream); } catch (Exception e) { throw new DeploymentException("Could not parse jaxrpc mapping document", e); } finally { try { jaxrpcInputStream.close(); } catch (IOException e) { } } }
public static JavaWsdlMapping readJaxrpcMapping(final URL url) throws OpenEJBException { final JavaWsdlMapping wsdlMapping; try { wsdlMapping = (JavaWsdlMapping) JaxbJavaee.unmarshalJavaee(JavaWsdlMapping.class, IO.read(url)); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the JaxRPC mapping file: " + url.toExternalForm(), e); } catch (final JAXBException e) { throw new OpenEJBException("Cannot unmarshall the JaxRPC mapping file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the JaxRPC mapping file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the JaxRPC mapping file: " + url.toExternalForm(), e); } return wsdlMapping; }
public static JavaWsdlMapping readJaxrpcMapping(final URL url) throws OpenEJBException { final JavaWsdlMapping wsdlMapping; try { wsdlMapping = (JavaWsdlMapping) JaxbJavaee.unmarshalJavaee(JavaWsdlMapping.class, IO.read(url)); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the JaxRPC mapping file: " + url.toExternalForm(), e); } catch (final JAXBException e) { throw new OpenEJBException("Cannot unmarshall the JaxRPC mapping file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the JaxRPC mapping file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the JaxRPC mapping file: " + url.toExternalForm(), e); } return wsdlMapping; }
private void readCmpOrm(final EjbModule ejbModule) throws OpenEJBException { final Object data = ejbModule.getAltDDs().get("openejb-cmp-orm.xml"); if (data == null || data instanceof EntityMappings) { return; } else if (data instanceof URL) { final URL url = (URL) data; try { final EntityMappings entitymappings = (EntityMappings) JaxbJavaee.unmarshalJavaee(EntityMappings.class, IO.read(url)); ejbModule.getAltDDs().put("openejb-cmp-orm.xml", entitymappings); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } catch (final JAXBException e) { throw new OpenEJBException("Cannot unmarshall the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } } }
private void readCmpOrm(final EjbModule ejbModule) throws OpenEJBException { final Object data = ejbModule.getAltDDs().get("openejb-cmp-orm.xml"); if (data != null && !(data instanceof EntityMappings)) { if (data instanceof URL) { final URL url = (URL) data; try { final EntityMappings entitymappings = (EntityMappings) JaxbJavaee.unmarshalJavaee(EntityMappings.class, IO.read(url)); ejbModule.getAltDDs().put("openejb-cmp-orm.xml", entitymappings); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } catch (final JAXBException e) { throw new OpenEJBException("Cannot unmarshall the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the openejb-cmp-orm.xml file: " + url.toExternalForm(), e); } } } }
public static Connector readConnector(final URL url) throws OpenEJBException { Connector connector; try { connector = (Connector) JaxbJavaee.unmarshalJavaee(Connector.class, IO.read(url)); } catch (final JAXBException e) { try { final Connector10 connector10 = (Connector10) JaxbJavaee.unmarshalJavaee(Connector10.class, IO.read(url)); connector = Connector.newConnector(connector10); } catch (final ParserConfigurationException e1) { throw new OpenEJBException("Cannot parse the ra.xml file: " + url.toExternalForm(), e); } catch (final SAXException e1) { throw new OpenEJBException("Cannot parse the ra.xml file: " + url.toExternalForm(), e); } catch (final JAXBException e1) { throw new OpenEJBException("Cannot unmarshall the ra.xml file: " + url.toExternalForm(), e); } catch (final IOException e1) { throw new OpenEJBException("Cannot read the ra.xml file: " + url.toExternalForm(), e); } } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the ra.xml file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the ra.xml file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the ra.xml file: " + url.toExternalForm(), e); } return connector; }
public static Connector readConnector(final URL url) throws OpenEJBException { Connector connector; try { connector = (Connector) JaxbJavaee.unmarshalJavaee(Connector.class, IO.read(url)); } catch (final JAXBException e) { try { final Connector10 connector10 = (Connector10) JaxbJavaee.unmarshalJavaee(Connector10.class, IO.read(url)); connector = Connector.newConnector(connector10); } catch (final ParserConfigurationException | SAXException e1) { throw new OpenEJBException("Cannot parse the ra.xml file: " + url.toExternalForm(), e); } catch (final JAXBException e1) { throw new OpenEJBException("Cannot unmarshall the ra.xml file: " + url.toExternalForm(), e); } catch (final IOException e1) { throw new OpenEJBException("Cannot read the ra.xml file: " + url.toExternalForm(), e); } } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the ra.xml file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the ra.xml file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the ra.xml file: " + url.toExternalForm(), e); } return connector; }
public static Beans readBeans(final InputStream inputStream) throws OpenEJBException { try { final String content = IO.slurp(inputStream); if (isEmptyBeansXml(new ByteArrayInputStream(content.getBytes()))) { return new Beans(); } return (Beans) JaxbJavaee.unmarshalJavaee(Beans.class, new ByteArrayInputStream(content.getBytes())); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the beans.xml", e);// file: " + url.toExternalForm(), e); } catch (final JAXBException e) { e.printStackTrace(); throw new OpenEJBException("Cannot unmarshall the beans.xml", e);// file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the beans.xml", e);// file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the beans.xml", e);// file: " + url.toExternalForm(), e); } }
public static Beans readBeans(final InputStream inputStream) throws OpenEJBException { try { final String content = IO.slurp(inputStream).trim(); if (content.length() == 0) { // otherwise we want to read <beans /> attributes final Beans beans = new Beans(); beans.setBeanDiscoveryMode("ALL"); // backward compatibility return beans; } return (Beans) JaxbJavaee.unmarshalJavaee(Beans.class, new ByteArrayInputStream(content.getBytes())); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the beans.xml", e);// file: " + url.toExternalForm(), e); } catch (final JAXBException e) { e.printStackTrace(); throw new OpenEJBException("Cannot unmarshall the beans.xml", e);// file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the beans.xml", e);// file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered unknown error parsing the beans.xml", e);// file: " + url.toExternalForm(), e); } }
while ((entry = in.getNextEntry()) != null) { if (entry.getName().equals("META-INF/web-fragment.xml")) { webFragment = (WebFragment) JaxbJavaee.unmarshalJavaee(WebFragment.class, in); break;
InputStream in = specDDUrl.openStream(); try { connector = (Connector) JaxbJavaee.unmarshalJavaee(Connector.class, in); } catch (JAXBException e) { in.close(); in = specDDUrl.openStream(); Connector10 connector10 = (Connector10) JaxbJavaee.unmarshalJavaee(Connector10.class, in); connector = Connector.newConnector(connector10); } finally {
application = (Application) JaxbJavaee.unmarshalJavaee(Application.class, in); } finally { IOUtils.close(in);
in = new BufferedInputStream(wsDDUrl.openStream()); Webservices wst = (Webservices) JaxbJavaee.unmarshalJavaee(Webservices.class, in); for (WebserviceDescription desc : wst.getWebserviceDescription()) { String wsdlFile = null;