private String getPersistenceModuleId(final AppModule appModule) { if (appModule.getModuleId() != null) { return appModule.getModuleId(); } for (final EjbModule ejbModule : appModule.getEjbModules()) { if (ejbModule.getModuleId() != null) { return ejbModule.getModuleId(); } } throw new IllegalStateException("Comp must be in an ejb module, this one has none: " + appModule); }
private void writeGeronimoOpenejb(EjbModule ejbModule) { try { GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getAltDDs().get("geronimo-openejb.xml"); if (geronimoEjbJarType == null) return; File tempFile = File.createTempFile("geronimo-openejb-", ejbModule.getModuleId() + ".xml"); FileOutputStream fout = new FileOutputStream(tempFile); BufferedOutputStream out = new BufferedOutputStream(fout); try { JaxbOpenejbJar2.marshal(GeronimoEjbJarType.class, geronimoEjbJarType, out); logger.info("Dumping Generated geronimo-openejb.xml to: " + tempFile.getAbsolutePath()); } catch (JAXBException e) { } finally { out.close(); } } catch (Exception e) { } }
private void writeEjbJar(EjbModule ejbModule) { try { EjbJar ejbJar = ejbModule.getEjbJar(); File tempFile = File.createTempFile("ejb-jar-", ejbModule.getModuleId() + ".xml"); FileOutputStream fout = new FileOutputStream(tempFile); BufferedOutputStream out = new BufferedOutputStream(fout); try { JaxbJavaee.marshal(EjbJar.class, ejbJar, out); logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (JAXBException e) { } finally { out.close(); } } catch (Exception e) { } } }
private void writeOpenejbJar(EjbModule ejbModule) { try { OpenejbJar openejbJar = ejbModule.getOpenejbJar(); File tempFile = File.createTempFile("openejb-jar-", ejbModule.getModuleId() + ".xml"); FileOutputStream fout = new FileOutputStream(tempFile); BufferedOutputStream out = new BufferedOutputStream(fout); try { JaxbOpenejbJar3.marshal(OpenejbJar.class, openejbJar, out); logger.info("Dumping Generated openejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (JAXBException e) { } finally { out.close(); } } catch (Exception e) { } }
private String getPersistenceModuleId(final AppModule appModule) { if (appModule.getModuleId() != null) { return appModule.getModuleId(); } for (final EjbModule ejbModule : appModule.getEjbModules()) { return ejbModule.getModuleId(); } throw new IllegalStateException("Comp must be in an ejb module, this one has none: " + appModule); }
public void validate(final EjbModule ejbModule) { if (ejbModule.getFinder() == null || ejbModule.getProperties().containsKey("openejb.cdi.activated")) { return; } if (ejbModule.getBeans() == null && hasAtInject(ejbModule.getFinder())) { warn(ejbModule.getModuleId(), "cdi.notEnabled", ejbModule.getModuleId()); } }
public void validate(final EjbModule ejbModule) { if (ejbModule.getFinder() == null || ejbModule.getProperties().containsKey("openejb.cdi.activated")) { return; } if (ejbModule.getBeans() == null && hasAtInject(ejbModule.getFinder())) { warn(ejbModule.getModuleId(), "cdi.notEnabled", ejbModule.getModuleId()); } }
public WebModule relativeWebModule() { if (!isWebApp()) { return null; } for (final WebModule webModule : module.getAppModule().getWebModules()) { if (webModule.getModuleId().equals(module.getModuleId())) { return webModule; } } return null; } }
@Override public void validate(final AppModule appModule) { final List<String> validated = new ArrayList<String>(); for (final WebModule webModule : safe(appModule.getWebModules())) { validated.add(webModule.getModuleId()); validateWebModule(webModule); } for (final EjbModule ejbModule : safe(appModule.getEjbModules())) { //without this check, CheckDescriptorLocationTest#testWarWithDescriptorInRoot() would fail if (!validated.contains(ejbModule.getModuleId())) { validateEjbModule(ejbModule); } } }
@Override public void validate(final AppModule appModule) { final List<String> validated = new ArrayList<String>(); for (final WebModule webModule : safe(appModule.getWebModules())) { validated.add(webModule.getModuleId()); validateWebModule(webModule); } for (final EjbModule ejbModule : safe(appModule.getEjbModules())) { //without this check, CheckDescriptorLocationTest#testWarWithDescriptorInRoot() would fail if (!validated.contains(ejbModule.getModuleId())) { validateEjbModule(ejbModule); } } }
public void addScanningResult(@Observes final BeforeAppInfoBuilderEvent event) throws Exception { for (final EjbModule ejbModule : event.getAppModule().getEjbModules()) { // ear if (ejbModule.getModuleId().startsWith("ear-scoped-cdi-beans")) { doMerge(ejbModule); return; } } // else a war for (final WebModule webModule : event.getAppModule().getWebModules()) { for (final EjbModule ejbModule : event.getAppModule().getEjbModules()) { if (ejbModule.getModuleId().equals(webModule.getModuleId())) { doMerge(ejbModule); return; } } } }
public void convertModule(EjbModule ejbModule, EntityMappings entityMappings) { Map<String, EntityData> entities = new TreeMap<String, EntityData>(); if (entityMappings != null ) for (Entity entity : entityMappings.getEntity()) { entities.put(entity.getDescription(), new SunConversion.EntityData(entity)); } // merge data from sun-ejb-jar.xml file SunEjbJar sunEjbJar = getSunEjbJar(ejbModule); mergeEjbConfig(ejbModule, sunEjbJar); mergeEntityMappings(entities, ejbModule.getModuleId(), ejbModule.getEjbJar(), ejbModule.getOpenejbJar(), sunEjbJar); // merge data from sun-cmp-mappings.xml file SunCmpMappings sunCmpMappings = getSunCmpMappings(ejbModule); if (sunCmpMappings != null) { for (SunCmpMapping sunCmpMapping : sunCmpMappings.getSunCmpMapping()) { mergeEntityMappings(entities, ejbModule.getModuleId(), ejbModule, entityMappings, sunCmpMapping); } } }
public void convertModule(final EjbModule ejbModule, final EntityMappings entityMappings) { final Map<String, EntityData> entities = new TreeMap<String, EntityData>(); if (entityMappings != null) { for (final Entity entity : entityMappings.getEntity()) { entities.put(entity.getDescription(), new EntityData(entity)); } } // merge data from sun-ejb-jar.xml file final SunEjbJar sunEjbJar = getSunEjbJar(ejbModule); mergeEjbConfig(ejbModule, sunEjbJar); mergeEntityMappings(entities, ejbModule.getModuleId(), ejbModule.getEjbJar(), ejbModule.getOpenejbJar(), sunEjbJar); // merge data from sun-cmp-mappings.xml file final SunCmpMappings sunCmpMappings = getSunCmpMappings(ejbModule); if (sunCmpMappings != null) { for (final SunCmpMapping sunCmpMapping : sunCmpMappings.getSunCmpMapping()) { mergeEntityMappings(entities, ejbModule.getModuleId(), ejbModule, entityMappings, sunCmpMapping); } } }
private void writeOpenejbJar(final EjbModule ejbModule) { try { final OpenejbJar openejbJar = ejbModule.getOpenejbJar(); final File tempFile = tempFile("openejb-jar-", ejbModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { JaxbOpenejbJar3.marshal(OpenejbJar.class, openejbJar, out); logger.info("Dumping Generated openejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final Exception e) { // no-op } }
@Override public final AppModule deploy(final AppModule appModule) { for (final EjbModule ejbModule : appModule.getEjbModules()) { final Object altDD = getOpenejbJarType(ejbModule); if (OpenejbJarType.class.isInstance(altDD)) { final OpenejbJarType openejbJarType = OpenejbJarType.class.cast(altDD); convertEjbRefs(ejbModule.getEjbJar(), ejbModule.getOpenejbJar(), openejbJarType); convertMdbConfigs(ejbModule.getEjbJar(), openejbJarType); mergeEntityMappings(ejbModule.getModuleId(), appModule.getCmpMappings(), ejbModule.getOpenejbJar(), openejbJarType); } } return appModule; }
@Override public final AppModule deploy(final AppModule appModule) { for (final EjbModule ejbModule : appModule.getEjbModules()) { final Object altDD = getOpenejbJarType(ejbModule); if (OpenejbJarType.class.isInstance(altDD)) { final OpenejbJarType openejbJarType = OpenejbJarType.class.cast(altDD); convertEjbRefs(ejbModule.getEjbJar(), ejbModule.getOpenejbJar(), openejbJarType); convertMdbConfigs(ejbModule.getEjbJar(), openejbJarType); mergeEntityMappings(ejbModule.getModuleId(), appModule.getCmpMappings(), ejbModule.getOpenejbJar(), openejbJarType); } } return appModule; }
private void readEjbJar(EjbModule ejbModule, AppModule appModule) throws OpenEJBException { if (ejbModule.getEjbJar() != null) return; Object data = ejbModule.getAltDDs().get("ejb-jar.xml"); if (data instanceof EjbJar) { ejbModule.setEjbJar((EjbJar) data); } else if (data instanceof URL) { URL url = (URL) data; EjbJar ejbJar = readEjbJar(url); ejbModule.setEjbJar(ejbJar); } else { DeploymentLoader.logger.debug("No ejb-jar.xml found assuming annotated beans present: " + appModule.getJarLocation() + ", module: " + ejbModule.getModuleId()); ejbModule.setEjbJar(new EjbJar()); } }
public void readEjbJar(final EjbModule ejbModule, final AppModule appModule) throws OpenEJBException { if (ejbModule.getEjbJar() != null) { return; } final Source data = getSource(ejbModule.getAltDDs().get("ejb-jar.xml")); if (data != null) { try { final EjbJar ejbJar = readEjbJar(data.get()); ejbModule.setEjbJar(ejbJar); } catch (final IOException e) { throw new OpenEJBException(e); } } else { DeploymentLoader.logger.debug("No ejb-jar.xml found assuming annotated beans present: " + appModule.getJarLocation() + ", module: " + ejbModule.getModuleId()); ejbModule.setEjbJar(new EjbJar()); } }
public void readEjbJar(final EjbModule ejbModule, final AppModule appModule) throws OpenEJBException { if (ejbModule.getEjbJar() != null) { return; } final Source data = getSource(ejbModule.getAltDDs().get("ejb-jar.xml")); if (data != null) { try { final EjbJar ejbJar = readEjbJar(data.get()); ejbModule.setEjbJar(ejbJar); } catch (final IOException e) { throw new OpenEJBException(e); } } else { DeploymentLoader.logger.debug("No ejb-jar.xml found assuming annotated beans present: " + appModule.getJarLocation() + ", module: " + ejbModule.getModuleId()); ejbModule.setEjbJar(new EjbJar()); } }
public AppModule deploy(AppModule appModule) { for (EjbModule ejbModule : appModule.getEjbModules()) { Object altDD = getOpenejbJarType(ejbModule); if (altDD instanceof OpenejbJarType) { convertEjbRefs(ejbModule.getEjbJar(), ejbModule.getOpenejbJar(), (OpenejbJarType) altDD); convertMdbConfigs(ejbModule.getEjbJar(), (OpenejbJarType) altDD); mergeEntityMappings(ejbModule.getModuleId(), appModule.getCmpMappings(), ejbModule.getOpenejbJar(), (OpenejbJarType) altDD); } } return appModule; }