[jbossws-commits] JBossWS SVN: r8584 - in container/jboss50/ropalka-trunk: src/main/java/org/jboss/wsf/container/jboss50 and 5 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Oct 29 15:57:20 EDT 2008


Author: richard.opalka at jboss.com
Date: 2008-10-29 15:57:20 -0400 (Wed, 29 Oct 2008)
New Revision: 8584

Added:
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DeploymentAspectHttpServer.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DynamicEndpointDeploymentAspect.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentAspect.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java
Removed:
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/BareWSFRuntime.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/BareTransportManagerFactory.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WSFRuntimeDelegateHttpServer.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGenerator.java
Modified:
   container/jboss50/ropalka-trunk/pom.xml
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookEJB.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookJSE.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractWebServiceDeployer.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataAdapter.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataDeploymentAspect.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java
   container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifierImpl.java
Log:
[JBWS-2338] removing WSFRuntime abstraction

Modified: container/jboss50/ropalka-trunk/pom.xml
===================================================================
--- container/jboss50/ropalka-trunk/pom.xml	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/pom.xml	2008-10-29 19:57:20 UTC (rev 8584)
@@ -24,8 +24,8 @@
   
   <!-- Properties -->
   <properties>
-    <jbossws.common.version>1.0.7.GA</jbossws.common.version>
-    <jbossws.spi.version>1.0.6.GA</jbossws.spi.version>
+    <jbossws.common.version>1.0.8-SNAPSHOT</jbossws.common.version>
+    <jbossws.spi.version>1.0.7-SNAPSHOT</jbossws.spi.version>
     
     <!--
       JBoss component versions taken from   

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/BareWSFRuntime.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/BareWSFRuntime.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/BareWSFRuntime.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,145 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50;
-
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.WSFRuntime;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspectManager;
-import org.jboss.wsf.spi.invocation.InvocationHandlerFactory;
-import org.jboss.wsf.spi.invocation.RequestHandlerFactory;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.transport.TransportManagerFactory;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class BareWSFRuntime implements WSFRuntime
-{
-   private static final Logger log = Logger.getLogger(BareWSFRuntime.class);
- 
-   private String runtimeName;
-
-   private DeploymentAspectManager deploymentManager;
-
-   private EndpointRegistry endpointRegistry;
-
-   private RequestHandlerFactory requestHandlerFactory;
-
-   private InvocationHandlerFactory invocationHandlerFactory;
-
-   private TransportManagerFactory transportManagerFactory;
-
-   public BareWSFRuntime(String runtimeName)
-   {
-      this.runtimeName = runtimeName;
-   }
-  
-   // ---------------------------------------------------------------------------------
-
-   public void create(Deployment deployment)
-   {
-      deploymentManager.create(deployment, this);
-   }
-
-   public void start(Deployment deployment)
-   {
-      deploymentManager.start(deployment, this);
-   }
-
-   public void stop(Deployment deployment)
-   {
-      deploymentManager.stop(deployment, this);
-   }
-
-   public void destroy(Deployment deployment)
-   {
-      deploymentManager.destroy(deployment, this);
-   }
-
-   // ---------------------------------------------------------------------------------
-
-   public void setTransportManagerFactory(TransportManagerFactory factory)
-   {
-      assert factory!=null;
-      log.debug(runtimeName + " -> TransportManagerFactory: " + factory);
-      this.transportManagerFactory = factory;
-   }
-
-   public TransportManagerFactory getTransportManagerFactory()
-   {
-      return this.transportManagerFactory;
-   }
-
-   public void setEndpointRegistry(EndpointRegistry endpointRegistry)
-   {
-      assert endpointRegistry!=null;
-      log.debug(runtimeName + " -> EndpointRegistry: " + endpointRegistry);
-      this.endpointRegistry = endpointRegistry;
-   }
-
-   public EndpointRegistry getEndpointRegistry()
-   {
-      return this.endpointRegistry;
-   }
-
-   public void setDeploymentAspectManager(DeploymentAspectManager deploymentManager)
-   {
-      assert deploymentManager!=null;
-      log.debug(runtimeName + " -> DeploymentAspectManager: " + deploymentManager);
-      this.deploymentManager = deploymentManager;
-   }
-
-   public DeploymentAspectManager getDeploymentAspectManager()
-   {
-      return this.deploymentManager;
-   }
-
-   public void setRequestHandlerFactory(RequestHandlerFactory factory)
-   {
-      assert factory!=null;
-      log.debug(runtimeName + " -> RequestHandlerFactory: "+ factory);
-      this.requestHandlerFactory = factory;
-   }
-
-   public RequestHandlerFactory getRequestHandlerFactory()
-   {
-      return this.requestHandlerFactory;
-   }
-
-   public void setInvocationHandlerFactory(InvocationHandlerFactory factory)
-   {
-      assert factory!=null;
-      log.debug(runtimeName + " -> InvocationHandlerFactory: "+ factory);
-      this.invocationHandlerFactory = factory;
-   }
-
-   public InvocationHandlerFactory getInvocationHandlerFactory()
-   {
-      return this.invocationHandlerFactory;
-   }
-
-   public String toString()
-   {
-      return this.runtimeName+ ": " + super.toString();
-   }
-}

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -25,10 +25,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.WSFRuntime;
-import org.jboss.wsf.spi.WSFRuntimeLocator;
 import org.jboss.wsf.spi.deployment.*;
-import org.jboss.wsf.container.jboss50.deployer.DeployerHook;
 
 /**
  * An abstract web service deployer.
@@ -43,32 +40,28 @@
    // provide logging
    protected final Logger log = Logger.getLogger(getClass());
 
-   protected String runtimeName;
-   private WSFRuntime wsfRuntime;
-
+   private DeploymentAspectManager deploymentAspectManager;
    private DeploymentModelFactory deploymentModelFactory;
 
-   public WSFRuntime getWsfRuntime()
+   protected String deploymentManagerName;
+
+   /** MC provided property **/
+   public void setDeploymentManagerName(String deploymentManagerName)
    {
-      if(null == wsfRuntime)
+      this.deploymentManagerName = deploymentManagerName;
+   }
+
+   public DeploymentAspectManager getDeploymentAspectManager()
+   {
+      if(null == deploymentAspectManager)
       {
          SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-         wsfRuntime = spiProvider.getSPI(WSFRuntimeLocator.class).locateRuntime(runtimeName);
+         deploymentAspectManager = spiProvider.getSPI(DeploymentAspectManagerFactory.class).getDeploymentAspectManager( deploymentManagerName );
       }
-      
-      return wsfRuntime;
-   }
 
-   public void setWsfRuntime(WSFRuntime wsfRuntime)
-   {
-      this.wsfRuntime = wsfRuntime;
+      return deploymentAspectManager;
    }
 
-   public void setRuntimeName(String runtimeName)
-   {
-      this.runtimeName = runtimeName;
-   }
-
    public DeploymentModelFactory getDeploymentModelFactory()
    {
       if(null == deploymentModelFactory)

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookEJB.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookEJB.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookEJB.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -21,13 +21,6 @@
  */
 package org.jboss.wsf.container.jboss50.deployer;
 
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentState;
-
-import static org.jboss.wsf.spi.deployment.Deployment.DeploymentState;
-
 /**
  * An abstract deployer for EJB Endpoints
  *
@@ -36,19 +29,4 @@
  */
 public abstract class AbstractDeployerHookEJB extends ArchiveDeployerHook
 {
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if(!ignoreDeployment(unit) && isWebServiceDeployment(unit))
-      {
-         super.deploy(unit); // Calls create 
-
-         Deployment dep = unit.getAttachment(Deployment.class);
-         boolean expectedState = DeploymentState.CREATED == dep.getState() || DeploymentState.STARTED == dep.getState(); 
-         if (null == dep || !expectedState)
-            throw new DeploymentException("Create step failed");
-
-         // execute the 'start' step
-         getWsfRuntime().start(dep); 
-      }
-   }
 }

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookJSE.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookJSE.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHookJSE.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -28,7 +28,7 @@
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
 import org.jboss.metadata.web.spec.ServletMetaData;
 import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifier;
 
 /**
  * An abstract deployer for JSE Endpoints
@@ -41,7 +41,7 @@
    public boolean isWebServiceDeployment(DeploymentUnit unit)
    {
       JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
-      boolean isGenerated = Boolean.TRUE.equals(unit.getAttachment(HttpSpec.PROPERTY_GENERATED_WEBAPP));
+      boolean isGenerated = Boolean.TRUE.equals(unit.getAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP));
       return webMetaData != null && isGenerated == false;
    }
 

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractWebServiceDeployer.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractWebServiceDeployer.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractWebServiceDeployer.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -40,7 +40,7 @@
    // provide logging
    private static final Logger log = Logger.getLogger(AbstractWebServiceDeployer.class);
 
-   protected List<DeployerHook> deployerHooks = new LinkedList<DeployerHook>();
+   private List<DeployerHook> deployerHooks = new LinkedList<DeployerHook>();
 
    public void addDeployerHook(DeployerHook deployer)
    {

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -41,37 +41,30 @@
 
 /**
  * An abstract web service deployer.
- * <pre>
- *    deploy(unit)
+ * 
+ *    deploy(unit) 
  *      if(isWebServiceDeployment)
  *        dep = createDeployment(unit)
- *        create(dep)
- *        start(dep)
+ *        deploy(dep)
  *
  *    undeploy(unit)
  *      dep = getDeployment(unit) 
- *      stop(dep)
- *      destroy(dep)
- * </pre>
+ *      undeploy(dep)
  *
  * @author Thomas.Diesler at jboss.org
- * @author Heiko.Braun at jboss.com
- * 
  * @since 25-Apr-2007
  */
 public abstract class ArchiveDeployerHook extends AbstractDeployerHook
 {
-   
-   /**
-    * Executes the 'create' step only. <br/>
-    * Subclasses need to take care that the 'start' step is executed as well.          
-    */
+
    public void deploy(DeploymentUnit unit) throws DeploymentException
    {
-      if (!ignoreDeployment(unit) && isWebServiceDeployment(unit))
+      if (ignoreDeployment(unit))
+         return;
+
+      if (isWebServiceDeployment(unit))
       {
          log.debug("deploy: " + unit.getName());
-
          Deployment dep = getDeployment(unit);
          if (dep == null)
          {
@@ -79,22 +72,11 @@
             dep.addAttachment(DeploymentUnit.class, unit);
          }
 
-         if(Deployment.DeploymentState.UNDEFINED == dep.getState())
-         {
-            getWsfRuntime().create(dep); 
-            unit.addAttachment(Deployment.class, dep);
-         }
-         else
-         {
-            throw new IllegalArgumentException("Cannot process Deployment in state " + dep.getState() + ": " + dep);
-         }
+         getDeploymentAspectManager().deploy(dep);
+         unit.addAttachment(Deployment.class, dep);
       }
    }
 
-   /**
-    * Executes the stop() and destroy() lifecycles
-    * @param unit
-    */
    public void undeploy(DeploymentUnit unit)
    {
       if (ignoreDeployment(unit))
@@ -104,8 +86,7 @@
       if (dep != null)
       {
          log.debug("undeploy: " + unit.getName());
-         getWsfRuntime().stop(dep);
-         getWsfRuntime().destroy(dep);
+         getDeploymentAspectManager().undeploy(dep);
       }
    }
 

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -21,12 +21,9 @@
  */
 package org.jboss.wsf.container.jboss50.deployer;
 
-import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentState;
 import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import static org.jboss.wsf.spi.deployment.Deployment.DeploymentState;
 
 /**
  * A deployer JAXRPC JSE Endpoints
@@ -38,26 +35,6 @@
 {
 
    /**
-    * Expects the 'create' step to be executed in
-    * {@link org.jboss.wsf.container.jboss50.deployer.JAXRPCDeployerHookPreJSE}
-    * and executes the 'start' step.
-    *
-    */
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if (!ignoreDeployment(unit) && isWebServiceDeployment(unit))
-      {
-         Deployment dep = getDeployment(unit);
-         boolean expectedState = DeploymentState.CREATED == dep.getState() || DeploymentState.STARTED == dep.getState(); 
-         if (null == dep || !expectedState)
-            throw new DeploymentException("Create step is missing");
-
-         // execute the 'start' step
-         getWsfRuntime().start(dep);          
-      }
-   }
-
-   /**
     * Get the deployment type this deployer can handle
     */
    public Deployment.DeploymentType getDeploymentType()

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -22,10 +22,8 @@
 package org.jboss.wsf.container.jboss50.deployer;
 
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import static org.jboss.wsf.spi.deployment.Deployment.DeploymentState;
 
 /**
  * @author Heiko.Braun at jboss.com
@@ -34,26 +32,6 @@
 {
 
    /**
-    * Expects the 'create' step to be executed in
-    * {@link org.jboss.wsf.container.jboss50.deployer.JAXWSDeployerHookPreJSE} and
-    * executes the 'start' step.
-    *
-    */
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if (!ignoreDeployment(unit) && isWebServiceDeployment(unit))
-      {
-         Deployment dep = getDeployment(unit);
-         boolean expectedState = DeploymentState.CREATED == dep.getState() || DeploymentState.STARTED == dep.getState(); 
-         if (null == dep || !expectedState)
-            throw new DeploymentException("Create step failed");
-
-         // execute the 'start' step
-         getWsfRuntime().start(dep); 
-      }
-   }
-
-   /**
     * Get the deployment type this deployer can handle
     */
    public Deployment.DeploymentType getDeploymentType()

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/RuntimeLoaderDeploymentAspect.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -23,7 +23,6 @@
 
 import org.jboss.metadata.ejb.jboss.JBossMetaData;
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.spi.WSFRuntime;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.DeploymentAspect;
 import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
@@ -36,7 +35,7 @@
  */
 public class RuntimeLoaderDeploymentAspect extends DeploymentAspect
 {
-   public void start(Deployment dep, WSFRuntime runtime)
+   public void create(Deployment dep)
    {
       // EJB3 endpoints
       if (dep.getAttachment(WebServiceDeployment.class) != null)

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataAdapter.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataAdapter.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataAdapter.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -30,7 +30,7 @@
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
-import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifier;
 
 import java.net.URL;
 
@@ -80,7 +80,7 @@
             if (dep instanceof ArchiveDeployment)
             {
                URL webURL = ((ArchiveDeployment)dep).getRootFile().toURL();
-               dep.setProperty(HttpSpec.PROPERTY_WEBAPP_URL, webURL);
+               dep.setProperty(WebMetaDataModifier.PROPERTY_WEBAPP_URL, webURL);
             }
          }
          

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataDeploymentAspect.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/ContainerMetaDataDeploymentAspect.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -24,7 +24,6 @@
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.DeploymentAspect;
-import org.jboss.wsf.spi.WSFRuntime;
 
 /**
  * A deployer that builds the UnifiedDeploymentInfo 
@@ -42,7 +41,7 @@
    }
 
    @Override
-   public void create(Deployment dep, WSFRuntime runtime)
+   public void create(Deployment dep)
    {
       DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
       if (unit == null)

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -24,7 +24,6 @@
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.DeploymentAspect;
 import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import org.jboss.wsf.spi.WSFRuntime;
 
 /**
  * A deployer that modifies the web.xml meta data 
@@ -42,7 +41,7 @@
    }
 
    @Override
-   public void create(Deployment dep, WSFRuntime runtime)
+   public void create(Deployment dep)
    {
       try
       {

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -31,5 +31,11 @@
  */
 public interface WebMetaDataModifier
 {            
+   final static String PROPERTY_GENERATED_WEBAPP = "org.jboss.ws.generated.webapp";
+   final static String PROPERTY_WEBAPP_CONTEXT_PARAMETERS = "org.jboss.ws.webapp.ContextParameterMap";
+   final static String PROPERTY_WEBAPP_SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
+   final static String PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER = "org.jboss.ws.webapp.ServletContextListener";
+   final static String PROPERTY_WEBAPP_URL = "org.jboss.ws.webapp.url";
+
    RewriteResults modifyMetaData(Deployment dep) throws ClassNotFoundException;
 }

Modified: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifierImpl.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifierImpl.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifierImpl.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -28,7 +28,6 @@
 import org.jboss.metadata.web.spec.ListenerMetaData;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.transport.HttpSpec;
 
 import javax.xml.ws.WebServiceException;
 import java.util.ArrayList;
@@ -72,11 +71,11 @@
    {
       RewriteResults results = new RewriteResults();
 
-      String servletClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
+      String servletClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CLASS);
       if (servletClass == null)
-         throw new IllegalStateException("Cannot obtain context property: " + HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
+         throw new IllegalStateException("Cannot obtain context property: " + PROPERTY_WEBAPP_SERVLET_CLASS);
 
-      Map<String, String> depCtxParams = (Map<String, String>)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
+      Map<String, String> depCtxParams = (Map<String, String>)dep.getProperty(PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
       if (depCtxParams != null)
       {
          List<ParamValueMetaData> contextParams = jbwmd.getContextParams();
@@ -95,7 +94,7 @@
          }
       }
 
-      String listenerClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
+      String listenerClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
       if (listenerClass != null)
       {
          List<ListenerMetaData> listeners = jbwmd.getListeners();

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/BareTransportManagerFactory.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/BareTransportManagerFactory.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/BareTransportManagerFactory.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import org.jboss.wsf.spi.transport.TransportManagerFactory;
-import org.jboss.wsf.spi.transport.TransportManager;
-import org.jboss.wsf.spi.transport.Protocol;
-
-/**
- * Used with MC
- * 
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class BareTransportManagerFactory implements TransportManagerFactory
-{
-
-   private TransportManager httpTransport;
-
-
-   public void setHttpTransport(TransportManager httpTransport)
-   {
-      this.httpTransport = httpTransport;
-   }
-
-   public TransportManager createTransportManager(Protocol protocol)
-   {
-      TransportManager manager = null;
-
-      switch(protocol)
-      {
-         case HTTP:
-            manager = httpTransport;
-            break;
-         default:
-            throw new IllegalArgumentException("No TransportManager for protocol: " + protocol);
-      }
-
-      return manager;
-   }
-}
-

Added: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DeploymentAspectHttpServer.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DeploymentAspectHttpServer.java	                        (rev 0)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DeploymentAspectHttpServer.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.container.jboss50.transport;
+
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspectManager;
+import org.jboss.wsf.spi.deployment.DeploymentAspectManagerFactory;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Service;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+
+/**
+ * A HTTP Server that uses DeploymentAspects
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 07-Jul-2006
+ */
+public class DeploymentAspectHttpServer extends AbstractExtensible implements HttpServer
+{
+   /** Start an instance of this HTTP server */
+   public void start()
+   {
+      // verify required properties
+   }
+
+   /** Create an HTTP context */
+   public HttpContext createContext(String contextRoot)
+   {
+      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+      HttpContext httpContext = spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this, contextRoot);
+      return httpContext;
+   }
+
+   /** Publish an JAXWS endpoint to the HTTP server */
+   public void publish(HttpContext context, Endpoint endpoint)
+   {
+      Class implClass = getImplementorClass(endpoint);
+
+      try
+      {
+         // Get the deployment model factory
+         SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+         DeploymentModelFactory depModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+
+         // Create/Setup the deployment
+         Deployment dep = depModelFactory.newDeployment("endpoint-deployment", implClass.getClassLoader());
+         dep.setRuntimeClassLoader(dep.getInitialClassLoader());
+
+         // Create/Setup the service
+         Service service = dep.getService();
+         service.setContextRoot(context.getContextRoot());
+
+         // Create/Setup the endpoint
+         org.jboss.wsf.spi.deployment.Endpoint ep = depModelFactory.newEndpoint(implClass.getName());
+         service.addEndpoint(ep);
+
+         // Deploy using deployment aspects
+         DeploymentAspectManagerFactory depManagerFactory = spiProvider.getSPI(DeploymentAspectManagerFactory.class);
+         DeploymentAspectManager depManager = depManagerFactory.getDeploymentAspectManager("WSDeploymentAspectManagerEndpointAPI");
+         depManager.deploy(dep);
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         throw new WebServiceException(ex);
+      }
+   }
+
+   /** Destroys an JAXWS endpoint on the HTTP server */
+   public void destroy(HttpContext context, Endpoint endpoint)
+   {
+      try
+      {
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         throw new WebServiceException(ex);
+      }
+   }
+
+   private Class getImplementorClass(Endpoint endpoint)
+   {
+      Object implementor = endpoint.getImplementor();
+      Class implClass = (implementor instanceof Class ? (Class)implementor : implementor.getClass());
+      return implClass;
+   }
+}

Added: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DynamicEndpointDeploymentAspect.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DynamicEndpointDeploymentAspect.java	                        (rev 0)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/DynamicEndpointDeploymentAspect.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.container.jboss50.transport;
+
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifier;
+
+/**
+ * Deploy the generated webapp to JBoss
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public class DynamicEndpointDeploymentAspect extends DeploymentAspect
+{
+   // provide logging
+   private static Logger log = Logger.getLogger(DynamicEndpointDeploymentAspect.class);
+
+   private DeploymentFactory factory = new DeploymentFactory();
+   private WebMetaDataModifier webMetaDataModifier;
+   private DeployerClient mainDeployer;
+
+   public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
+   {
+      this.webMetaDataModifier = webMetaDataModifier;
+   }
+
+   public void setMainDeployer(DeployerClient mainDeployer)
+   {
+      this.mainDeployer = mainDeployer;
+   }
+
+   public void create(Deployment dep)
+   {
+      JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
+      if (jbwmd == null)
+         throw new WebServiceException("Cannot find web meta data");
+
+      try
+      {
+         webMetaDataModifier.modifyMetaData(dep);
+
+         AbstractDeployment deployment = createSimpleDeployment(dep.getService().getContextRoot());
+         MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+         mutableAttachments.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
+         mutableAttachments.addAttachment(ClassLoaderFactory.class, new ContextClassLoaderFactory());
+         mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
+         mainDeployer.deploy(deployment);
+      }
+      catch (Exception ex)
+      {
+         WSFDeploymentException.rethrow(ex);
+      }
+   }
+
+   public void destroy(Deployment dep)
+   {
+      try
+      {
+         AbstractDeployment deployment = createSimpleDeployment(dep.getService().getContextRoot());
+         mainDeployer.undeploy(deployment);
+      }
+      catch (Exception ex)
+      {
+         WSFDeploymentException.rethrow(ex);
+      }
+   }
+   
+   private AbstractDeployment createSimpleDeployment(String name)
+   {
+      AbstractDeployment unit = new AbstractDeployment(name);
+      // There is one top level deployment
+      factory.addContext(unit, "");
+      return unit;
+   }
+
+   private static class ContextClassLoaderFactory implements ClassLoaderFactory
+   {
+      public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+
+      public void removeClassLoader(DeploymentUnit unit) throws Exception
+      {
+      }
+   }
+}

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.spi.transport.HttpListenerRef;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.transport.HttpSpec;
-import org.jboss.wsf.spi.transport.ListenerRef;
-import org.jboss.wsf.spi.transport.TransportManager;
-import org.jboss.wsf.spi.transport.TransportSpec;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Creates a webapp dpeloyment and pushes it into the deployment framework
- * 
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class EJBHttpTransportManager implements TransportManager
-{
-   private static Logger log = Logger.getLogger(EJBHttpTransportManager.class);
-   private static final String PROCESSED_BY_DEPLOYMENT_FACTORY = "processed.by.deployment.factory";
-   private WebAppDeploymentFactory deploymentFactory;
-   private WebAppGenerator generator;
-   private Map<String, Deployment> deploymentRegistry = new HashMap<String, Deployment>();
-
-   public ListenerRef createListener(Endpoint endpoint, TransportSpec transportSpec)
-   {
-
-      assert deploymentFactory!=null;
-      assert generator!=null;
-
-      // Resolve the endpoint address
-      if(! (transportSpec instanceof HttpSpec))
-         throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
-      HttpSpec httpSpec = (HttpSpec)transportSpec;
-
-      // Create JBossWebMetaData and attach it to the DeploymentUnit
-      Deployment topLevelDeployment = endpoint.getService().getDeployment();
-
-      // TODO: Somehow the ServletClass and InitParameter need to go from TransportSpec into generator
-      topLevelDeployment.setProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS, httpSpec.getServletClass());
-      topLevelDeployment.setProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS, httpSpec.getContextParameter());      
-      
-      // TODO: JBWS-2188
-      Boolean alreadyDeployed = (Boolean)topLevelDeployment.getProperty(PROCESSED_BY_DEPLOYMENT_FACTORY); 
-      if ((alreadyDeployed == null) || (false == alreadyDeployed))
-      {
-         JBossWebMetaData jbwMetaData = generator.create(topLevelDeployment);
-         deploymentFactory.create(topLevelDeployment, jbwMetaData);
-         topLevelDeployment.setProperty(PROCESSED_BY_DEPLOYMENT_FACTORY, Boolean.TRUE);
-      }
-
-      SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
-      ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
-      ServerConfig serverConfig = spi.getServerConfig();
-
-      String host = serverConfig.getWebServiceHost();
-      int port = serverConfig.getWebServicePort();
-      String hostAndPort = host + (port > 0 ? ":" + port : "");
-
-      ListenerRef listenerRef = null;
-      try
-      {
-         String ctx = httpSpec.getWebContext();
-         String pattern = httpSpec.getUrlPattern();
-         listenerRef = new HttpListenerRef(ctx, pattern, new URI("http://" + hostAndPort + ctx + pattern));
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException("Failed to create ListenerRef", e);
-      }
-    
-      // Map listenerRef for destroy phase
-      deploymentRegistry.put( listenerRef.getUUID(), topLevelDeployment );
-
-      return listenerRef;
-   }
-
-   public void destroyListener(ListenerRef ref)
-   {
-      Deployment dep = deploymentRegistry.get(ref.getUUID());
-      if (dep != null)
-      {
-         // TODO: JBWS-2188
-         Boolean alreadyDeployed = (Boolean)dep.getProperty(PROCESSED_BY_DEPLOYMENT_FACTORY); 
-         if ((alreadyDeployed != null) && (true == alreadyDeployed))
-         {
-            try
-            {
-               deploymentFactory.destroy(dep);
-            }
-            catch (Exception e)
-            {
-               log.error(e.getMessage(), e);
-            }
-            dep.removeProperty(PROCESSED_BY_DEPLOYMENT_FACTORY);
-         }
-      }
-      deploymentRegistry.remove(ref.getUUID());
-   }
-
-   public void setDeploymentFactory(WebAppDeploymentFactory deploymentFactory)
-   {
-      this.deploymentFactory = deploymentFactory;
-   }
-
-   public void setGenerator(WebAppGenerator generator)
-   {
-      this.generator = generator;
-   }
-}

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,209 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.DeploymentFactory;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifier;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.transport.TransportManager;
-import org.jboss.wsf.spi.transport.ListenerRef;
-import org.jboss.wsf.spi.transport.TransportSpec;
-import org.jboss.wsf.spi.transport.HttpSpec;
-import org.jboss.wsf.spi.transport.HttpListenerRef;
-
-import javax.xml.ws.WebServiceException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class EndpointAPIHttpTransportManager implements TransportManager
-{
-   private static Logger log = Logger.getLogger(EndpointAPIHttpTransportManager.class);
-   private static final String PROCESSED_BY_DEPLOYMENT_FACTORY = "processed.by.deployment.factory";
-   private WebAppGenerator generator;
-   private DeploymentFactory factory = new DeploymentFactory();
-
-   private WebMetaDataModifier webMetaDataModifier;
-   private DeployerClient mainDeployer;
-
-   private Map<String, Deployment> deploymentRegistry = new HashMap<String, Deployment>();
-   
-   public ListenerRef createListener(Endpoint endpoint, TransportSpec transportSpec)
-   {
-      assert generator!=null;
-      assert webMetaDataModifier!=null;     
-
-      // Resolve the endpoint address
-      if(! (transportSpec instanceof HttpSpec))
-         throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
-      HttpSpec httpSpec = (HttpSpec)transportSpec;
-
-      // Create JBossWebMetaData and attach it to the DeploymentUnit
-      Deployment topLevelDeployment = endpoint.getService().getDeployment();
-      
-      // Pass on to the main deployer
-      Boolean alreadyDeployed = (Boolean)topLevelDeployment.getProperty(PROCESSED_BY_DEPLOYMENT_FACTORY); 
-      if ((alreadyDeployed == null) || (false == alreadyDeployed))
-      {
-         generator.create(topLevelDeployment);
-         deploy(topLevelDeployment);
-         topLevelDeployment.setProperty(PROCESSED_BY_DEPLOYMENT_FACTORY, Boolean.TRUE);
-      }
-
-
-      // Server config
-      SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
-      ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
-      ServerConfig serverConfig = spi.getServerConfig();
-      String host = serverConfig.getWebServiceHost();
-      int port = serverConfig.getWebServicePort();
-      String hostAndPort = host + (port > 0 ? ":" + port : "");
-
-      ListenerRef listenerRef = null;
-      try
-      {
-         String ctx = httpSpec.getWebContext();
-         String pattern = httpSpec.getUrlPattern();
-         listenerRef = new HttpListenerRef(ctx, pattern, new URI("http://" + hostAndPort + ctx + pattern));
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException("Failed to create ListenerRef", e);
-      }
-
-      // Map listenerRef for destroy phase
-      deploymentRegistry.put( listenerRef.getUUID(), topLevelDeployment );
-
-      return listenerRef;
-   }
-
-   public void destroyListener(ListenerRef ref)
-   {
-      Deployment dep = deploymentRegistry.get(ref.getUUID());
-      if (dep != null)
-      {
-         // TODO: JBWS-2188
-         Boolean alreadyDeployed = (Boolean)dep.getProperty(PROCESSED_BY_DEPLOYMENT_FACTORY); 
-         if ((alreadyDeployed != null) && (true == alreadyDeployed))
-         {
-            try
-            {
-               undeploy(dep);
-            }
-            catch (Exception e)
-            {
-               log.error(e.getMessage(), e);
-            }
-            dep.removeProperty(PROCESSED_BY_DEPLOYMENT_FACTORY);
-         }
-      }
-      deploymentRegistry.remove(ref.getUUID());
-   }
-
-   public void setGenerator(WebAppGenerator generator)
-   {
-      this.generator = generator;
-   }
-   
-   public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
-   {
-      this.webMetaDataModifier = webMetaDataModifier;
-   }
-
-   public void setMainDeployer(DeployerClient mainDeployer)
-   {
-      this.mainDeployer = mainDeployer;
-   }
-
-   private void deploy(Deployment dep)
-   {
-      JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
-      if (jbwmd == null)
-         throw new WebServiceException("Cannot find web meta data");
-
-      try
-      {
-         webMetaDataModifier.modifyMetaData(dep);
-
-         final AbstractDeployment deployment = createSimpleDeployment(dep.getService().getContextRoot());
-         MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects();
-         mutableAttachments.addAttachment(HttpSpec.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
-         mutableAttachments.addAttachment(ClassLoaderFactory.class, new ContextClassLoaderFactory());
-         mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
-         mainDeployer.deploy(deployment);
-      }
-      catch (Exception ex)
-      {
-         WSFDeploymentException.rethrow(ex);
-      }
-   }
-
-   private void undeploy(Deployment dep)
-   {
-      try
-      {
-         AbstractDeployment deployment = createSimpleDeployment(dep.getService().getContextRoot());
-         mainDeployer.undeploy(deployment);
-      }
-      catch (Exception ex)
-      {
-         WSFDeploymentException.rethrow(ex);
-      }
-   }
-
-   private AbstractDeployment createSimpleDeployment(String name)
-   {
-      AbstractDeployment unit = new AbstractDeployment(name);
-      // There is one top level deployment
-      factory.addContext(unit, "");
-      return unit;
-   }
-
-   private static class ContextClassLoaderFactory implements ClassLoaderFactory
-   {
-      public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
-      {
-         return Thread.currentThread().getContextClassLoader();
-      }
-
-      public void removeClassLoader(DeploymentUnit unit) throws Exception
-      {
-      }
-   }
-}

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import org.jboss.wsf.spi.transport.HttpListenerRef;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.transport.HttpSpec;
-import org.jboss.wsf.spi.transport.ListenerRef;
-import org.jboss.wsf.spi.transport.TransportManager;
-import org.jboss.wsf.spi.transport.TransportSpec;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * TransportManager implementation that doesn't create physical
- * endpoints (ports, etc) but simply constructs a service endpoint address for a given
- * deployment;
- *  
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class NoopHttpTransportManager implements TransportManager
-{
-   public ListenerRef createListener(Endpoint endpoint, TransportSpec transportSpec)
-   {
-      if(! (transportSpec instanceof HttpSpec))
-         throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
-
-      HttpSpec httpSpec = (HttpSpec)transportSpec;
-
-      SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
-      ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
-      ServerConfig serverConfig = spi.getServerConfig();
-
-      String host = serverConfig.getWebServiceHost();
-      int port = serverConfig.getWebServicePort();
-      String hostAndPort = host + (port > 0 ? ":" + port : "");
-      
-      try
-      {
-         String ctx = httpSpec.getWebContext();
-         String pattern = httpSpec.getUrlPattern();
-         ListenerRef ref =  new HttpListenerRef(
-           ctx, pattern,
-           new URI("http://"+hostAndPort+ctx+pattern)
-         );
-
-         return ref;
-
-      } catch (URISyntaxException e)
-      {
-         throw new RuntimeException("Failed to create ListenerRef", e);
-      }
-   }
-
-   public void destroyListener(ListenerRef ref)
-   {
-      // noop  
-   }
-}

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WSFRuntimeDelegateHttpServer.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WSFRuntimeDelegateHttpServer.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WSFRuntimeDelegateHttpServer.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,132 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import org.jboss.wsf.common.ResourceLoaderAdapter;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.WSFRuntime;
-import org.jboss.wsf.spi.WSFRuntimeLocator;
-import org.jboss.wsf.spi.deployment.AbstractExtensible;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
-import org.jboss.wsf.spi.deployment.Service;
-import org.jboss.wsf.spi.http.HttpContext;
-import org.jboss.wsf.spi.http.HttpContextFactory;
-import org.jboss.wsf.spi.http.HttpServer;
-
-import javax.xml.ws.Endpoint;
-import javax.xml.ws.WebServiceException;
-
-/**
- * A HTTP Server that uses DeploymentAspects
- *
- * @author Thomas.Diesler at jboss.org
- * @since 07-Jul-2006
- */
-public class WSFRuntimeDelegateHttpServer extends AbstractExtensible implements HttpServer
-{
-   /** Start an instance of this HTTP server */
-   public void start()
-   {
-      // verify required properties
-   }
-
-   /** Create an HTTP context */
-   public HttpContext createContext(String contextRoot)
-   {
-      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-      HttpContext httpContext = spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this, contextRoot);
-      return httpContext;
-   }
-
-   /** Publish an JAXWS endpoint to the HTTP server */
-   public void publish(HttpContext context, Endpoint endpoint)
-   {
-      Class implClass = getImplementorClass(endpoint);
-
-      try
-      {
-         // Get the deployment model factory
-         SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-         WSFRuntimeLocator locator = spiProvider.getSPI(WSFRuntimeLocator.class);
-         WSFRuntime runtime = locator.locateRuntime("EndpointAPIRuntime");
-
-         DeploymentModelFactory depModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
-
-         // Create/Setup the deployment
-         Deployment dep = depModelFactory.newDeployment("endpoint-deployment", implClass.getClassLoader());
-         dep.setType(Deployment.DeploymentType.JAXWS_JSE);
-         dep.setRuntimeClassLoader(dep.getInitialClassLoader());
-         
-         // TODO: Hack, should this become another DeploymentAspect?
-         ((ArchiveDeployment)dep).setRootFile(new ResourceLoaderAdapter());
-
-         // Create/Setup the service
-         Service service = dep.getService();
-         service.setContextRoot(context.getContextRoot());
-
-         // Create/Setup the endpoint
-         org.jboss.wsf.spi.deployment.Endpoint ep = depModelFactory.newEndpoint(implClass.getName());
-         ep.setShortName(implClass.getName()+"-Endpoint");
-         ep.setURLPattern("/*");
-         service.addEndpoint(ep);
-
-         // Deploy using deployment aspects
-         runtime.create(dep);  
-         runtime.start(dep);  
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception ex)
-      {
-         throw new WebServiceException(ex);
-      }
-   }
-
-   /** Destroys an JAXWS endpoint on the HTTP server */
-   public void destroy(HttpContext context, Endpoint endpoint)
-   {
-      try
-      {
-         
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception ex)
-      {
-         throw new WebServiceException(ex);
-      }
-   }
-
-   private Class getImplementorClass(Endpoint endpoint)
-   {
-      Object implementor = endpoint.getImplementor();
-      Class implClass = (implementor instanceof Class ? (Class)implementor : implementor.getClass());
-      return implClass;
-   }
-}

Added: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentAspect.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentAspect.java	                        (rev 0)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentAspect.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.container.jboss50.transport;
+
+import javax.security.jacc.PolicyConfiguration;
+import javax.security.jacc.PolicyConfigurationFactory;
+import org.jboss.web.WebPermissionMapping;
+import javax.xml.ws.WebServiceException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifier;
+
+/**
+ * Deploy the generated webapp to JBoss
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @author Anil.Saldhana at jboss.com
+ * @since 12-May-2006
+ */
+public class WebAppDeploymentAspect extends DeploymentAspect
+{
+   private WebMetaDataModifier webMetaDataModifier;
+
+   public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
+   {
+      this.webMetaDataModifier = webMetaDataModifier;
+   }
+
+   public void create(Deployment dep)
+   {
+      JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
+      if (jbwmd == null)
+         throw new WebServiceException("Cannot find web meta data");
+
+      DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+      if (unit != null)
+      {
+         try
+         {
+            webMetaDataModifier.modifyMetaData(dep);
+            
+            try
+            {
+               generateJACCPermissions(dep.getSimpleName(), jbwmd); // TODO: make it another deployment aspect
+            }
+            catch (Exception e)
+            {
+               throw new RuntimeException("Exception generating JACC perms:",e);
+            }
+         
+            // Attaching it to the DeploymentUnit will cause a new webapp deployment
+            unit.addAttachment(JBossWebMetaData.class, jbwmd);
+            unit.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
+         }
+         catch (Exception ex)
+         {
+            WSFDeploymentException.rethrow(ex);
+         }
+      }
+      else
+      {
+         throw new IllegalStateException("Cannot obtain deployment unit");
+      }
+   }
+
+   /**
+    * JBAS-5935: The dynamic web application generated by the JBossWS
+    * does not go through the war security deployer. Hence the JACC
+    * permissions are not created. There is a need to explicitly create
+    * the war jacc permissions.
+    * @param depName
+    * @param jbwmd
+    * @throws Exception
+    */
+   protected void generateJACCPermissions(String depName, JBossWebMetaData jbwmd)
+   throws Exception
+   {
+      PolicyConfigurationFactory policyConfigurationFactory = 
+         PolicyConfigurationFactory.getPolicyConfigurationFactory();
+      PolicyConfiguration policyConfiguration = 
+         policyConfigurationFactory.getPolicyConfiguration(depName, false);
+      WebPermissionMapping.createPermissions(jbwmd, policyConfiguration);
+      policyConfiguration.commit();
+   }
+}

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import javax.security.jacc.PolicyConfiguration;
-import javax.security.jacc.PolicyConfigurationFactory;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit; 
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.web.WebPermissionMapping;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.WebMetaDataModifier;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import org.jboss.wsf.spi.transport.HttpSpec;
-
-/**
- * Deploy the generated webapp to JBoss by attaching it
- * to the {@link org.jboss.deployers.structure.spi.DeploymentUnit}
- * 
- * @author Thomas.Diesler at jboss.org
- * @author Heiko.Braun at jboss.com
- * @author Anil.Saldhana at jboss.com
- * 
- * @since 12-May-2006
- */
-public class WebAppDeploymentFactory
-{
-   private WebMetaDataModifier webMetaDataModifier;
-
-   public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
-   {
-      this.webMetaDataModifier = webMetaDataModifier;
-   }
-
-   /**
-    * Creates and attaches web meta data to a deployment unit
-    * @param dep    
-    * @return a mofified deployment unit
-    */
-   public DeploymentUnit create(Deployment dep, JBossWebMetaData jbwmd )
-   {
-      if (jbwmd == null)
-         throw new IllegalArgumentException("Web meta data is cannot be null");
-
-      DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
-      if (unit != null)
-      {
-         try
-         {
-            webMetaDataModifier.modifyMetaData(dep);
-            
-
-            //Generate the JACC permissions here
-            try
-            {
-               generateJACCPermissions(dep.getSimpleName(), jbwmd);
-            }
-            catch (Exception e)
-            {
-               throw new RuntimeException("Exception generating JACC perms:",e);
-            }
-         
-            // Attaching it to the DeploymentUnit will cause a new webapp deployment
-            unit.addAttachment(JBossWebMetaData.class, jbwmd);
-            unit.addAttachment(HttpSpec.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE); 
-
-         }
-         catch (Exception ex)
-         {
-            WSFDeploymentException.rethrow(ex);
-         }
-      }
-      else
-      {
-         throw new IllegalStateException("Cannot obtain deployment unit");
-      }
-
-      return unit;
-   }
-   
-   public void destroy(Deployment dep)
-   {
-      // nothing to do?
-   }
-   
-   /**
-    * JBAS-5935: The dynamic web application generated by the JBossWS
-    * does not go through the war security deployer. Hence the JACC
-    * permissions are not created. There is a need to explicitly create
-    * the war jacc permissions.
-    * @param depName
-    * @param jbwmd
-    * @throws Exception
-    */
-   protected void generateJACCPermissions(String depName, JBossWebMetaData jbwmd)
-   throws Exception
-   {
-      PolicyConfigurationFactory policyConfigurationFactory = 
-         PolicyConfigurationFactory.getPolicyConfigurationFactory();
-      PolicyConfiguration policyConfiguration = 
-         policyConfigurationFactory.getPolicyConfiguration(depName, false);
-      WebPermissionMapping.createPermissions(jbwmd, policyConfiguration);
-      policyConfiguration.commit();
-   }
-}

Deleted: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGenerator.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGenerator.java	2008-10-29 15:32:32 UTC (rev 8583)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGenerator.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -1,282 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50.transport;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.AuthConstraintMetaData;
-import org.jboss.metadata.web.spec.LoginConfigMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
-import org.jboss.wsf.spi.annotation.WebContext;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.SecurityHandler;
-
-/**
- * Generates a webapp for an EJB endpoint
- * which will be process by {@link org.jboss.wsf.container.jboss50.transport.WebAppDeploymentFactory}
- * 
- * @author Thomas.Diesler at jboss.org
- * @author Heiko.Braun at jboss.com
- * 
- * @since 13-Oct-2007
- */
-public class WebAppGenerator
-{
-   private SecurityHandler securityHandlerEJB21;
-   private SecurityHandler securityHandlerEJB3;
-
-   public void setSecurityHandlerEJB21(SecurityHandler handler)
-   {
-      this.securityHandlerEJB21 = handler;
-   }
-
-   public void setSecurityHandlerEJB3(SecurityHandler handler)
-   {
-      this.securityHandlerEJB3 = handler;
-   }
-
-   public JBossWebMetaData create(Deployment dep)
-   {
-      JBossWebMetaData jbwmd = null;
-
-      String typeStr = dep.getType().toString();
-      if (typeStr.endsWith("EJB21"))
-      {
-         jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB21);
-         dep.addAttachment(JBossWebMetaData.class, jbwmd);
-      }
-      else if (typeStr.endsWith("EJB3"))
-      {
-         jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB3);
-         dep.addAttachment(JBossWebMetaData.class, jbwmd);
-      }
-      else
-      {
-         jbwmd = generatWebDeployment((ArchiveDeployment)dep, null);
-         dep.addAttachment(JBossWebMetaData.class, jbwmd);
-      }
-
-      return jbwmd;
-   }
-
-   protected JBossWebMetaData generatWebDeployment(ArchiveDeployment dep, SecurityHandler securityHandler)
-   {
-      JBossWebMetaData jbwmd = new JBossWebMetaData();
-      createWebAppDescriptor(dep, jbwmd, securityHandler);
-      createJBossWebAppDescriptor(dep, jbwmd, securityHandler);
-      return jbwmd;
-   }
-
-   protected void createWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
-   {
-      /*
-       <servlet>
-       <servlet-name>
-       <servlet-class>
-       </servlet>
-       */
-      JBossServletsMetaData servlets = jbwmd.getServlets();
-      for (Endpoint ep : dep.getService().getEndpoints())
-      {
-         JBossServletMetaData servlet = new JBossServletMetaData();
-         servlet.setServletName(ep.getShortName());
-         servlet.setServletClass(ep.getTargetBeanName());
-         servlets.add(servlet);
-      }
-
-      /*
-       <servlet-mapping>
-       <servlet-name>
-       <url-pattern>
-       </servlet-mapping>
-       */
-      for (Endpoint ep : dep.getService().getEndpoints())
-      {
-         List<ServletMappingMetaData> servletMappings = jbwmd.getServletMappings();
-         if (servletMappings == null)
-         {
-            servletMappings = new ArrayList<ServletMappingMetaData>();
-            jbwmd.setServletMappings(servletMappings);
-         }
-         ServletMappingMetaData servletMapping = new ServletMappingMetaData();
-         servletMapping.setServletName(ep.getShortName());
-         servletMapping.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
-         servletMappings.add(servletMapping);
-      }
-
-      String authMethod = null;
-
-      // Add web-app/security-constraint for each port component
-      for (Endpoint ep : dep.getService().getEndpoints())
-      {
-         String ejbName = ep.getShortName();
-
-         Boolean secureWSDLAccess = null;
-         String transportGuarantee = null;
-         String beanAuthMethod = null;
-
-         WebContext anWebContext = (WebContext)ep.getTargetBeanClass().getAnnotation(WebContext.class);
-         if (anWebContext != null)
-         {
-            if (anWebContext.authMethod().length() > 0)
-               beanAuthMethod = anWebContext.authMethod();
-            if (anWebContext.transportGuarantee().length() > 0)
-               transportGuarantee = anWebContext.transportGuarantee();
-            if (anWebContext.secureWSDLAccess())
-               secureWSDLAccess = anWebContext.secureWSDLAccess();
-         }
-
-         EJBArchiveMetaData appMetaData = dep.getAttachment(EJBArchiveMetaData.class);
-         if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) != null)
-         {
-            EJBMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
-            EJBSecurityMetaData smd = bmd.getSecurityMetaData();
-            if (smd != null)
-            {
-               beanAuthMethod = smd.getAuthMethod();
-               transportGuarantee = smd.getTransportGuarantee();
-               secureWSDLAccess = smd.getSecureWSDLAccess();
-            }
-         }
-
-         if (beanAuthMethod != null || transportGuarantee != null)
-         {
-            /*
-             <security-constraint>
-             <web-resource-collection>
-             <web-resource-name>TestUnAuthPort</web-resource-name>
-             <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
-             </web-resource-collection>
-             <auth-constraint>
-             <role-name>*</role-name>
-             </auth-constraint>
-             <user-data-constraint>
-             <transport-guarantee>NONE</transport-guarantee>
-             </user-data-constraint>
-             </security-constraint>
-             */
-            List<SecurityConstraintMetaData> securityContraints = jbwmd.getSecurityContraints();
-            if (securityContraints == null)
-            {
-               securityContraints = new ArrayList<SecurityConstraintMetaData>();
-               jbwmd.setSecurityContraints(securityContraints);
-            }
-            SecurityConstraintMetaData securityConstraint = new SecurityConstraintMetaData();
-            securityContraints.add(securityConstraint);
-            
-            WebResourceCollectionsMetaData resourceCollections = securityConstraint.getResourceCollections();
-            if (resourceCollections == null)
-            {
-               resourceCollections = new WebResourceCollectionsMetaData();
-               securityConstraint.setResourceCollections(resourceCollections);
-            }
-            WebResourceCollectionMetaData resourceCollection = new WebResourceCollectionMetaData();
-            resourceCollections.add(resourceCollection);
-            
-            resourceCollection.setWebResourceName(ejbName);
-            resourceCollection.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
-            ArrayList<String> httpMethods = new ArrayList<String>();
-            resourceCollection.setHttpMethods(httpMethods);
-            if (Boolean.TRUE.equals(secureWSDLAccess))
-            {
-               httpMethods.add("GET");
-            }
-            httpMethods.add("POST");
-
-            // Optional auth-constraint
-            if (beanAuthMethod != null)
-            {
-               // Only the first auth-method gives the war login-config/auth-method
-               if (authMethod == null)
-                  authMethod = beanAuthMethod;
-
-               AuthConstraintMetaData authConstraint = new AuthConstraintMetaData();
-               authConstraint.setRoleNames(Arrays.asList(new String[] { "*" }));
-               securityConstraint.setAuthConstraint(authConstraint);
-            }
-            // Optional user-data-constraint
-            if (transportGuarantee != null)
-            {
-               UserDataConstraintMetaData userDataConstraint = new UserDataConstraintMetaData();
-               userDataConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(transportGuarantee));
-               securityConstraint.setUserDataConstraint(userDataConstraint);
-            }
-         }
-      }
-
-      // Optional login-config/auth-method
-      if (authMethod != null && securityHandler != null)
-      {
-         LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
-         if (loginConfig == null)
-         {
-            loginConfig = new LoginConfigMetaData();
-            jbwmd.setLoginConfig(loginConfig);
-         }
-         loginConfig.setAuthMethod(authMethod);
-         loginConfig.setRealmName("EJBServiceEndpointServlet Realm");
-
-         securityHandler.addSecurityRoles(jbwmd, dep);
-      }
-   }
-
-   protected void createJBossWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
-   {
-      /* Create a jboss-web
-       <jboss-web>
-       <security-domain>java:/jaas/cts</security-domain>
-       <context-root>/ws/ejbN/</context-root>
-       <virtual-host>some.domain.com</virtual-host>
-       </jboss-web>
-       */
-      if (securityHandler != null)
-         securityHandler.addSecurityDomain(jbwmd, dep);
-
-      // Get the context root for this deployment
-      String contextRoot = dep.getService().getContextRoot();
-      if (contextRoot == null)
-         throw new WSFDeploymentException("Cannot obtain context root");
-
-      jbwmd.setContextRoot(contextRoot);
-      String[] virtualHosts = dep.getService().getVirtualHosts();
-      if (virtualHosts != null && virtualHosts.length > 0)
-      {
-         jbwmd.setVirtualHosts(Arrays.asList(virtualHosts));
-      }
-   }
-}

Added: container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java
===================================================================
--- container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java	                        (rev 0)
+++ container/jboss50/ropalka-trunk/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java	2008-10-29 19:57:20 UTC (rev 8584)
@@ -0,0 +1,277 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.container.jboss50.transport;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.wsf.spi.annotation.WebContext;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.SecurityHandler;
+
+/**
+ * A deployment aspect that generates a webapp for an EJB endpoint 
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 13-Oct-2007
+ */
+public class WebAppGeneratorDeploymentAspect extends DeploymentAspect
+{
+   private SecurityHandler securityHandlerEJB21;
+   private SecurityHandler securityHandlerEJB3;
+
+   public void setSecurityHandlerEJB21(SecurityHandler handler)
+   {
+      this.securityHandlerEJB21 = handler;
+   }
+
+   public void setSecurityHandlerEJB3(SecurityHandler handler)
+   {
+      this.securityHandlerEJB3 = handler;
+   }
+
+   @Override
+   public void create(Deployment dep)
+   {
+      String typeStr = dep.getType().toString();
+      if (typeStr.endsWith("EJB21"))
+      {
+         JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB21);
+         dep.addAttachment(JBossWebMetaData.class, jbwmd);
+      }
+      else if (typeStr.endsWith("EJB3"))
+      {
+         JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB3);
+         dep.addAttachment(JBossWebMetaData.class, jbwmd);
+      }
+      else
+      {
+         JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, null);
+         dep.addAttachment(JBossWebMetaData.class, jbwmd);
+      }
+   }
+
+   protected JBossWebMetaData generatWebDeployment(ArchiveDeployment dep, SecurityHandler securityHandler)
+   {
+      JBossWebMetaData jbwmd = new JBossWebMetaData();
+      createWebAppDescriptor(dep, jbwmd, securityHandler);
+      createJBossWebAppDescriptor(dep, jbwmd, securityHandler);
+      return jbwmd;
+   }
+
+   protected void createWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
+   {
+      /*
+       <servlet>
+       <servlet-name>
+       <servlet-class>
+       </servlet>
+       */
+      JBossServletsMetaData servlets = jbwmd.getServlets();
+      for (Endpoint ep : dep.getService().getEndpoints())
+      {
+         JBossServletMetaData servlet = new JBossServletMetaData();
+         servlet.setServletName(ep.getShortName());
+         servlet.setServletClass(ep.getTargetBeanName());
+         servlets.add(servlet);
+      }
+
+      /*
+       <servlet-mapping>
+       <servlet-name>
+       <url-pattern>
+       </servlet-mapping>
+       */
+      for (Endpoint ep : dep.getService().getEndpoints())
+      {
+         List<ServletMappingMetaData> servletMappings = jbwmd.getServletMappings();
+         if (servletMappings == null)
+         {
+            servletMappings = new ArrayList<ServletMappingMetaData>();
+            jbwmd.setServletMappings(servletMappings);
+         }
+         ServletMappingMetaData servletMapping = new ServletMappingMetaData();
+         servletMapping.setServletName(ep.getShortName());
+         servletMapping.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
+         servletMappings.add(servletMapping);
+      }
+
+      String authMethod = null;
+
+      // Add web-app/security-constraint for each port component
+      for (Endpoint ep : dep.getService().getEndpoints())
+      {
+         String ejbName = ep.getShortName();
+
+         Boolean secureWSDLAccess = null;
+         String transportGuarantee = null;
+         String beanAuthMethod = null;
+
+         WebContext anWebContext = (WebContext)ep.getTargetBeanClass().getAnnotation(WebContext.class);
+         if (anWebContext != null)
+         {
+            if (anWebContext.authMethod().length() > 0)
+               beanAuthMethod = anWebContext.authMethod();
+            if (anWebContext.transportGuarantee().length() > 0)
+               transportGuarantee = anWebContext.transportGuarantee();
+            if (anWebContext.secureWSDLAccess())
+               secureWSDLAccess = anWebContext.secureWSDLAccess();
+         }
+
+         EJBArchiveMetaData appMetaData = dep.getAttachment(EJBArchiveMetaData.class);
+         if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) != null)
+         {
+            EJBMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
+            EJBSecurityMetaData smd = bmd.getSecurityMetaData();
+            if (smd != null)
+            {
+               beanAuthMethod = smd.getAuthMethod();
+               transportGuarantee = smd.getTransportGuarantee();
+               secureWSDLAccess = smd.getSecureWSDLAccess();
+            }
+         }
+
+         if (beanAuthMethod != null || transportGuarantee != null)
+         {
+            /*
+             <security-constraint>
+             <web-resource-collection>
+             <web-resource-name>TestUnAuthPort</web-resource-name>
+             <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
+             </web-resource-collection>
+             <auth-constraint>
+             <role-name>*</role-name>
+             </auth-constraint>
+             <user-data-constraint>
+             <transport-guarantee>NONE</transport-guarantee>
+             </user-data-constraint>
+             </security-constraint>
+             */
+            List<SecurityConstraintMetaData> securityContraints = jbwmd.getSecurityContraints();
+            if (securityContraints == null)
+            {
+               securityContraints = new ArrayList<SecurityConstraintMetaData>();
+               jbwmd.setSecurityContraints(securityContraints);
+            }
+            SecurityConstraintMetaData securityConstraint = new SecurityConstraintMetaData();
+            securityContraints.add(securityConstraint);
+            
+            WebResourceCollectionsMetaData resourceCollections = securityConstraint.getResourceCollections();
+            if (resourceCollections == null)
+            {
+               resourceCollections = new WebResourceCollectionsMetaData();
+               securityConstraint.setResourceCollections(resourceCollections);
+            }
+            WebResourceCollectionMetaData resourceCollection = new WebResourceCollectionMetaData();
+            resourceCollections.add(resourceCollection);
+            
+            resourceCollection.setWebResourceName(ejbName);
+            resourceCollection.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern() }));
+            ArrayList<String> httpMethods = new ArrayList<String>();
+            resourceCollection.setHttpMethods(httpMethods);
+            if (Boolean.TRUE.equals(secureWSDLAccess))
+            {
+               httpMethods.add("GET");
+            }
+            httpMethods.add("POST");
+
+            // Optional auth-constraint
+            if (beanAuthMethod != null)
+            {
+               // Only the first auth-method gives the war login-config/auth-method
+               if (authMethod == null)
+                  authMethod = beanAuthMethod;
+
+               AuthConstraintMetaData authConstraint = new AuthConstraintMetaData();
+               authConstraint.setRoleNames(Arrays.asList(new String[] { "*" }));
+               securityConstraint.setAuthConstraint(authConstraint);
+            }
+            // Optional user-data-constraint
+            if (transportGuarantee != null)
+            {
+               UserDataConstraintMetaData userDataConstraint = new UserDataConstraintMetaData();
+               userDataConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(transportGuarantee));
+               securityConstraint.setUserDataConstraint(userDataConstraint);
+            }
+         }
+      }
+
+      // Optional login-config/auth-method
+      if (authMethod != null && securityHandler != null)
+      {
+         LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
+         if (loginConfig == null)
+         {
+            loginConfig = new LoginConfigMetaData();
+            jbwmd.setLoginConfig(loginConfig);
+         }
+         loginConfig.setAuthMethod(authMethod);
+         loginConfig.setRealmName("EJBServiceEndpointServlet Realm");
+
+         securityHandler.addSecurityRoles(jbwmd, dep);
+      }
+   }
+
+   protected void createJBossWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
+   {
+      /* Create a jboss-web
+       <jboss-web>
+       <security-domain>java:/jaas/cts</security-domain>
+       <context-root>/ws/ejbN/</context-root>
+       <virtual-host>some.domain.com</virtual-host>
+       </jboss-web>
+       */
+      if (securityHandler != null)
+         securityHandler.addSecurityDomain(jbwmd, dep);
+
+      // Get the context root for this deployment
+      String contextRoot = dep.getService().getContextRoot();
+      if (contextRoot == null)
+         throw new WSFDeploymentException("Cannot obtain context root");
+
+      jbwmd.setContextRoot(contextRoot);
+      String[] virtualHosts = dep.getService().getVirtualHosts();
+      if (virtualHosts != null && virtualHosts.length > 0)
+      {
+         jbwmd.setVirtualHosts(Arrays.asList(virtualHosts));
+      }
+   }
+}




More information about the jbossws-commits mailing list