Author: rmannibucau
Date: Tue May 29 08:46:44 2012
New Revision: 1343602
URL: http://svn.apache.org/viewvc?rev=1343602&view=rev
Log:
adding servlets in httpcontext (arquillian)
Added:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServlet.java
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServletTest.java
Modified:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ServletInfo.java
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBNamingResource.java
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
openejb/trunk/openejb/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
Modified:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
(original)
+++
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
Tue May 29 08:46:44 2012
@@ -30,6 +30,8 @@ import javax.naming.NamingException;
import org.apache.openejb.assembler.Deployer;
import org.apache.openejb.assembler.classic.AppInfo;
import org.apache.openejb.assembler.classic.Info;
+import org.apache.openejb.assembler.classic.ServletInfo;
+import org.apache.openejb.assembler.classic.WebAppInfo;
import org.apache.openejb.loader.Options;
import org.apache.openejb.util.NetworkUtil;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
@@ -165,6 +167,21 @@ public abstract class TomEEContainer<Con
return new ProtocolDescription("Servlet 2.5");
}
+ public void addServlets(final HTTPContext httpContext, final AppInfo
appInfo) {
+ for (WebAppInfo webApps : appInfo.webApps) {
+ for (ServletInfo servlet : webApps.servlets) {
+ // weird but arquillianurl doesn't match the servlet url but
its context
+ httpContext.add(new Servlet(servlet.servletClass,
webApps.contextRoot));
+ /*
+ for (String mapping : servlet.mappings) {
+ httpContext.add(new Servlet(servlet.servletClass,
startWithSlash(uniqueSlash(webApps.contextRoot, mapping))));
+
+ }
+ */
+ }
+ }
+ }
+
public ProtocolMetaData deploy(Archive<?> archive) throws
DeploymentException {
try {
String tmpDir = configuration.getAppWorkingDir();
@@ -202,6 +219,7 @@ public abstract class TomEEContainer<Con
}
HTTPContext httpContext = new HTTPContext(LOCALHOST,
configuration.getHttpPort());
+
String arquillianServlet;
// Avoids "inconvertible types" error in windows build
final Object object = archive;
@@ -211,6 +229,7 @@ public abstract class TomEEContainer<Con
arquillianServlet = "/arquillian-protocol";
}
httpContext.add(new Servlet("ArquillianServletRunner",
arquillianServlet));
+ addServlets(httpContext, appInfo);
// we should probably get all servlets and add them to the context
return new ProtocolMetaData().addContext(httpContext);
@@ -254,4 +273,26 @@ public abstract class TomEEContainer<Con
public void undeploy(Descriptor descriptor) throws DeploymentException {
throw new UnsupportedOperationException("Not implemented");
}
+
+ private static String startWithSlash(final String s) {
+ if (s == null) {
+ return "/";
+ }
+ if (s.startsWith("/")) {
+ return s;
+ }
+ return "/" + s;
+ }
+
+ private static String uniqueSlash(final String contextRoot, final String
mapping) {
+ boolean ctxSlash = contextRoot.endsWith("/");
+ boolean mappingSlash = mapping.startsWith("/");
+ if (ctxSlash && mappingSlash) {
+ return contextRoot.substring(0, contextRoot.length() - 1) +
mapping;
+ }
+ if ((!ctxSlash && mappingSlash) || (ctxSlash && !mappingSlash)) {
+ return contextRoot + mapping;
+ }
+ return contextRoot + "/" + mapping;
+ }
}
Modified:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
(original)
+++
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
Tue May 29 08:46:44 2012
@@ -19,6 +19,7 @@ package org.apache.openejb.arquillian.em
import org.apache.openejb.AppContext;
import org.apache.openejb.arquillian.common.Files;
import org.apache.openejb.arquillian.common.TomEEContainer;
+import org.apache.openejb.assembler.classic.AppInfo;
import org.apache.tomee.embedded.Configuration;
import org.apache.tomee.embedded.Container;
import org.jboss.arquillian.container.spi.client.container.DeploymentException;
@@ -38,13 +39,10 @@ import javax.enterprise.inject.spi.BeanM
import javax.naming.Context;
import java.io.File;
import java.util.Map;
-import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
public class EmbeddedTomEEContainer extends
TomEEContainer<EmbeddedTomEEConfiguration> {
- public static final String TOMEE_ARQUILLIAN_HTTP_PORT =
"tomee.arquillian.http";
- public static final String TOMEE_ARQUILLIAN_STOP_PORT =
"tomee.arquillian.stop";
private static final String LOCALHOST = "localhost";
@Inject
@@ -105,18 +103,20 @@ public class EmbeddedTomEEContainer exte
public ProtocolMetaData deploy(Archive<?> archive) throws
DeploymentException {
try {
-
final File tempDir = Files.createTempDir();
final String name = archive.getName();
final File file = new File(tempDir, name);
ARCHIVES.put(archive, file);
archive.as(ZipExporter.class).exportTo(file, true);
+ final AppContext appContext = container.deploy(name, file);
+ final AppInfo info = container.getInfo(name);
+ final String context = getArchiveNameWithoutExtension(archive);
+
+ final HTTPContext httpContext = new HTTPContext(LOCALHOST,
configuration.getHttpPort());
+ httpContext.add(new Servlet("ArquillianServletRunner", "/" +
context));
+ addServlets(httpContext, info);
- AppContext appContext = container.deploy(name, file);
-
- HTTPContext httpContext = new HTTPContext(LOCALHOST,
configuration.getHttpPort());
- httpContext.add(new Servlet("ArquillianServletRunner", "/" +
getArchiveNameWithoutExtension(archive)));
beanManagerInstance.set(appContext.getBeanManager());
return new ProtocolMetaData().addContext(httpContext);
} catch (Exception e) {
Added:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServlet.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServlet.java?rev=1343602&view=auto
==============================================================================
---
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServlet.java
(added)
+++
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServlet.java
Tue May 29 08:46:44 2012
@@ -0,0 +1,15 @@
+package org.apache.openejb.arquillian.tests.servlet;
+
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import javax.servlet.ServletException;
+
+@WebServlet(urlPatterns = "/simple")
+public class SimpleServlet extends HttpServlet {
+ protected void service(final HttpServletRequest req, final
HttpServletResponse resp) throws ServletException, IOException {
+ resp.getWriter().write("simple");
+ }
+}
Added:
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServletTest.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServletTest.java?rev=1343602&view=auto
==============================================================================
---
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServletTest.java
(added)
+++
openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/servlet/SimpleServletTest.java
Tue May 29 08:46:44 2012
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.servlet;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import org.apache.openejb.arquillian.tests.TestRun;
+import org.apache.openejb.arquillian.tests.TestSetup;
+import org.apache.openejb.arquillian.tests.resenventry.Blue;
+import org.apache.openejb.arquillian.tests.resenventry.Green;
+import org.apache.openejb.arquillian.tests.resenventry.Orange;
+import org.apache.openejb.arquillian.tests.resenventry.Purple;
+import org.apache.openejb.arquillian.tests.resenventry.Red;
+import org.apache.ziplock.WebModule;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+
+@RunWith(Arquillian.class)
+public class SimpleServletTest {
+ @ArquillianResource(SimpleServlet.class)
+ private URL url;
+
+ @Test
+ public void testRed() throws Exception {
+ validateTest("simple");
+ }
+
+ @Deployment(testable = false)
+ public static WebArchive getArchive() {
+ return new WebModule(SimpleServletTest.class).getArchive();
+ }
+
+ protected void validateTest(String expectedOutput) throws IOException {
+ final InputStream is = new URL(url + "simple").openStream();
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ int bytesRead;
+ byte[] buffer = new byte[8192];
+ while ((bytesRead = is.read(buffer)) > -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+
+ is.close();
+ os.close();
+
+ final String output = new String(os.toByteArray(), "UTF-8");
+ assertNotNull("Response shouldn't be null", output);
+ assertTrue("Output should contain: " + expectedOutput + "\n" + output,
output.contains(expectedOutput));
+ }
+}
+
+
+
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ServletInfo.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ServletInfo.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ServletInfo.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ServletInfo.java
Tue May 29 08:46:44 2012
@@ -16,8 +16,12 @@
*/
package org.apache.openejb.assembler.classic;
+import java.util.ArrayList;
+import java.util.List;
+
public class ServletInfo extends InfoObject {
public String servletName;
public String servletClass;
public String runAs;
+ public List<String> mappings = new ArrayList<String>();
}
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
Tue May 29 08:46:44 2012
@@ -346,6 +346,7 @@ class AppInfoBuilder {
ServletInfo servletInfo = new ServletInfo();
servletInfo.servletName = servlet.getServletName();
servletInfo.servletClass = servlet.getServletClass();
+ servletInfo.mappings =
webModule.getWebApp().getServletMappings(servletInfo.servletName);
webAppInfo.servlets.add(servletInfo);
}
Modified:
openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java
(original)
+++
openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebApp.java
Tue May 29 08:46:44 2012
@@ -17,6 +17,7 @@
*/
package org.apache.openejb.jee;
+import java.util.Collections;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -623,4 +624,16 @@ public class WebApp implements WebCommon
}
return map;
}
+
+ public List<String> getServletMappings(final String servletName) {
+ if (servletMapping == null || servletName == null) {
+ return Collections.emptyList();
+ }
+ for (ServletMapping mapping : servletMapping) {
+ if (servletName.equals(mapping.getServletName())) {
+ return mapping.getUrlPattern();
+ }
+ }
+ return Collections.emptyList();
+ }
}
Modified:
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBNamingResource.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBNamingResource.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBNamingResource.java
(original)
+++
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBNamingResource.java
Tue May 29 08:46:44 2012
@@ -28,12 +28,11 @@ import org.apache.catalina.deploy.Naming
import org.apache.catalina.deploy.ResourceBase;
public class OpenEJBNamingResource extends NamingResources {
+ private static final String JAVA_PREFIX = "java:";
@Override
public void addEnvironment(ContextEnvironment environment) {
- if (environment.getType() == null) {
- normalize(environment);
- }
+ normalize(environment);
super.addEnvironment(environment);
}
@@ -82,11 +81,15 @@ public class OpenEJBNamingResource exten
/**
* tomcat uses a hastable to store entry type, null values are not allowed
* <p/>
- * These occur when the reference is decalred using a 'lookup' attribute
These do not have a type associated
+ * These occur when the reference is declared using a 'lookup' attribute
These do not have a type associated
*
* @param ref
*/
private void normalize(ResourceBase ref) {
+ final String name = ref.getName();
+ if (name.startsWith(JAVA_PREFIX)) { // tomcat adds mbeans and a ":" in
a mbean is not very cool for the objectname
+ ref.setName(name.substring(JAVA_PREFIX.length()));
+ }
if (ref.getType() == null) {
ref.setType("");
}
Modified:
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
(original)
+++
openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
Tue May 29 08:46:44 2012
@@ -34,6 +34,7 @@ import org.apache.catalina.core.NamingCo
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.core.StandardWrapper;
import org.apache.catalina.deploy.ApplicationParameter;
import org.apache.catalina.deploy.ContextEnvironment;
import org.apache.catalina.deploy.ContextResource;
@@ -818,6 +819,15 @@ public class TomcatWebAppBuilder impleme
return;
}
+ WebAppInfo currentWebAppInfo = null;
+ for (final WebAppInfo webAppInfo : contextInfo.appInfo.webApps) {
+ final boolean isRoot = isRootApplication(standardContext);
+ if (("/" +
webAppInfo.contextRoot).equals(standardContext.getPath()) || isRoot) {
+ currentWebAppInfo = webAppInfo;
+ break;
+ }
+ }
+
// bind extra stuff at the java:comp level which can only be
// bound after the context is created
final NamingContextListener ncl =
getNamingContextListener(standardContext);
@@ -850,22 +860,17 @@ public class TomcatWebAppBuilder impleme
safeBind(root, "openejb", openejbContext);
// add context to WebDeploymentInfo
- for (final WebAppInfo webAppInfo : contextInfo.appInfo.webApps) {
- final boolean isRoot = isRootApplication(standardContext);
- if (("/" +
webAppInfo.contextRoot).equals(standardContext.getPath()) || isRoot) {
- final WebContext webContext =
getContainerSystem().getWebContext(webAppInfo.moduleId);
- if (webContext != null) {
- webContext.setJndiEnc(comp);
- }
-
- try {
- // Bean Validation
-
standardContext.getServletContext().setAttribute("javax.faces.validator.beanValidator.ValidatorFactory",
openejbContext.lookup(Assembler.VALIDATOR_FACTORY_NAMING_CONTEXT.replaceFirst("openejb",
"") + webAppInfo.uniqueId));
- } catch (NamingException ne) {
- logger.warning("no validator factory found for webapp
" + webAppInfo.moduleId);
- }
+ if (currentWebAppInfo != null) {
+ final WebContext webContext =
getContainerSystem().getWebContext(currentWebAppInfo.moduleId);
+ if (webContext != null) {
+ webContext.setJndiEnc(comp);
+ }
- break;
+ try {
+ // Bean Validation
+
standardContext.getServletContext().setAttribute("javax.faces.validator.beanValidator.ValidatorFactory",
openejbContext.lookup(Assembler.VALIDATOR_FACTORY_NAMING_CONTEXT.replaceFirst("openejb",
"") + currentWebAppInfo.uniqueId));
+ } catch (NamingException ne) {
+ logger.warning("no validator factory found for webapp " +
currentWebAppInfo.moduleId);
}
}
@@ -937,6 +942,24 @@ public class TomcatWebAppBuilder impleme
e.printStackTrace();
}
}
+
+ // add servlets to webappinfo
+ if (currentWebAppInfo != null) {
+ for (String mapping : standardContext.findServletMappings()) {
+ final ServletInfo info = new ServletInfo();
+ info.servletName = standardContext.findServletMapping(mapping);
+ info.mappings.add(mapping);
+
+ final Container container =
standardContext.findChild(info.servletName);
+ if (container instanceof StandardWrapper) {
+ info.servletClass = ((StandardWrapper)
container).getServletClass();
+ } else {
+ info.servletClass = mapping;
+ }
+
+ currentWebAppInfo.servlets.add(info);
+ }
+ }
}
private WebBeansListener getWebBeansContext(final ContextInfo contextInfo)
{
Modified:
openejb/trunk/openejb/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java?rev=1343602&r1=1343601&r2=1343602&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
(original)
+++
openejb/trunk/openejb/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
Tue May 29 08:46:44 2012
@@ -74,6 +74,7 @@ public class Container {
private File base;
private Map<String, String> moduleIds = new HashMap<String, String>(); //
TODO: manage multimap
private Map<String, AppContext> appContexts = new HashMap<String,
AppContext>(); // TODO: manage multimap
+ private Map<String, AppInfo> infos = new HashMap<String, AppInfo>(); //
TODO: manage multimap
private ConfigurationFactory configurationFactory;
private Assembler assembler;
private final Tomcat tomcat;
@@ -248,16 +249,22 @@ public class Container {
AppContext context = assembler.createApplication(appInfo);
moduleIds.put(name, appInfo.path);
+ infos.put(name, appInfo);
appContexts.put(name, context);
return context;
}
+ public AppInfo getInfo(final String name) {
+ return infos.get(name);
+ }
+
public void undeploy(String name) throws UndeployException,
NoSuchApplicationException {
final String moduleId = moduleIds.remove(name);
+ infos.remove(name);
+ appContexts.remove(name);
if (moduleId != null) {
assembler.destroyApplication(moduleId);
- appContexts.remove(name);
}
}