Created
February 25, 2014 14:34
-
-
Save jeanouii/9209938 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void beforeInfoTreeBuilder(@Observes final BeforeAppInfoBuilderEvent event) { | |
| final Service wadlxGenerator = new Service(WADLX_GENERATOR_ID, null); | |
| wadlxGenerator.setClassName(WadlGenerator.class.getName()); | |
| // for now, we just deal with one WebModule (Collapsed EAR) and of course one EjbModule | |
| final Iterator<WebModule> iterator = event.getAppModule().getWebModules().iterator(); | |
| if (!iterator.hasNext()) return; | |
| final WebModule webModule = iterator.next(); | |
| for (EjbModule ejbModule : event.getAppModule().getEjbModules()) { | |
| ejbModule.getAppModule().getServices().add(wadlxGenerator); | |
| // get the openejb-jar or create if none | |
| OpenejbJar openejbJar = ejbModule.getOpenejbJar(); | |
| if (openejbJar == null) { | |
| openejbJar = new OpenejbJar(); | |
| ejbModule.setOpenejbJar(openejbJar); | |
| } | |
| // get the PojoDeployment for the REST application or create if none | |
| boolean found = false; | |
| for (PojoDeployment pojo : openejbJar.getPojoDeployment()) { | |
| if (webModule.getRestApplications().contains(pojo.getClassName())) { | |
| LOGGER.debug("Found application for class " + pojo.getClassName()); | |
| addProviderProperty(pojo, WADLX_GENERATOR_ID); | |
| found = true; | |
| } | |
| } | |
| if (!found) { | |
| LOGGER.debug("No application found. Creating one configuration for the default jaxrs-application."); | |
| final PojoDeployment pojo = new PojoDeployment(); | |
| pojo.setClassName("jaxrs-application"); // default application | |
| addProviderProperty(pojo, WADLX_GENERATOR_ID); | |
| openejbJar.getPojoDeployment().add(pojo); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public void beforeInfoTreeBuilder(@observes final BeforeAppInfoBuilderEvent event) {
for (final WebModule webModule : event.getAppModule().getWebModules()) {
}
}
}