Created
February 19, 2014 23:59
-
-
Save jeanouii/9104167 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 feature = new Service("wadlxGenerator", null); | |
| feature.setClassName(WadlGenerator.class.getName()); | |
| // for now, we just deal with one WebModule (Collapsed EAR) and of course one EjbModule | |
| final WebModule webModule = event.getAppModule().getWebModules().get(0); | |
| for (EjbModule ejbModule : event.getAppModule().getEjbModules()) { | |
| ejbModule.getAppModule().getServices().add(feature); | |
| // 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())) { | |
| pojo.getProperties().setProperty("cxf.jaxrs.providers", "wadlxGenerator"); | |
| found = true; | |
| } | |
| } | |
| if (!found) { | |
| final PojoDeployment e = new PojoDeployment(); | |
| e.setClassName("jaxrs-application"); | |
| e.getProperties().setProperty("cxf.jaxrs.providers", "wadlGenerator"); | |
| openejbJar.getPojoDeployment().add(e); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment