@Test public void testReadCmpOrmDescriptor() throws Exception { final EjbModule ejbModule = new EjbModule(new EjbJar()); ejbModule.getAltDDs().put("openejb-cmp-orm.xml", getClass().getResource("test-openejb-cmp-orm.xml")); new ReadDescriptors().readCmpOrm(ejbModule); Assert.assertNotNull(ejbModule.getAltDDs().get("openejb-cmp-orm.xml")); Assert.assertTrue(EntityMappings.class.isInstance(ejbModule.getAltDDs().get("openejb-cmp-orm.xml"))); }
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.unmarshal(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); } } } }
ReadDescriptors implements DynamicDeployer { 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.unmarshal(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); } } } } }
ReadDescriptors implements DynamicDeployer { 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.unmarshal(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); } } } }  }
ReadDescriptors implements DynamicDeployer { 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.unmarshal(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); } } } }  @SuppressWarnings({"unchecked"}) AppModule deploy(final AppModule appModule); static void readResourcesXml(final Module module); static Resources check(final Resources resources); void readEjbJar(final EjbModule ejbModule, final AppModule appModule); static void checkDuplicatedByBeansXml(final Beans beans, final Beans complete); static ApplicationClient readApplicationClient(final URL url); static EjbJar readEjbJar(final InputStream is); static Beans readBeans(final InputStream inputStream); static Webservices readWebservices(final URL url); static HandlerChains readHandlerChains(final URL url); static JavaWsdlMapping readJaxrpcMapping(final URL url); static Connector readConnector(final URL url); static WebApp readWebApp(final URL url); static TldTaglib readTldTaglib(final URL url); static FacesConfig readFacesConfig(final URL url); }
ReadDescriptors implements DynamicDeployer { 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.unmarshal(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); } } } }  @SuppressWarnings({"unchecked"}) AppModule deploy(final AppModule appModule); static void readResourcesXml(final Module module); static Resources check(final Resources resources); void readEjbJar(final EjbModule ejbModule, final AppModule appModule); static void checkDuplicatedByBeansXml(final Beans beans, final Beans complete); static ApplicationClient readApplicationClient(final URL url); static EjbJar readEjbJar(final InputStream is); static Beans readBeans(final InputStream inputStream); static Webservices readWebservices(final URL url); static HandlerChains readHandlerChains(final URL url); static JavaWsdlMapping readJaxrpcMapping(final URL url); static Connector readConnector(final URL url); static WebApp readWebApp(final URL url); static TldTaglib readTldTaglib(final URL url); static FacesConfig readFacesConfig(final URL url); static final TldTaglib SKIP_TAGLIB; }