[jboss-cvs] JBossAS SVN: r66565 - trunk/webservices/src/main/org/jboss/wsf/container/jboss50.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 30 06:35:10 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-10-30 06:35:09 -0400 (Tue, 30 Oct 2007)
New Revision: 66565

Modified:
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
Log:
Mark the deployment as generated web app 
so the JSE deployer hook can ignore it 


Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/AbstractDeployerHookJSE.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -41,7 +41,9 @@
 {
    public boolean isWebServiceDeployment(DeploymentUnit unit)
    {
-      return unit.getAttachment(JBossWebMetaData.class) != null;
+      JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+      boolean isGenerated = unit.getTypes().contains(WebAppDesciptorModifier.PROPERTY_GENERATED_WEBAPP);
+      return isGenerated == false && webMetaData != null;
    }
 
    protected String getTargetBean(ServletMetaData servlet)

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ContainerMetaDataAdapter.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -81,7 +81,7 @@
             if (dep instanceof ArchiveDeployment)
             {
                URL webURL = ((ArchiveDeployment)dep).getRootFile().toURL();
-               dep.setProperty("org.jboss.ws.webapp.url", webURL);
+               dep.setProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL, webURL);
             }
          }
          

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -21,15 +21,15 @@
  */
 package org.jboss.wsf.container.jboss50;
 
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.logging.Logger;
+import java.util.Iterator;
+import java.util.Map;
+
 import org.dom4j.Document;
 import org.dom4j.Element;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
 
-import java.util.Map;
-import java.util.Iterator;
-
 /**
  * Modifies web.xml for jbossws
  *
@@ -46,13 +46,11 @@
       RewriteResults results = new RewriteResults();
       Element root = webXml.getRootElement();
 
-      String propKey = "org.jboss.ws.webapp.ServletClass";
-      String servletClass = (String)dep.getProperty(propKey);
+      String servletClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CLASS);
       if (servletClass == null)
-         throw new IllegalStateException("Cannot obtain context property: " + propKey);
+         throw new IllegalStateException("Cannot obtain context property: " + PROPERTY_WEBAPP_SERVLET_CLASS);
 
-      propKey = "org.jboss.ws.webapp.ContextParameterMap";
-      Map<String, String> contextParams = (Map<String, String>)dep.getProperty(propKey);
+      Map<String, String> contextParams = (Map<String, String>)dep.getProperty(PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
       if (contextParams != null)
       {
          for (Map.Entry<String, String> entry : contextParams.entrySet())
@@ -63,8 +61,7 @@
          }
       }
 
-      propKey = "org.jboss.ws.webapp.ServletContextListener";
-      String listenerClass = (String)dep.getProperty(propKey);
+      String listenerClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
       if (listenerClass != null)
       {
          Element listener = root.addElement("listener");

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/ModifyWebMetaDataDeploymentAspect.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -46,20 +46,17 @@
    @Override
    public void create(Deployment dep)
    {
-      String propKey = "org.jboss.ws.webapp.ServletClass";
-      String servletClass = (String)dep.getProperty(propKey);
+      String servletClass = (String)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_SERVLET_CLASS);
       if (servletClass == null)
-         throw new IllegalStateException("Cannot obtain context property: " + propKey);
+         throw new IllegalStateException("Cannot obtain context property: " + WebAppDesciptorModifier.PROPERTY_WEBAPP_SERVLET_CLASS);
 
       modifyServletClass(dep, servletClass);
 
-      propKey = "org.jboss.ws.webapp.ServletContextListener";
-      String listenerClass = (String)dep.getProperty(propKey);
+      String listenerClass = (String)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
       if (listenerClass != null)
          modifyListener(dep, listenerClass);
       
-      propKey = "org.jboss.ws.webapp.ContextParameterMap";
-      Map<String, String> contextParams = (Map<String, String>)dep.getProperty(propKey);
+      Map<String, String> contextParams = (Map<String, String>)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
       if (contextParams != null)
          modifyContextParams(dep, contextParams);
    }

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -25,7 +25,9 @@
 
 import java.net.URL;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.jboss.deployers.client.spi.DeployerClient;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
@@ -63,7 +65,7 @@
 
    public void create(Deployment dep)
    {
-      URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+      URL warURL = (URL)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL);
       if (warURL == null)
          throw new IllegalStateException("Cannot obtain generated webapp URL");
 
@@ -72,6 +74,16 @@
       {
          webXMLRewriter.rewriteWebXml(dep);
          org.jboss.deployers.client.spi.Deployment deployment = createDeploymentContext(warURL);
+         
+         // Mark the deployment as generated web app 
+         // so the JSE deployer hook can ignore it 
+         Set<String> types = deployment.getTypes();
+         if (types == null)
+         {
+            types = new HashSet<String>();
+            deployment.setTypes(types);
+         }
+         types.add(WebAppDesciptorModifier.PROPERTY_GENERATED_WEBAPP);
 
          mainDeployer.deploy(deployment);
 
@@ -85,7 +97,7 @@
 
    public void destroy(Deployment dep)
    {
-      URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+      URL warURL = (URL)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL);
       if (warURL == null)
       {
          log.error("Cannot obtain generated webapp URL");

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -32,9 +32,11 @@
  */
 public interface WebAppDesciptorModifier
 {
-   final String SERVLET_CONTEXT_LISTENER = "org.jboss.ws.webapp.ServletContextListener";
-   final String CONTEXT_PARAMETER_MAP = "org.jboss.ws.webapp.ContextParameterMap";
-   final String SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
+   static final String PROPERTY_GENERATED_WEBAPP = "org.jboss.ws.generated.webapp";
+   static final String PROPERTY_WEBAPP_CONTEXT_PARAMETERS = "org.jboss.ws.webapp.ContextParameterMap";
+   static final String PROPERTY_WEBAPP_SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
+   static final String PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER = "org.jboss.ws.webapp.ServletContextListener";
+   static final String PROPERTY_WEBAPP_URL = "org.jboss.ws.webapp.url";
 
    RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
 }

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java	2007-10-30 10:14:23 UTC (rev 66564)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java	2007-10-30 10:35:09 UTC (rev 66565)
@@ -62,7 +62,7 @@
 
    public RewriteResults rewriteWebXml(Deployment dep)
    {
-      URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+      URL warURL = (URL)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL);
       File warFile = new File(warURL.getFile());
       if (warFile.isDirectory() == false)
          throw new WebServiceException("Expected a war directory: " + warURL);




More information about the jboss-cvs-commits mailing list