private void buildWebModules(final AppModule appModule, final JndiEncInfoBuilder jndiEncInfoBuilder, final AppInfo appInfo) throws OpenEJBException { for (final WebModule webModule : appModule.getWebModules()) { final WebApp webApp = webModule.getWebApp(); final WebAppInfo webAppInfo = new WebAppInfo(); webAppInfo.description = webApp.getDescription(); webAppInfo.displayName = webApp.getDisplayName(); webAppInfo.path = webModule.getJarLocation(); webAppInfo.moduleId = webModule.getModuleId(); webAppInfo.watchedResources.addAll(webModule.getWatchedResources()); webAppInfo.validationInfo = ValidatorBuilder.getInfo(webModule.getValidationConfig()); webAppInfo.uniqueId = webModule.getUniqueId(); webAppInfo.restApplications.addAll(webModule.getRestApplications()); webAppInfo.restClass.addAll(webModule.getRestClasses()); webAppInfo.ejbWebServices.addAll(webModule.getEjbWebServices()); webAppInfo.ejbRestServices.addAll(webModule.getEjbRestServices()); webAppInfo.jaxRsProviders.addAll(webModule.getJaxrsProviders()); for (final Map.Entry<String, Set<String>> entry : webModule.getWebAnnotatedClasses().entrySet()) { final ClassListInfo info = new ClassListInfo(); info.name = entry.getKey(); for (final Map.Entry<String, Set<String>> entry : webModule.getJsfAnnotatedClasses().entrySet()) { final ClassListInfo info = new ClassListInfo(); info.name = entry.getKey(); webAppInfo.host = webModule.getHost(); if (!webModule.isStandaloneModule() && USE_EAR_AS_CONTEXT_ROOT_BASE) { webAppInfo.contextRoot = appModule.getModuleId() + "/" + webModule.getContextRoot(); } else {
WebModule webModule = new WebModule(webApp, contextRoot, warClassLoader, warFile.getAbsolutePath(), moduleName); webModule.getAltDDs().putAll(descriptors); webModule.getWatchedResources().add(warPath); webModule.getWatchedResources().add(warFile.getAbsolutePath()); if (webXmlUrl != null && "file".equals(webXmlUrl.getProtocol())) { webModule.getWatchedResources().add(URLs.toFilePath(webXmlUrl));
File warFile = new File(webModule.getJarLocation()); WebApp webApp = webModule.getWebApp(); if (webApp != null) { for (JspConfig jspConfig : webApp.getJspConfig()) { ClassLoader parentClassLoader = webModule.getClassLoader().getParent(); urls = scanClassLoaderForTagLibs(parentClassLoader); tldLocations.addAll(urls); webModule.getTaglibs().add(taglib); if ("file".equals(location.getProtocol())) { webModule.getWatchedResources().add(URLs.toFilePath(location));
private String findHost(final String id, final Collection<WebModule> webModules) { for (final WebModule w: webModules) { if (w.getModuleId().equals(id)) { final String host = w.getHost(); return host != null ? host : "localhost"; } } return "localhost"; }
private void deploy(final WebModule webModule, final AppResources appResources) throws OpenEJBException { processJndiRefs(webModule.getModuleId(), webModule.getWebApp(), appResources, webModule.getClassLoader()); }
private void deploy(WebModule webModule, AppResources appResources) throws OpenEJBException { processJndiRefs(webModule.getModuleId(), webModule.getWebApp(), appResources); }
public WebModule deploy(final WebModule webModule) throws OpenEJBException { WebApp webApp = webModule.getWebApp(); if (webApp != null && webApp.isMetadataComplete()) { return webModule; if (webModule.getFinder() == null) { webModule.setFinder(FinderFactory.createFinder(webModule)); webModule.setWebApp(webApp); final IAnnotationFinder finder = webModule.getFinder(); final List<Class> classes = new ArrayList<Class>(); classes.addAll(finder.findAnnotatedClasses(WebService.class)); webModule.getEjbWebServices().add(webServiceClass.getName()); continue; restHandledByTheWebApp = webModule.getClassLoader().loadClass(Application.class.getName()) != Application.class; } catch (final Throwable e) { // ClassNotFoundException or NoClassDefFoundError restHandledByTheWebApp = false; webModule.getRestClasses().addAll(findRestClasses(webModule, finder)); addJaxRsProviders(finder, webModule.getJaxrsProviders(), Provider.class); final AppModule appModule = webModule.getAppModule(); if (appModule != null) { parentFinder = appModule.getEarLibFinder(); } else { logger.info("Web module has no App module: " + webModule.toString());
final WebApp webApp = webModule.getWebApp(); if (webApp != null && webApp.isMetadataComplete()) { return webModule; final ClassLoader classLoader = webModule.getClassLoader(); webModule.getRestApplications().clear(); webModule.getRestApplications().add(webXmlApplication); final Collection<String> restApp = webModule.getRestApplications(); if (restApp.isEmpty()) { addRestClassesToScannedClasses(webModule, classes, classLoader); if ("javax.ws.rs.core.Application".equals(servletName)) { servlet.setServletName(ProvidedJAXRSApplication.class.getName()); webModule.getRestApplications().add(ProvidedJAXRSApplication.class.getName()); for (final ServletMapping mapping : webApp.getServletMapping()) { if (servletName.equals(mapping.getServletName())) { webModule.getRestApplications().clear(); webModule.getRestApplications().add(param.getParamValue()); break; for (final TldTaglib taglib : webModule.getTaglibs()) { if (webModule.getWebservices() != null) { for (final WebserviceDescription webservice : webModule.getWebservices().getWebserviceDescription()) { for (final PortComponent port : webservice.getPortComponent()) {
private void buildWebModules(AppModule appModule, JndiEncInfoBuilder jndiEncInfoBuilder, AppInfo appInfo) throws OpenEJBException { for (WebModule webModule : appModule.getWebModules()) { WebApp webApp = webModule.getWebApp(); WebAppInfo webAppInfo = new WebAppInfo(); webAppInfo.description = webApp.getDescription(); webAppInfo.displayName = webApp.getDisplayName(); webAppInfo.codebase = webModule.getJarLocation(); webAppInfo.moduleId = webModule.getModuleId(); webAppInfo.watchedResources.addAll(webModule.getWatchedResources()); webAppInfo.host = webModule.getHost(); webAppInfo.contextRoot = webModule.getContextRoot(); webAppInfo.jndiEnc = jndiEncInfoBuilder.build(webApp, webModule.getJarLocation(), webAppInfo.moduleId); webAppInfo.portInfos.addAll(configureWebservices(webModule.getWebservices())); configureWebserviceSecurity(webAppInfo, webModule); for (Servlet servlet : webModule.getWebApp().getServlet()) { ServletInfo servletInfo = new ServletInfo(); servletInfo.servletName = servlet.getServletName(); servletInfo.servletClass = servlet.getServletClass(); webAppInfo.servlets.add(servletInfo); } appInfo.webApps.add(webAppInfo); } }
private void processPorts(final WebModule webModule) throws OpenEJBException { Webservices webservices = webModule.getWebservices(); final Map<String, PortComponent> portMap = new TreeMap<String, PortComponent>(); if (webservices != null) { final WebApp webApp = webModule.getWebApp(); final Map<String, ServletMapping> servletMappings = new TreeMap<String, ServletMapping>(); for (final ServletMapping servletMapping : webApp.getServletMapping()) { final Class<?> clazz = webModule.getClassLoader().loadClass(className); if (JaxWsUtils.isWebService(clazz)) { webModule.setWebservices(webservices); portComponent.setId(webModule.getHost() + "." + webModule.getModuleId() + "." + servlet.getServletName()); webserviceDescription.setId(webModule.getHost() + "." + webModule.getModuleId() + "." + servlet.getServletName()); webserviceDescription.setWsdlFile(JaxWsUtils.getServiceWsdlLocation(clazz, webModule.getClassLoader())); final HandlerChains handlerChains = getHandlerChains(clazz, portComponent.getServiceEndpointInterface(), webModule.getClassLoader()); portComponent.setHandlerChains(handlerChains);
final File warFile = new File(webModule.getJarLocation()); final WebApp webApp = webModule.getWebApp(); if (webApp != null) { final String foundContextParam = webApp.contextParamsAsMap().get("javax.faces.CONFIG_FILES"); webModule.getFacesConfigs().add(facesConfig); if ("file".equals(location.getProtocol())) { webModule.getWatchedResources().add(URLs.toFilePath(location));
appModule.getAdditionalLibraries().addAll(webModule.getUrls()); final Object o = webModule.getAltDDs().get("persistence.xml"); final EjbModule webEjbModule = new EjbModule(webModule.getClassLoader(), webModule.getModuleId(), webModule.getJarLocation(), null, null); webEjbModule.setWebapp(true); webEjbModule.getAltDDs().putAll(webModule.getAltDDs()); appModule.getEjbModules().add(webEjbModule); if (webModule.getFinder() == null) { if (isMetadataComplete(webModule, webEjbModule)) { final IAnnotationFinder finder = new org.apache.xbean.finder.AnnotationFinder(new ClassesArchive()); webModule.setFinder(finder); webEjbModule.setFinder(finder); } else { final IAnnotationFinder finder = FinderFactory.createFinder(webModule); webModule.setFinder(finder); webEjbModule.setFinder(finder); webEjbModule.setFinder(webModule.getFinder()); throw new OpenEJBException("Unable to create annotation scanner for web module " + webModule.getModuleId(), e);
final WebModule webModule = new WebModule(webApp, contextRoot, warClassLoader, warFile.getAbsolutePath(), moduleName); webModule.setUrls(webUrls); webModule.setAddedUrls(addedUrls); webModule.setRarUrls(Arrays.asList(urls.get(RAR_URLS_KEY))); webModule.setScannableUrls(scannableUrls); webModule.getAltDDs().putAll(descriptors); webModule.getWatchedResources().add(warPath); webModule.getWatchedResources().add(warFile.getAbsolutePath()); if (webXmlUrl != null && "file".equals(webXmlUrl.getProtocol())) { webModule.getWatchedResources().add(URLs.toFilePath(webXmlUrl));
public WebModule deploy(WebModule webModule) throws OpenEJBException { WebApp webApp = webModule.getWebApp(); if (webApp != null && (webApp.isMetadataComplete())) return webModule; File file = new File(webModule.getJarLocation()); URL[] urls = DeploymentLoader.getWebappUrls(file); final ClassLoader webClassLoader = webModule.getClassLoader(); finder = new ClassFinder(webClassLoader, asList(urls)); webModule.setFinder(finder); } catch (Exception e) { startupLogger.warning("Unable to scrape for @WebService or @WebServiceProvider annotations. ClassFinder failed.", e); webModule.setWebApp(webApp);
private void addConnectorModules(final AppModule appModule, final WebModule webModule) throws OpenEJBException { if (webModule.getAltDDs().containsKey("ra.xml")) { final String jarLocation = new File(webModule.getJarLocation(), "/WEB-INF/classes").getAbsolutePath(); final ConnectorModule connectorModule = createConnectorModule(jarLocation, jarLocation, webModule.getClassLoader(), webModule.getModuleId() + "RA", (URL) webModule.getAltDDs().get("ra.xml")); appModule.getConnectorModules().add(connectorModule); for (final URL url : webModule.getRarUrls()) { try { final File file = URLs.toFile(url); if (file.getName().endsWith(".rar")) { final String jarLocation = file.getAbsolutePath(); final ConnectorModule connectorModule = createConnectorModule(jarLocation, jarLocation, webModule.getClassLoader(), null); appModule.getConnectorModules().add(connectorModule); for (final URL url : webModule.getScannableUrls()) { try { final File file = URLs.toFile(url); final ConnectorModule connectorModule = createConnectorModule(jarLocation, jarLocation, webModule.getClassLoader(), null); appModule.getConnectorModules().add(connectorModule);
private void readWebApp(WebModule webModule, AppModule appModule) throws OpenEJBException { if (webModule.getWebApp() != null) return; Object data = webModule.getAltDDs().get("web.xml"); if (data instanceof WebApp) { webModule.setWebApp((WebApp) data); } else if (data instanceof URL) { URL url = (URL) data; WebApp webApp = readWebApp(url); webModule.setWebApp(webApp); } else { DeploymentLoader.logger.debug("No web.xml found assuming annotated beans present: " + appModule.getJarLocation() + ", module: " + webModule.getModuleId()); webModule.setWebApp(new WebApp()); } }
final WebModule webModule = new WebModule(webapp, root, Thread.currentThread().getContextClassLoader(), "", root); thisJar = jarLocation(testClass); try { webModule.getAltDDs().putAll(DeploymentLoader.mapDescriptors(new ResourceFinder("", webModule.getClassLoader(), thisJar.toURI().toURL()))); webModule.getAltDDs().putAll(DeploymentLoader.getWebDescriptors(new File(thisJar.getParentFile().getParentFile(), "src/main/webapp"))); } catch (final IOException e) { throw new IllegalStateException(e); webModule.getAltDDs().putAll(additionalDescriptors); for (final Descriptors d : asList(testClass.getAnnotation(Descriptors.class), descriptors)) { if (d != null) { webModule.getAltDDs().putAll(descriptorsToMap(d)); webModule.setFinder(finder); ejbModule.setFinder(webModule.getFinder()); if (providersClasses != null) { OpenejbJar openejbJar = ejbModule.getOpenejbJar();
final String contextRoot = contextRoot(properties, module.getJarLocation()); if (contextRoot != null) { module.setContextRoot(contextRoot); module.setHost(host); modules.put(module.getModuleId(), module);
appModule.setStandloneWebModule(); final WebModule webModule = new WebModule(createWebApp(archive), contextRoot(archive.getName()), loader, "", appModule.getModuleId()); webModule.setUrls(additionalPaths); appModule.getWebModules().add(webModule); } else if (isEar) { // mainly for CDI TCKs final WebModule webModule = new WebModule(createWebApp(webArchive), contextRoot, webLoader, "", appModule.getModuleId() + "_" + contextRoot); webModule.setUrls(Collections.<URL>emptyList()); webModule.setScannableUrls(Collections.<URL>emptyList()); webModule.setFinder(finder); final EjbModule ejbModule = new EjbModule(webLoader, webModule.getModuleId(), null, webEjbJar, new OpenejbJar()); ejbModule.setBeans(webAppBeansXml); ejbModule.getAltDDs().putAll(webAltDD); appModule.getWebModules().iterator().next().setFinder(ejbModule.getFinder());
public WebModule deploy(final WebModule webModule) { for (final Map.Entry<String, String> entry : getEnvEntries(webModule).entrySet()) { final EnvEntry envEntry = new EnvEntry(entry.getKey(), "java.lang.String", entry.getValue()); apply(webModule.getWebApp(), envEntry, "WebApp"); } return webModule; }