[jboss-svn-commits] JBL Code SVN: r33932 - in labs/jbossesb/trunk: product/rosetta/src/org/jboss/internal/soa/esb/util and 16 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 16 03:12:37 EDT 2010


Author: mageshbk at jboss.com
Date: 2010-07-16 03:12:34 -0400 (Fri, 16 Jul 2010)
New Revision: 33932

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilderUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_webgateway.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/webgateway.esb
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/test_esb_archives/esbwarfiles/
   labs/jbossesb/trunk/qa/junit/resources/server/sysprop/
   labs/jbossesb/trunk/qa/junit/resources/server/sysprop/WEB-INF/
   labs/jbossesb/trunk/qa/junit/resources/server/sysprop/WEB-INF/web.xml
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/deployment.xml
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/jboss-esb.xml
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/fault.xsd
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/jbm-queue-service.xml
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/request.xsd
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/response.xsd
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-request-type.xsd
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-response-type.xsd
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/subtypes/
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/subtypes/custom-subtype-type.xsd
   labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/type2-type.xsd
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/JBESB_2874_DeployUnitTest.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_01.xml
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_02.xml
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/sysprop/
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/sysprop/SysPropServlet.java
Removed:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployer.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml
Modified:
   labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbConfigParser.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployerUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.java
   labs/jbossesb/trunk/qa/base-cp.xml
   labs/jbossesb/trunk/qa/junit/build.xml
Log:
[JBESB-2874] - Re-factored Deployments to rebuild ESB configuration and redeploy EBWS/HTTP gateways when a dependent deployment is modified.

Modified: labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml
===================================================================
--- labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -54,16 +54,10 @@
 		<property name="actionArtifactsFile">/actionArtifactMap.properties</property>
 	</bean>
 
-	<bean name="EsbWebServiceDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWebServiceDeployer">
-        <depends>EsbPropertyService</depends>
-    </bean>
-
-	<bean name="EsbWsdlDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWsdlDeployer">
-		<depends>EsbPropertyService</depends>
-	</bean>
-
 	<bean name="EsbDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbDeployer">
 		<property name="esbBeanPrefix">jboss.esb</property>
+		<property name="mainDeployer"><inject bean="MainDeployer"/></property>
+		<property name="warFilesDir">${jboss.server.temp.dir}</property>
 		<depends>EsbPropertyService</depends>
 	</bean>
 	

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -22,16 +22,23 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
 import javax.management.MalformedObjectNameException;
@@ -53,11 +60,14 @@
 import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
 import org.jboss.soa.esb.listeners.config.model.ModelParser;
 import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.util.FileUtil;
+import org.jboss.soa.esb.util.JarUtil;
 
 /**
  * Util class for JBoss AS Deployers.
  * 
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  * 
  */
 public class JBossDeployerUtil
@@ -218,4 +228,122 @@
         return deps;
     }
 
+    public static Map<String, String> getSchemas(final File file) throws DeploymentException
+    {
+        if (file == null)
+        {
+            return Collections.emptyMap();
+        }
+        
+        if (file.isDirectory()) 
+        {
+            return getSchemasFromDirectory(file);
+        }
+        
+        final String fileName = file.getName();
+        if (fileName.endsWith(".esb"))
+            return getSchemasFromArchive(file);
+            
+        if (fileName.endsWith("-esb.xml"))
+        {
+            final File metaInf = file.getParentFile();
+            final File deploymentRoot = metaInf.getParentFile();
+            return getSchemasFromDirectory(deploymentRoot);
+        }
+        
+        throw new DeploymentException("Unrecognized deployment : " + file + ".");
+    }
+    
+    public static Map<String, String> getSchemasFromDirectory(final File directory) throws DeploymentException
+    {
+        final URI rootURI = directory.toURI() ;
+        return getSchemasFromDir(rootURI, directory);
+    }
+
+    private static Map<String, String> getSchemasFromDir(final URI root, final File directory) throws DeploymentException
+    {
+        if (directory != null)
+        {
+            final Map<String, String> schemasMap = new HashMap<String, String>();
+            
+            if (directory.isDirectory())
+            {
+                final File[] files = directory.listFiles();
+                for (File file : files)
+                {
+                    if (file.isDirectory())
+                    {
+                        schemasMap.putAll(getSchemasFromDir(root, file));
+                    }
+                    else if (isXsd(file.getName()))
+                    {
+                        try
+                        {
+                            final URI relativeURI = root.relativize(file.toURI()) ;
+                            final String filename = relativeURI.getPath();
+                            schemasMap.put(filename, FileUtil.readTextFile(file));
+                        } 
+                        catch (final IOException e)
+                        {
+                            throw new DeploymentException("IOException while trying to read xsd '" + file.getName() + "'", e);
+                        }
+                    }
+                    else if (file.getName().endsWith(".jar"))
+                    {
+                        Map<String, String> schemasFromArchive = getSchemasFromArchive(file);
+                        schemasMap.putAll(schemasFromArchive);
+                    }
+                }
+            }
+            return schemasMap;
+        }
+        
+        return Collections.emptyMap();
+    }
+    
+    private static boolean isXsd(final String fileName)
+    {
+        return fileName.endsWith(".xsd");
+    }
+    
+    public static Map<String, String> getSchemasFromArchive(final File archive) throws DeploymentException
+    {
+        if (archive == null)
+        {
+            return Collections.emptyMap();
+        }
+        
+        ZipInputStream zipInputStream = null;
+        try
+        {
+            zipInputStream = new ZipInputStream(new FileInputStream(archive));
+            return JarUtil.extractStringContents(".xsd", zipInputStream);
+        }
+        catch (FileNotFoundException e)
+        {
+            throw new DeploymentException(e.getMessage(), e);
+        }
+        catch (IOException e)
+        {
+            throw new DeploymentException(e.getMessage(), e);
+        }
+        finally
+        {
+            closeStream(zipInputStream);
+        }
+    }
+    
+    private static void closeStream (InputStream in)
+    {
+        try
+        {
+            in.close();
+        }
+        catch (final IOException e)
+        {
+            log.warn(e.getMessage(), e);
+        }
+        
+    }
+
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -21,17 +21,10 @@
 */
 package org.jboss.soa.esb.listeners.config;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URI;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -50,17 +43,7 @@
 import org.jboss.deployment.DeploymentInfo;
 import org.jboss.deployment.SubDeployer;
 import org.jboss.deployment.SubDeployerSupport;
-import org.jboss.internal.soa.esb.listeners.war.Filter;
-import org.jboss.internal.soa.esb.listeners.war.Servlet;
-import org.jboss.internal.soa.esb.listeners.war.WebDeploymentArchive;
-import org.jboss.internal.soa.esb.listeners.war.WebModel;
-import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
 import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
-import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
-import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
-import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
-import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.MetaData;
 import org.jboss.metadata.XmlFileLoader;
@@ -71,17 +54,15 @@
 import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
 import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
-import org.jboss.soa.esb.util.DeploymentArchive;
-import org.jboss.soa.esb.util.FileUtil;
-import org.jboss.soa.esb.util.JarUtil;
 import org.jboss.system.ServiceControllerMBean;
 import org.jboss.web.AbstractWebContainer;
 import org.w3c.dom.Element;
 
 /**
- * comment
+ * The JBoss AS 4 ESB deployer
  *
  * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  * @version $Revision: 1.1 $
  */
 public class JBoss4ESBDeployer extends SubDeployerSupport
@@ -96,7 +77,6 @@
    
    private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
    private static final String ESB_ARTIFACT_NAME = "jbossesb.esb" ;
-   private static final String SUB_DEPLOYMENTS = JBoss4ESBDeployer.class.getName() + "#SUB_DEPLOYMENTS";
     
    /**
     * The path the the directory that will be used to generate the war file
@@ -260,32 +240,18 @@
             throw new DeploymentException("Unable to find document url of META-INF/jboss-esb.xml in: "
                     + di.url);
          }
-         final String jbossEsbXml = JBossDeployerUtil.readEsbConfig(document.openStream()); ;
-         
+
+         JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(document, di, esbWarFiles);
          final Set<ObjectName> deps = new HashSet<ObjectName>();
-         final ModelAdapter model = JBossDeployerUtil.getJbossEsbModel(jbossEsbXml) ;
-         addActionDependencies(di.shortName, model, deps) ;
-         
-         JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(jbossEsbXml, di.shortName);
+         addActionDependencies(di.shortName, deployment.getModel(), deps) ;
+
          initialiseDeploymentName(deployment) ;
          final String deploymentName = deployment.getDeploymentName() ;
          di.context.put(JBoss4ESBDeploymentMetaData.class, new JBoss4ESBDeploymentMetaData(deployment, deploymentName, deps)) ;
-         di.context.put(SUB_DEPLOYMENTS, new ArrayList<File>()) ;
 
          // invoke super-class initialization
          super.init(di);
 
-         // Deploy web gateways...
-          final ClassLoader origCL = Thread.currentThread().getContextClassLoader() ;
-          try
-          {
-              Thread.currentThread().setContextClassLoader(di.localCl) ;
-              deployWebGateways(deployment, model, di);
-          }
-          finally
-          {
-              Thread.currentThread().setContextClassLoader(origCL) ;
-          }
       }
       catch (Exception e)
       {
@@ -427,170 +393,7 @@
           }
       }
    }
-   
-	private void createWebserviceWars(final DeploymentInfo di, final ModelAdapter model, final String deploymentName,
-                                     final List<ContractReferencePublisher> publishers, WebDeploymentArchive webDeployment)
-       throws DeploymentException
-   {
-       final List<WebserviceInfo> endpointServices =  model.getWebserviceServices() ;
-       if (endpointServices != null)
-       {
-           if (endpointServices.size() > 0)
-           {
-               try
-               {
-                   final JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator() ;
-                   
-                   for(WebserviceInfo webserviceInfo: endpointServices)
-                   {
-                       final Service service = webserviceInfo.getService() ;
 
-                       // Copy all schemas to the wsdl directory to support imports.
-                       final File esbArchive = new File(di.watch.getFile());
-                       final Map<String, String> schemasMap = JBoss4ESBDeployer.getSchemas(esbArchive);
-                       final String wsdlDir = "WEB-INF/wsdl/" + service.getCategory().replace('/', '_') + "/";
-                       for (Entry<String, String> schemaEntry : schemasMap.entrySet())
-                       {
-                           webDeployment.addEntry(wsdlDir + schemaEntry.getKey(), schemaEntry.getValue().getBytes());
-                           log.debug("Added schema " + wsdlDir + schemaEntry.getKey());
-                       }
-                       
-                       final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(webserviceInfo) ;
-                       final String wsdl = ESBContractGenerator.generateWSDL(webserviceInfo, serviceInfo, new WebDeploymentClassLoader(di.localCl, schemasMap)) ;
-                       webDeployment.addEntry(serviceInfo.getWSDLFileName(), wsdl.getBytes("UTF-8"));
-
-                       final String handlers = JBossDeployerUtil.getHandlers(serviceInfo) ;
-                       final boolean includeHandlers = (handlers != null) ;
-                       if (includeHandlers)
-                       {
-                           final String wsHandlerName = "WEB-INF/classes/" + serviceInfo.getPackageName().replace('.', '/') + "/esb-jaxws-handlers.xml" ;
-                           webDeployment.addEntry(wsHandlerName, handlers.getBytes("UTF-8"));
-                       }
-                       
-                       final byte[] wsClass = generator.generate(service.getCategory(),
-                           service.getName(), serviceInfo, includeHandlers) ;
-                       final String wsClassName = serviceInfo.getClassName().replace('.', '/') + ".class" ;
-                       webDeployment.addEntry("WEB-INF/classes/" + wsClassName, wsClass);
-
-                       // Servlet....
-                       final Servlet servlet = new Servlet(serviceInfo.getServletName(), serviceInfo.getClassName(), webDeployment.getWebModel());
-                       servlet.getUrlMappings().add("/ebws" + serviceInfo.getServletPath());
-
-                       // Filter...
-                       // At the moment we only need the filter to overcome a bug in JBossWS re In-Only endpoints, so
-                       // we only include for one way services...
-                       if(serviceInfo.isOneWay()) {
-                           new Filter(serviceInfo.getServletName() + "_Filter", ESBResponseFilter.class.getName(), servlet);
-                       }
-
-                       final ContractReferencePublisher publisher = new ESBServiceContractReferencePublisher(service, webserviceInfo.getDescription(), serviceInfo.getServletName()) ;
-                       publishers.add(publisher) ;
-                   }
-               }
-               catch (final Exception ex)
-               {
-                   throw new DeploymentException("Failed to create webservice artifact", ex) ;
-               }
-           }
-       }
-   }
-
-    private void deployWebGateways(JBoss4ESBDeployment deployment, ModelAdapter model, DeploymentInfo di) throws ConfigurationException, DeploymentException, JMException {
-        final String deploymentName = deployment.getDeploymentName() ;
-        final List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>() ;
-        WebDeploymentArchive webDeployment = new WebDeploymentArchive(getESBWarFileName(di));
-        WebModel webModel = webDeployment.getWebModel();
-        
-        // Set the global security domain and global security method.
-        // These setting are shared for all http-providers and EBWSs 
-        // in a jboss-esb.xml file. 
-        webModel.setAuthDomain(model.getAuthDomain());
-        webModel.setAuthMethod(model.getAuthMethod());
-
-        // Add the EBWS components...
-        createWebserviceWars(di, model, deploymentName, publishers, webDeployment);
-
-        // Add the web deployments info to the WebModel...
-        ModelUtil.updateWebModel(ModelUtil.getListenerGroups(model), webModel);
-
-        // Add a sub-deloyment for the web model...
-        List<Servlet> servlets = webModel.getServlets();
-        if(!servlets.isEmpty()) {
-            
-            // Finalize the webDeployment...
-            webDeployment.finalizeArchive();
-
-            // Now create and deploy the web deployment...
-            File file = createGatewayTempDeployment(webDeployment, di);
-            try {
-                deployUrl(di, file.toURL(), webDeployment.getArchiveName());
-
-                // Maintain a list of sub deployments so we can clean them
-                // up on undeploy...
-                getSubDeployments(di).add(file);
-            } catch (Throwable throwable) {
-                if(file.exists()) {
-                    file.delete();
-                }
-                throw new ConfigurationException("Error deploying '" + file.getAbsolutePath() + "'.", throwable);
-            }
-
-            deployment.setPublishers(publishers) ;
-            deployment.setServlets(servlets);
-        }
-    }
-
-    private File createGatewayTempDeployment(DeploymentArchive deploymentArchive, DeploymentInfo di) throws ConfigurationException {
-
-        File gatewayDeployFile = createTempDeploymentFile(esbWarFiles, deploymentArchive.getArchiveName(), true);
-        FileOutputStream fileOutStream;
-
-        try {
-            fileOutStream = new FileOutputStream(gatewayDeployFile);
-        } catch (FileNotFoundException e) {
-            throw new ConfigurationException("Unexpected exception.", e);
-        }
-
-        try {
-            deploymentArchive.toOutputStream(fileOutStream);
-        } catch (IOException e) {
-            throw new ConfigurationException("Error writing deployment archive '" + gatewayDeployFile.getAbsolutePath() + "'.", e);
-        } finally {
-            try {
-                fileOutStream.close();
-            } catch (IOException e) {
-                log.warn("Error closing deployment archive stream '" + gatewayDeployFile.getAbsolutePath() + "'", e);
-            }
-        }
-
-        return gatewayDeployFile;
-    }
-
-    private File createTempDeploymentFile(final File tempDir, final String archiveName, final boolean createDir) throws ConfigurationException {
-        if (!tempDir.exists())
-        {
-            if (!createDir)
-            {
-                return null ;
-            }
-            tempDir.mkdir() ;
-        }
-
-        File file = new File(tempDir, archiveName);
-        if(file.exists()) {
-            log.debug("Deployment archive '" + archiveName + "' already exists.  Overwriting!!");
-        }
-
-        return file;
-    }
-   
-    private String getESBWarFileName(final DeploymentInfo di)
-    {
-        final String esbName = di.shortName;
-        final int lastSeparator = esbName.lastIndexOf('.') ;
-        return ((lastSeparator >= 0) ? esbName.substring(0, lastSeparator) : esbName) + ".war" ;
-    }
-
    public synchronized void start(DeploymentInfo di)
            throws DeploymentException
    {
@@ -638,18 +441,6 @@
    {
       final JBoss4ESBDeploymentMetaData metaData = (JBoss4ESBDeploymentMetaData)di.context.get(JBoss4ESBDeploymentMetaData.class) ;
 
-       for(File subDeployment : getSubDeployments(di)) {
-           try {
-               if(subDeployment.exists()) {
-                   if(!subDeployment.delete()) {
-                       log.debug("Failed to delete sub deployment '" + subDeployment.getAbsolutePath() + "'.");
-                   }
-               }
-           } catch (Exception e) {
-               log.debug("Failed to delete deployment file '" + subDeployment.getAbsolutePath() + "'.  Exception: " + e.getMessage());
-           }
-       }
-
       if (metaData != null)
       {
           final String deploymentName = metaData.getDeploymentName() ;
@@ -684,10 +475,6 @@
     {
         esbNames.remove(deploymentName) ;
     }
-
-    private List<File> getSubDeployments(DeploymentInfo di) {
-        return (List<File>) di.context.get(SUB_DEPLOYMENTS);
-    }
     
     /**
      * Sets the directory that will be used for generating ESWS wars.
@@ -697,149 +484,4 @@
     {
         this.warFilesDir = dir;
     }
-
-    static Map<String, String> getSchemas(final File file) throws DeploymentException
-    {
-        if (file == null)
-        {
-            return Collections.emptyMap();
-        }
-        
-        if (file.isDirectory()) 
-        {
-            return getSchemasFromDirectory(file);
-        }
-        
-        final String fileName = file.getName();
-        if (fileName.endsWith(".esb"))
-            return getSchemasFromArchive(file);
-	        
-        if (fileName.endsWith("-esb.xml"))
-        {
-            final File metaInf = file.getParentFile();
-            final File deploymentRoot = metaInf.getParentFile();
-            return getSchemasFromDirectory(deploymentRoot);
-        }
-        
-        throw new DeploymentException("Unrecognized deployment : " + file + ".");
-    }
-    
-    static Map<String, String> getSchemasFromDirectory(final File directory) throws DeploymentException
-    {
-        final URI rootURI = directory.toURI() ;
-        return getSchemasFromDir(rootURI, directory);
-    }
-
-    private static Map<String, String> getSchemasFromDir(final URI root, final File directory) throws DeploymentException
-    {
-        if (directory != null)
-        {
-	        final Map<String, String> schemasMap = new HashMap<String, String>();
-            
-            if (directory.isDirectory())
-            {
-                final File[] files = directory.listFiles();
-                for (File file : files)
-                {
-                    if (file.isDirectory())
-                    {
-                        schemasMap.putAll(getSchemasFromDir(root, file));
-                    }
-                    else if (isXsd(file.getName()))
-                    {
-                        try
-                        {
-                            final URI relativeURI = root.relativize(file.toURI()) ;
-                            final String filename = relativeURI.getPath();
-                            schemasMap.put(filename, FileUtil.readTextFile(file));
-                        } 
-                        catch (final IOException e)
-                        {
-                            throw new DeploymentException("IOException while trying to read xsd '" + file.getName() + "'", e);
-                        }
-                    }
-                    else if (file.getName().endsWith(".jar"))
-                    {
-                        Map<String, String> schemasFromArchive = getSchemasFromArchive(file);
-                        schemasMap.putAll(schemasFromArchive);
-                    }
-                }
-            }
-            return schemasMap;
-        }
-        
-        return Collections.emptyMap();
-    }
-    
-    private static boolean isXsd(final String fileName)
-    {
-        return fileName.endsWith(".xsd");
-    }
-    
-    static Map<String, String> getSchemasFromArchive(final File archive) throws DeploymentException
-    {
-        if (archive == null)
-        {
-            return Collections.emptyMap();
-        }
-        
-        ZipInputStream zipInputStream = null;
-        try
-        {
-            zipInputStream = new ZipInputStream(new FileInputStream(archive));
-	        return JarUtil.extractStringContents(".xsd", zipInputStream);
-        }
-        catch (FileNotFoundException e)
-        {
-            throw new DeploymentException(e.getMessage(), e);
-        }
-        catch (IOException e)
-        {
-            throw new DeploymentException(e.getMessage(), e);
-        }
-        finally
-        {
-            closeStream(zipInputStream);
-        }
-    }
-    
-    private static void closeStream (InputStream in)
-    {
-        try
-        {
-            in.close();
-        }
-        catch (final IOException e)
-        {
-            log.warn(e.getMessage(), e);
-        }
-        
-    }
-
-    private class WebDeploymentClassLoader extends ClassLoader
-    	{
-           
-    		private Map<String, String> schemas;
-    
-    		WebDeploymentClassLoader(final ClassLoader parent, final Map<String, String> schemas)
-    		{
-    			super(parent);
-    			this.schemas = schemas;
-    		}
-    
-            @Override
-            public InputStream getResourceAsStream (final String name)
-            {
-                if (schemas != null)
-                {
-                    String schema = schemas.get(name);
-                    if (schema != null)
-                        return new ByteArrayInputStream(schema.getBytes());
-                }
-                
-                return super.getResourceAsStream(name);
-            }
-           
-       }
-    
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -21,33 +21,95 @@
 */
 package org.jboss.soa.esb.listeners.config;
 
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 
+import javax.management.JMException;
+import javax.management.MBeanServer;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.internal.soa.esb.listeners.war.Filter;
 import org.jboss.internal.soa.esb.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.listeners.war.WebDeploymentArchive;
+import org.jboss.internal.soa.esb.listeners.war.WebModel;
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.soa.esb.listeners.config.WebGatewayBuilder;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
+import org.jboss.soa.esb.util.DeploymentArchive;
 import org.jboss.system.ServiceMBeanSupport;
 
 /**
- * comment
+ * Represents the JBoss AS 4 ESB deployment
  *
  * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  * @version $Revision: 1.1 $
  */
 public class JBoss4ESBDeployment extends ServiceMBeanSupport implements JBoss4ESBDeploymentMBean
 {
-   private final String jbossEsbXml;
-   private String deploymentName ;
-   private List<ContractReferencePublisher> publishers ;
+   private URL document;
+   private String jbossEsbXml;
+   private String deploymentName;
+   private String shortName;
+   private List<ContractReferencePublisher> publishers;
    private List<Servlet> servlets;
    private ManagedLifecycleController controller;
    private ClassLoader classloader;
+   private ClassLoader localCl;
+   private File subDeployment;
+   private ModelAdapter model;
+   private static final String ESB_ARTIFACT_NAME = "jbossesb.esb";
+   private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=";
+   private File esbWarFiles;
+   private File esbArchive;
+   private URL url;
 
-   public JBoss4ESBDeployment(String jbossEsbXml, final String deploymentName)
+   public JBoss4ESBDeployment(URL document, final DeploymentInfo di, File esbWarFiles) throws DeploymentException
    {
-      this.jbossEsbXml = jbossEsbXml;
-      this.deploymentName = deploymentName ;
+      this.document = document;
+      this.shortName = di.shortName;
+      this.deploymentName = this.shortName;
+      this.esbWarFiles = esbWarFiles;
+      this.localCl = di.localCl;
+      this.url = di.url;
+      this.esbArchive = new File(di.watch.getFile());
+      
+      try
+      {
+         this.jbossEsbXml = JBossDeployerUtil.readEsbConfig(document.openStream());
+         //This model is used only to add the action dependecies, later the model is recreated after every destroy/create cycle.
+         this.model = JBossDeployerUtil.getJbossEsbModel(this.jbossEsbXml);
+      }
+      catch (Exception e)
+      {
+         throw new DeploymentException("Error during create of ESB Module: "
+                 + url, e);
+      }
    }
 
    public String getJbossEsbXml()
@@ -99,10 +161,27 @@
    {
        return publishers ;
    }
+   
+   public ModelAdapter getModel()
+   {
+       return model;
+   }
 
    @Override
-   public void createService()
+   public void createService() throws DeploymentException, ConfigurationException, JMException
    {
+
+      try
+      {
+         // Redo initialization as the properties could have changed
+         this.jbossEsbXml = JBossDeployerUtil.readEsbConfig(document.openStream());
+         this.model = JBossDeployerUtil.getJbossEsbModel(jbossEsbXml);
+      }
+      catch (Exception e)
+      {
+         throw new DeploymentException("Error during create of ESB Module: "
+                 + url, e);
+      }
       ClassLoader old = Thread.currentThread().getContextClassLoader();
       try
       {
@@ -113,6 +192,30 @@
       {
          Thread.currentThread().setContextClassLoader(old);
       }
+
+      WebGatewayBuilder builder = new WebGatewayBuilder(esbWarFiles, esbArchive, deploymentName, localCl, model);
+      File warDeployment = builder.build();
+      if (warDeployment != null)
+      {
+         try
+         {
+             DeploymentInfo subDi = new DeploymentInfo(warDeployment.toURL(), null, getServer());
+             log.info("Deploying '" + warDeployment.getName() + "'");
+             getMainDeployer().deploy(subDi);
+             this.setPublishers(builder.getPublishers());
+             this.setServlets(builder.getServlets());
+             this.subDeployment = warDeployment;
+         }
+         catch (Throwable throwable)
+         {
+            if(warDeployment.exists())
+            {
+                log.info("Deleting '" + warDeployment.getName() + "'");
+                warDeployment.delete();
+            }
+            throw new ConfigurationException("Error deploying '" + warDeployment.getAbsolutePath() + "'.", throwable);
+         }
+      }
    }
 
    @Override
@@ -151,6 +254,20 @@
    @Override
    public void destroyService() throws Exception
    {
+      if (subDeployment != null)
+      {
+         log.info("Undeploying '" + subDeployment.getName() + "'");
+         getMainDeployer().undeploy(subDeployment.toURL());
+         if(subDeployment.exists())
+         {
+            log.info("Deleting '" + subDeployment.getName() + "'");
+            if(!subDeployment.delete())
+            {
+               log.debug("Failed to delete sub deployment '" + subDeployment.getAbsolutePath() + "'.");
+            }
+         }
+      }
+
       ClassLoader old = Thread.currentThread().getContextClassLoader();
       try
       {
@@ -163,4 +280,11 @@
          Thread.currentThread().setContextClassLoader(old);
       }
    }
+
+   private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
+   {
+      MBeanServer server = MBeanServerLocator.locateJBoss();
+      MainDeployerMBean mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server);
+      return mainDeployer;
+   }
 }

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,273 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * 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.soa.esb.listeners.config;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.log4j.Logger;
+import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.listeners.war.Filter;
+import org.jboss.internal.soa.esb.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.listeners.war.WebDeploymentArchive;
+import org.jboss.internal.soa.esb.listeners.war.WebModel;
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.util.DeploymentArchive;
+
+/**
+ * A builder that builds EBWS/HTTP Gateway web archives
+ *
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ * @version $Revision: 1.0 $
+ */
+public class WebGatewayBuilder
+{
+    private Logger log = Logger.getLogger(WebGatewayBuilder.class);
+
+    private String deploymentName;
+    private File esbWarFiles;
+    private File esbArchive;
+    private ClassLoader localCl;
+    private List<ContractReferencePublisher> publishers;
+    private List<Servlet> servlets;
+    private ModelAdapter model;
+
+    public WebGatewayBuilder(final File esbWarFiles, final File esbArchive, final String deploymentName, final ClassLoader localCl, final ModelAdapter model)
+    {
+       this.esbWarFiles = esbWarFiles;
+       this.esbArchive = esbArchive;
+       this.deploymentName = deploymentName;
+       this.localCl = localCl;
+       this.model = model;
+    }
+
+    public void setPublishers(final List<ContractReferencePublisher> publishers)
+    {
+        this.publishers = publishers;
+    }
+    
+    public List<ContractReferencePublisher> getPublishers()
+    {
+       return publishers;
+    }
+    
+    public void setServlets(final List<Servlet> servlets)
+    {
+       this.servlets = servlets;
+    }
+    
+    public List<Servlet> getServlets()
+    {
+       return servlets;
+    }
+
+    public File build() throws ConfigurationException, DeploymentException
+    {
+        File war = null;
+        WebDeploymentArchive webDeployment = new WebDeploymentArchive(getESBWarFileName());
+        WebModel webModel = webDeployment.getWebModel();
+
+        // Set the global security domain and global security method.
+        // These setting are shared for all http-providers and EBWSs 
+        // in a jboss-esb.xml file. 
+        webModel.setAuthDomain(model.getAuthDomain());
+        webModel.setAuthMethod(model.getAuthMethod());
+
+        // Add the EBWS components...
+        createWebserviceWars(webDeployment);
+
+        // Add the web deployments info to the WebModel...
+        ModelUtil.updateWebModel(ModelUtil.getListenerGroups(model), webModel);
+
+        // Add a sub-deloyment for the web model...
+        this.servlets = webModel.getServlets();
+        if(!servlets.isEmpty()) {
+            
+            // Finalize the webDeployment...
+            webDeployment.finalizeArchive();
+
+            // Now create the web deployment...
+            war = createGatewayTempDeployment(webDeployment);
+
+        }
+        return war;
+    }
+
+    private void createWebserviceWars(WebDeploymentArchive webDeployment) throws DeploymentException
+    {
+        this.publishers = new ArrayList<ContractReferencePublisher>();
+        final List<WebserviceInfo> endpointServices =  model.getWebserviceServices();
+        if (endpointServices != null)
+        {
+            if (endpointServices.size() > 0)
+            {
+                try
+                {
+                    final JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator();
+                    
+                    for(WebserviceInfo webserviceInfo: endpointServices)
+                    {
+                        final Service service = webserviceInfo.getService();
+ 
+                        // Copy all schemas to the wsdl directory to support imports.
+                        final Map<String, String> schemasMap = JBossDeployerUtil.getSchemas(esbArchive);
+                        final String wsdlDir = "WEB-INF/wsdl/" + service.getCategory().replace('/', '_') + "/";
+                        for (Entry<String, String> schemaEntry : schemasMap.entrySet())
+                        {
+                            webDeployment.addEntry(wsdlDir + schemaEntry.getKey(), schemaEntry.getValue().getBytes());
+                            log.debug("Added schema " + wsdlDir + schemaEntry.getKey());
+                        }
+                        
+                        final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(webserviceInfo);
+                        final String wsdl = ESBContractGenerator.generateWSDL(webserviceInfo, serviceInfo, new WebDeploymentClassLoader(localCl, schemasMap));
+                        webDeployment.addEntry(serviceInfo.getWSDLFileName(), wsdl.getBytes("UTF-8"));
+ 
+                        final String handlers = JBossDeployerUtil.getHandlers(serviceInfo);
+                        final boolean includeHandlers = (handlers != null);
+                        if (includeHandlers)
+                        {
+                            final String wsHandlerName = "WEB-INF/classes/" + serviceInfo.getPackageName().replace('.', '/') + "/esb-jaxws-handlers.xml";
+                            webDeployment.addEntry(wsHandlerName, handlers.getBytes("UTF-8"));
+                        }
+                        
+                        final byte[] wsClass = generator.generate(service.getCategory(),
+                            service.getName(), serviceInfo, includeHandlers);
+                        final String wsClassName = serviceInfo.getClassName().replace('.', '/') + ".class";
+                        webDeployment.addEntry("WEB-INF/classes/" + wsClassName, wsClass);
+ 
+                        // Servlet....
+                        final Servlet servlet = new Servlet(serviceInfo.getServletName(), serviceInfo.getClassName(), webDeployment.getWebModel());
+                        servlet.getUrlMappings().add("/ebws" + serviceInfo.getServletPath());
+ 
+                        // Filter...
+                        // At the moment we only need the filter to overcome a bug in JBossWS re In-Only endpoints, so
+                        // we only include for one way services...
+                        if(serviceInfo.isOneWay()) {
+                            new Filter(serviceInfo.getServletName() + "_Filter", ESBResponseFilter.class.getName(), servlet);
+                        }
+ 
+                        final ContractReferencePublisher publisher = new ESBServiceContractReferencePublisher(service, webserviceInfo.getDescription(), serviceInfo.getServletName());
+                        publishers.add(publisher);
+                    }
+                }
+                catch (final Exception ex)
+                {
+                    throw new DeploymentException("Failed to create webservice artifact", ex);
+                }
+            }
+        }
+    }
+
+    private File createGatewayTempDeployment(DeploymentArchive deploymentArchive) throws ConfigurationException
+    {
+
+        File gatewayDeployFile = createTempDeploymentFile(esbWarFiles, deploymentArchive.getArchiveName(), true);
+        FileOutputStream fileOutStream;
+
+        try {
+            fileOutStream = new FileOutputStream(gatewayDeployFile);
+        } catch (FileNotFoundException e) {
+            throw new ConfigurationException("Unexpected exception.", e);
+        }
+
+        try {
+            deploymentArchive.toOutputStream(fileOutStream);
+        } catch (IOException e) {
+            throw new ConfigurationException("Error writing deployment archive '" + gatewayDeployFile.getAbsolutePath() + "'.", e);
+        } finally {
+            try {
+                fileOutStream.close();
+            } catch (IOException e) {
+                log.warn("Error closing deployment archive stream '" + gatewayDeployFile.getAbsolutePath() + "'", e);
+            }
+        }
+
+        return gatewayDeployFile;
+    }
+
+    private File createTempDeploymentFile(final File tempDir, final String archiveName, final boolean createDir) throws ConfigurationException
+    {
+        if (!tempDir.exists())
+        {
+            if (!createDir)
+            {
+                return null;
+            }
+            tempDir.mkdir();
+        }
+
+        File file = new File(tempDir, archiveName);
+        if(file.exists()) {
+            log.debug("Deployment archive '" + archiveName + "' already exists.  Overwriting!!");
+        }
+
+        return file;
+    }
+   
+    private String getESBWarFileName()
+    {
+        final String esbName = deploymentName;
+        final int lastSeparator = esbName.lastIndexOf('.');
+        return ((lastSeparator >= 0) ? esbName.substring(0, lastSeparator) : esbName) + ".war";
+    }
+
+    private class WebDeploymentClassLoader extends ClassLoader
+    {
+           
+       private Map<String, String> schemas;
+
+       WebDeploymentClassLoader(final ClassLoader parent, final Map<String, String> schemas)
+       {
+          super(parent);
+          this.schemas = schemas;
+       }
+
+       @Override
+       public InputStream getResourceAsStream (final String name)
+       {
+           if (schemas != null)
+           {
+               String schema = schemas.get(name);
+               if (schema != null)
+                   return new ByteArrayInputStream(schema.getBytes());
+           }
+          
+           return super.getResourceAsStream(name);
+       }
+    }
+}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbConfigParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbConfigParser.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbConfigParser.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -78,6 +78,7 @@
  * </lu>
  * 
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  */
 public class EsbConfigParser extends AbstractVFSParsingDeployer<EsbMetaData>
 {
@@ -157,9 +158,12 @@
     @Override
     protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metadata) throws Exception
     {
-        final String esbConfigXml = readEsbConfigFile(file);
+        VirtualFile configFile = findEsbConfigFile(file);
+        final String esbConfigXml = JBossDeployerUtil.readEsbConfig(configFile.openStream());
         final String archiveName = deploymentUnit.getSimpleName();
         final String deploymentName = getDeploymentName(deploymentUnit);
+
+        //This model is used only to add the action dependecies, later the model is recreated in EsbDeployment destroy/create cycle.
         final ModelAdapter model = JBossDeployerUtil.getJbossEsbModel(esbConfigXml);
         
         // Get dependencies from deployment.xml.
@@ -171,7 +175,8 @@
         // Add all dependencies to set.
         dependencies.addAll(actionDependencies);
         
-        final EsbMetaData esbMetaData = new EsbMetaData(esbConfigXml, archiveName, deploymentName, dependencies, model);
+        final EsbMetaData esbMetaData = new EsbMetaData(configFile, archiveName, deploymentName, dependencies);
+        esbMetaData.setModel(model);
         log.debug("Parsed ESB configuration'" + esbMetaData + "'");
         return esbMetaData;
     }
@@ -184,11 +189,11 @@
      * @throws DeploymentException If not configuration file could be found, or more than one was found.
      * @throws IOException 
      */
-    private String readEsbConfigFile(final VirtualFile file) throws DeploymentException, IOException
+    private VirtualFile findEsbConfigFile(final VirtualFile file) throws DeploymentException, IOException
     {
         if (file.getName().endsWith(EsbConstants.ESB_FILE_SUFFIX))
         {
-            return JBossDeployerUtil.readEsbConfig(file.openStream());
+            return file;
         }
         
         VirtualFile child = file.getChild("META-INF");
@@ -214,7 +219,7 @@
         }
         else
         {
-            return JBossDeployerUtil.readEsbConfig(esbConfigFiles.get(0).openStream());
+            return esbConfigFiles.get(0);
         }
     }
     

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -20,6 +20,7 @@
  */
 package org.jboss.soa.esb.listeners.deployers.mc;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -32,10 +33,13 @@
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
 import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * EsbDeployer takes care of the deployment of an {@link EsbDeployment}.
@@ -60,6 +64,7 @@
  * }</pre>
  * 
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  */
 public class EsbDeployer extends AbstractSimpleVFSRealDeployer<EsbMetaData>
 {
@@ -77,8 +82,16 @@
      * Default dependencies that will be added to all {@link EsbDeployment}s.
      */
     private List<String> defaultDeps = new ArrayList<String>();
+
+    private DeployerClient mainDeployer;
     
     /**
+     * The path the the directory that will be used to generate the war file
+     * for all web gateway deployments (EBWS and HTTP Gateways).
+     */
+    private String warFilesDir;
+    
+    /**
      * No args constructor.
      */
     public EsbDeployer()
@@ -90,7 +103,21 @@
         setStage(DeploymentStages.POST_CLASSLOADER);
     }
 
+    public void setMainDeployer(DeployerClient mainDeployer)
+    {
+        this.mainDeployer = mainDeployer;
+    }
+    
     /**
+     * Sets the directory that will be used for generating ESWS wars.
+     * @param dir The directory to be used.
+     */
+    public void setWarFilesDir(final String dir)
+    {
+        this.warFilesDir = dir;
+    }
+
+    /**
      * Creates an {@link BeanMetaData} instance that describes the JBossESB
      * deployment. The BeanMetaData is created using the information from the
      * EsbMetaData object, such as the contents of jboss-esb.xml, archive name etc.
@@ -134,13 +161,28 @@
     {
         log.debug(esbMetaData);
         BeanMetaDataBuilder bmdBuilder = BeanMetaDataBuilder.createBuilder(esbBeanPrefix + "." + deploymentUnit.getName(), EsbDeployment.class.getName());
-        // Setup the first constructor argument (esb config xml).
-        bmdBuilder.addConstructorParameter(String.class.getName(), esbMetaData.getEsbConfigXml());
-        // Setup the second constructor argument (esb archive name).
-        bmdBuilder.addConstructorParameter(String.class.getName(), esbMetaData.getArchiveName());
-        // Setup the third constructor argument (the name of the mbean).
+        // Setup the first constructor argument (esb meta data).
+        bmdBuilder.addConstructorParameter(EsbMetaData.class.getName(), esbMetaData);
+        // Setup the second constructor argument (the name of the mbean).
         final String mbeanName = esbBeanPrefix + ":deployment=" + deploymentUnit.getSimpleName();
         bmdBuilder.addConstructorParameter(String.class.getName(), mbeanName);
+        // Setup the third constructor argument (vfs deployment unit).
+        bmdBuilder.addConstructorParameter(VFSDeploymentUnit.class.getName(), deploymentUnit);
+        if (warFilesDir == null)
+        {
+            final String errorMsg = String.format("No property named '%s' was configured in jbossesb.sar/META-INF/jboss-service.xml for %s", "warFilesDir", getClass().getName());
+            throw new DeploymentException(errorMsg);
+        }
+        
+        final File tmpDir = new File(warFilesDir);
+        if (!tmpDir.exists())
+        {
+            final String errorMsg = String.format("The directory configured for %s='%s' does not exist.", "warFilesDir", tmpDir);
+            throw new DeploymentException(errorMsg);
+        }
+        // Setup the fourth constructor argument (temp war directory).
+        File esbWarFiles = JBossDeployerUtil.createDir(tmpDir, "esbwarfiles");
+        bmdBuilder.addConstructorParameter(File.class.getName(), esbWarFiles);
         // Add management annotation.
         bmdBuilder.addAnnotation("@org.jboss.aop.microcontainer.aspects.jmx.JMX(registerDirectly=true, exposedInterface=void.class, name=\"" + mbeanName + "\")");
 
@@ -174,6 +216,7 @@
             bmdBuilder.addPropertyMetaData("servlets", esbMetaData.getServlets());
         }
         
+        bmdBuilder.addPropertyMetaData("mainDeployer", mainDeployer);
         return bmdBuilder.getBeanMetaData();
     }
     

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -21,17 +21,60 @@
  */
 package org.jboss.soa.esb.listeners.deployers.mc;
 
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 
+import javax.management.JMException;
 import javax.management.ObjectName;
+import javax.management.MBeanServer;
 
 import org.apache.log4j.Logger;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+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.spi.structure.ContextInfo;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.listeners.war.Filter;
 import org.jboss.internal.soa.esb.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.listeners.war.WebDeploymentArchive;
+import org.jboss.internal.soa.esb.listeners.war.WebModel;
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
 import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.soa.esb.listeners.config.ModelUtil;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
+import org.jboss.soa.esb.listeners.config.WebGatewayBuilder;
+import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
+import org.jboss.soa.esb.util.DeploymentArchive;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * EsbDeployment for the Microcontainer. 
@@ -46,23 +89,40 @@
  * </lu>
  * 
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  */
 public class EsbDeployment implements EsbDeploymentMBean
 {
     private Logger log = Logger.getLogger(EsbDeployment.class);
     
-    private final String jbossEsbXml;
+    private String jbossEsbXml;
     private String deploymentName;
     private List<ContractReferencePublisher> publishers;
     private List<Servlet> servlets;
     private ManagedLifecycleController controller;
     private final String mbeanName;
+    //private File subDeployment;
+    private ClassLoader localCl;
+
+    /** The meta data */
+    private EsbMetaData esbMetaData;
+
+    private VFSDeployment deployment;
+    private DeploymentFactory factory = new DeploymentFactory();
+
+    private DeployerClient mainDeployer;
+    private File esbWarFiles;
+    private File esbArchive;
     
-    public EsbDeployment(final String config, final String deploymentName, final String mbeanName) throws Exception
+    public EsbDeployment(final EsbMetaData esbMetaData, final String mbeanName, final VFSDeploymentUnit deploymentUnit, final File esbWarFiles) throws Exception
     {
-        this.jbossEsbXml = config;
-        this.deploymentName = deploymentName;
+        this.deploymentName = esbMetaData.getArchiveName();
         this.mbeanName = mbeanName;
+        this.esbMetaData = esbMetaData;
+        this.esbWarFiles = esbWarFiles;
+        this.jbossEsbXml = JBossDeployerUtil.readEsbConfig(esbMetaData.getFile().openStream());
+        this.esbArchive = new File(deploymentUnit.getRoot().toURL().getPath());
+        this.localCl = deploymentUnit.getClassLoader();
     }
     
     public String getJbossEsbXml()
@@ -90,6 +150,11 @@
  	   return servlets;
     }
 
+    public void setMainDeployer(final DeployerClient mainDeployer)
+    {
+        this.mainDeployer = mainDeployer;
+    }
+
     public ManagedLifecycleController getController()
     {
         return controller;
@@ -110,10 +175,44 @@
         return publishers;
     }
 
-    public void create()
+    public void create() throws Exception
     {
-        LifecycleResourceManager.getSingleton().associateDeployment(deploymentName) ;
-        LifecycleResourceManager.deactivateHook() ;
+        // Redo initialization as the properties could have changed
+        this.jbossEsbXml = JBossDeployerUtil.readEsbConfig(esbMetaData.getFile().openStream());
+        esbMetaData.setModel(JBossDeployerUtil.getJbossEsbModel(jbossEsbXml));
+
+        LifecycleResourceManager.getSingleton().associateDeployment(deploymentName);
+        LifecycleResourceManager.deactivateHook();
+
+        WebGatewayBuilder builder = new WebGatewayBuilder(esbWarFiles, esbArchive, deploymentName, localCl, esbMetaData.getModel());
+        File subDeployment = builder.build();
+        if (subDeployment != null)
+        {
+            VFSDeployment vfsDeployment = null;
+            try
+            {
+                vfsDeployment = createVFSDeployment(subDeployment);
+                log.info("Deploying '" + vfsDeployment.getName() + "'");
+                mainDeployer.deploy(vfsDeployment);
+                this.setPublishers(builder.getPublishers());
+                this.setServlets(builder.getServlets());
+                this.deployment = vfsDeployment;
+            }
+            catch (Throwable throwable)
+            {
+                if (vfsDeployment != null)
+                {
+                    VirtualFile deploymentFile = vfsDeployment.getRoot();
+                    if(deploymentFile.exists())
+                    {
+                        log.info("Deleting '" + vfsDeployment.getSimpleName() + "'");
+                        deploymentFile.delete();
+                    }
+                }
+                throw new ConfigurationException("Error deploying '" + vfsDeployment.getName() + "'.", throwable);
+            }
+        }
+
     }
 
     public void start() throws Exception
@@ -145,7 +244,28 @@
     {
         log.info("Destroying '" + deploymentName + "'");
         
+        if (deployment != null)
+        {
+            log.info("Undeploying '" + deployment.getSimpleName() + "'");
+            mainDeployer.undeploy(deployment);
+            VirtualFile deploymentFile = deployment.getRoot();
+            if(deploymentFile.exists())
+            {
+                log.info("Deleting '" + deployment.getSimpleName() + "'");
+                if(!deploymentFile.delete())
+                {
+                    log.debug("Failed to delete sub deployment '" + deployment.getName() + "'.");
+                }
+            }
+        }
+
         LifecycleResourceManager.getSingleton().disassociateDeployment(deploymentName);
         LifecycleResourceManager.getSingleton().destroyResources();
     }
+    
+    private VFSDeployment createVFSDeployment(File war) throws IOException
+    {
+        VirtualFile webAppVFS = VFS.getRoot(war.toURL());
+        return VFSDeploymentFactory.getInstance().createVFSDeployment(webAppVFS);
+    }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -32,12 +32,14 @@
 import org.jboss.internal.soa.esb.listeners.war.Servlet;
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
 import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * Metadata for an ESB deployment.
  * <p/>
  *
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
  */
 public class EsbMetaData implements Serializable
 {
@@ -47,8 +49,11 @@
     /** The name of the .esb archive. */
     private String archiveName;
 
-    /** The ESB configuration xml. */
-    private final String esbConfigXml;
+    /** The adapter for querying the model */
+    private ModelAdapter model;
+
+    /** The virtual file. */
+    private final VirtualFile file;
     
     /** The deployments dependencies */
     private final Set<ObjectName> dependencies ;
@@ -56,9 +61,6 @@
     /** The deployment name. The .esb archive name without the .esb suffix */
     private final String deploymentName;
     
-    /** The adapter for querying the model */
-    private ModelAdapter model;
-    
     /** The publishers for this deployment */
     private List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>();
     
@@ -68,22 +70,20 @@
     /**
      * Sole constructor.
      *
-     * @param esbConfigXml      The xml configuration for the ESB.
+     * @param file              The virtual file. Can point to a file or a directory which will be searched..
      * @param archiveName       The name of the .esb archive from which this deployment comes from.
      * @param dependencies      Dependencies of this deployment. This might be object names or simply bean names.
-     * @param model             The ModelAdapter for the deployment.
      */
-    public EsbMetaData(final String esbConfigXml, final String archiveName, final String deploymentName, final Set<ObjectName> dependencies, final ModelAdapter model)
+    public EsbMetaData(final VirtualFile file, final String archiveName, final String deploymentName, final Set<ObjectName> dependencies)
     {
-        AssertArgument.isNotNullAndNotEmpty(esbConfigXml, "esbConfigXml");
+        AssertArgument.isNotNull(file, "file");
         AssertArgument.isNotNullAndNotEmpty(archiveName, "archiveName");
         AssertArgument.isNotNullAndNotEmpty(deploymentName, "deploymentName");
         
-        this.esbConfigXml = esbConfigXml;
+        this.file = file;
         this.archiveName = archiveName;
         this.deploymentName = deploymentName;
         this.dependencies = dependencies;
-        this.model = model;
     }
 
     /**
@@ -97,13 +97,12 @@
     }
 
     /**
-     * Gets the esb xml configuration. This is the actual xml
-     * and not a file path or anything else.
+     * Gets the The virtual file. This is a file path
      * @return String The esb xml configuration.
      */
-    public String getEsbConfigXml()
+    public VirtualFile getFile()
     {
-        return esbConfigXml;
+        return file;
     }
     
     /**
@@ -137,6 +136,16 @@
     }
     
     /**
+     * Set the model adapter for the configuration.
+     * 
+     * @param model The model adapter for the configuration.
+     */
+    public void setModel(ModelAdapter model)
+    { 
+        this.model = model;
+    }
+    
+    /**
      * Sets the publishers for this deployment.
      * 
      * @param publishers The publishers for this deployment.

Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -1,455 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * 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.soa.esb.listeners.deployers.mc;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.internal.soa.esb.listeners.war.Filter;
-import org.jboss.internal.soa.esb.listeners.war.SecurityConstraints;
-import org.jboss.internal.soa.esb.listeners.war.Servlet;
-import org.jboss.internal.soa.esb.listeners.war.WebModel;
-import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
-import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
-import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
-import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
-import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
-import org.jboss.internal.soa.esb.webservice.WebServicePublishException;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-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.FilterMappingMetaData;
-import org.jboss.metadata.web.spec.FilterMetaData;
-import org.jboss.metadata.web.spec.FiltersMetaData;
-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.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.Service;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.listeners.config.ModelUtil;
-import org.jboss.soa.esb.listeners.config.WebserviceInfo;
-import org.jboss.soa.esb.listeners.deployers.mc.util.VfsUtil;
-import org.jboss.virtual.MemoryFileFactory;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * EsbWebServiceDeployer is responsible for deploying the web service that will
- * expose the underlying ESB service as a web service.
- * <p/>
- * 
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EsbWebServiceDeployer extends AbstractSimpleVFSRealDeployer<EsbMetaData>
-{
-    /** Logger */
-    private Logger log = Logger.getLogger(EsbWebServiceDeployer.class);
-    
-    /**
-     * Key used for attaching a VirtualFile representing a ref to 
-     * a dynamically created root virtual file system.
-     */
-    static final String DYNAMIC_CL_DIR_KEY = "WS-DYNAMIC-CL-DIR";
-    
-    /**
-     * Key used for attaching a URL representing a ref to 
-     * a dynamically created root virtual file system.
-     */
-    static final String DYNAMIC_CL_URL_KEY = "WS-DYNAMIC-CL-URL";
-    
-    /**
-     * Key used for attaching a VirtualFile representing a ref to 
-     * a dynamically created WEB-INF/classes virtual file system.
-     */
-    static final String DYNAMIC_WEBINF_CL_DIR_KEY = "WS-WEBINF-DYNAMIC-CL-DIR";
-    
-    /**
-     * Key used for attaching a URL representing a ref to 
-     * a dynamically created WEB-INF/classes virtual file system.
-     */
-    static final String DYNAMIC_WEBINF_CL_URL_KEY = "WS-WEBINF-DYNAMIC-CL-URL";
-    
-    /**
-     * Sole constructor that performas the following steps:
-     * <lu>
-     *  <li>Sets the output of this deployer to be {@link EsbMetaData}.</li>
-     *  <li>Sets this deployers deployment stage to {@link DeploymentStages#POST_PARSE}./li>
-     *  <li>Specifies that this deployer produces JBossWebMetaData and EsbMetaData./li>
-     * </lu>
-     */
-    public EsbWebServiceDeployer()
-    {
-        super(EsbMetaData.class);
-        // Set the deployment stage to after parse.
-        setStage(DeploymentStages.POST_PARSE);
-        // Tell the MicroContainer that we are producing JBossWebMetaData.
-        setOutput(JBossWebMetaData.class);
-        // Tell the MicroContainer that we are producing EsbMetaData.
-        setOutput(EsbMetaData.class);
-    }
-    
-    @Override
-    public void deploy(final VFSDeploymentUnit unit, final EsbMetaData esbMetaData) throws DeploymentException
-    {
-        boolean webMetaDataCreated = false;
-        final JBossWebMetaData webMetaData = new JBossWebMetaData();
-        final JBossServletsMetaData servlets = new JBossServletsMetaData();
-        final List<ServletMappingMetaData> servletMappings = new ArrayList<ServletMappingMetaData>();
-        final FiltersMetaData filters = new FiltersMetaData();
-        final List<FilterMappingMetaData> filterMappings = new ArrayList<FilterMappingMetaData>();
-        final List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>() ;
-        final List<SecurityConstraintMetaData> securityConstraintsMDs = new ArrayList<SecurityConstraintMetaData>();
-        final WebserviceDescriptionsMetaData descriptions = new WebserviceDescriptionsMetaData();
-
-        final List<WebserviceInfo> webServices = esbMetaData.getModel().getWebserviceServices();
-        if (hasWebServices(webServices))
-        {
-            webMetaDataCreated = true;
-            log.debug("Deploying webservices for : " + esbMetaData.getDeploymentName());            
-
-            try
-            {
-                // Create an in-memory file system.
-                final URL inMemRootUrl = VfsUtil.createInMemUrl(esbMetaData.getDeploymentName());
-                final VirtualFile inMemRootDir = VfsUtil.createInMemoryFs(inMemRootUrl);
-                
-                // Attach the in-memory classpath URL and virtual file to this deployment unit so we can remove then upon undeploy.
-                //attachToDeploymentUnit(unit, inMemRootUrl, inMemRootDir);
-                unit.addAttachment(DYNAMIC_CL_DIR_KEY, inMemRootDir);
-                unit.addAttachment(DYNAMIC_CL_URL_KEY, inMemRootUrl);
-                
-                // Add the in-memory classpath to this deployment unit.
-                unit.addClassPath(inMemRootDir);
-                
-                // Create WEB-INF/classes relative to the in-memory vfs root.
-                final URL classesUrl = VfsUtil.createInMemUrl(inMemRootUrl, "WEB-INF/classes");
-                final VirtualFile classesDir = MemoryFileFactory.createDirectory(classesUrl);
-                unit.addAttachment(DYNAMIC_WEBINF_CL_DIR_KEY, classesDir);
-                unit.addAttachment(DYNAMIC_WEBINF_CL_URL_KEY, classesUrl);
-                
-                // Add the in-memory classes dir to this deployment unit.
-                unit.addClassPath(classesDir);
-                    
-                final JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator();
-                for (WebserviceInfo wsInfo : webServices)
-                {
-                    final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(wsInfo);
-                    final String handlers = JBossDeployerUtil.getHandlers(serviceInfo);
-                    final boolean includeHandlers = handlers != null;
-                    if (includeHandlers)
-                    {
-                        unit.appendMetaDataLocation(classesDir);
-                        final String wsHandlerName = serviceInfo.getPackageName().replace('.', '/') + "/esb-jaxws-handlers.xml";
-                        VfsUtil.addFile(classesUrl, wsHandlerName, handlers.getBytes());
-                    }
-                        
-                    if (serviceInfo.isOneWay())
-                    {
-                        FilterMetaData filter = createFilter(serviceInfo);
-                        filters.add(filter);
-                        filterMappings.add(createFilterMapping(serviceInfo, filter));
-                    }
-                    
-                    final Service service = wsInfo.getService();
-                        
-                    // Generate the servlet class bytes
-                    final byte[] servletClass = generator.generate(service.getCategory(), service.getName(), serviceInfo, includeHandlers);
-                    final String servletClassName = serviceInfo.getClassName().replace('.', '/') + ".class";
-                    final URL servletClassUrl = VfsUtil.createInMemUrl(classesUrl, servletClassName);
-                    
-                    // Add the servlet to the virtual file system.
-                    VfsUtil.addFile(classesUrl, servletClassName, servletClass);
-                    log.debug("Generated ServletImpl '" + servletClassUrl + "'");
-                        
-                    servlets.add(createServlets(serviceInfo, generator, includeHandlers));
-                    servletMappings.add(createServletMapping(serviceInfo));
-                    
-                    final WebserviceDescriptionMetaData description = new WebserviceDescriptionMetaData();
-                    description.setName(esbMetaData.getDeploymentName());
-                    description.setWebserviceDescriptionName(esbMetaData.getDeploymentName());
-                    description.setWsdlPublishLocation(serviceInfo.getWSDLFileName());
-                    descriptions.add(description);
-                    
-                    final ContractReferencePublisher publisher = new ESBServiceContractReferencePublisher(service, wsInfo.getDescription(), serviceInfo.getServletName());
-                    publishers.add(publisher);
-                }
-            }
-            catch (final Exception e)
-            {
-                throw new DeploymentException("Failed to create webservice artifact", e);
-            }
-        }
-
-        WebModel webModel = new WebModel(esbMetaData.getArchiveName());
-        
-        try {
-	        // Set the global security domain and global security method.
-	        // These setting are shared for all http-providers and EBWSs 
-	        // in a jboss-esb.xml file. 
-	        webModel.setAuthDomain(esbMetaData.getModel().getAuthDomain());
-	        webModel.setAuthMethod(esbMetaData.getModel().getAuthMethod());
-	        
-            ModelUtil.updateWebModel(ModelUtil.getListenerGroups(esbMetaData.getModel()), webModel);
-        } catch (ConfigurationException e) {
-            throw new DeploymentException("Failed to capture web metadata from ESB configuration.", e);
-        }
-        
-        // Add the filters...
-        for(Filter filter : webModel.getFilters()) {
-            webMetaDataCreated = true;
-            filters.add(createFilter(filter));
-            filterMappings.add(createFilterMapping(filter));
-        }
-
-        // Add the Servlets...
-        for(Servlet servlet : webModel.getServlets()) {
-            webMetaDataCreated = true;
-            servlets.add(createServlet(servlet));
-            servletMappings.add(createServletMapping(servlet));
-
-            SecurityConstraints securityConstraints = servlet.getSecurityConstraints();
-            if(securityConstraints != null) {
-                SecurityConstraintMetaData securityConstraintMD = new SecurityConstraintMetaData();
-
-                securityConstraintsMDs.add(securityConstraintMD);
-                securityConstraintMD.setDisplayName("Constraints for servlet '" + servlet.getName() + "'.");
-
-                // Add the resource details...
-                WebResourceCollectionsMetaData resources = new WebResourceCollectionsMetaData();
-                WebResourceCollectionMetaData resource = new WebResourceCollectionMetaData();
-                resources.add(resource);
-                securityConstraintMD.setResourceCollections(resources);
-                resource.setHttpMethods(new ArrayList(securityConstraints.getProtectedMethods()));
-                resource.setUrlPatterns(servlet.getUrlMappings());
-
-                // Add the Auth Constraint...
-                if(!securityConstraints.getAllowedRoles().isEmpty()) {
-                    AuthConstraintMetaData constraint = new AuthConstraintMetaData();
-                    constraint.setRoleNames(new ArrayList(securityConstraints.getAllowedRoles()));
-                    securityConstraintMD.setAuthConstraint(constraint);
-                }
-
-                // Add the User Constraint...
-                if(securityConstraints.getTransportGuarantee() != null) {
-                    UserDataConstraintMetaData constraint = new UserDataConstraintMetaData();
-                    constraint.setTransportGuarantee(TransportGuaranteeType.valueOf(securityConstraints.getTransportGuarantee()));
-                    securityConstraintMD.setUserDataConstraint(constraint);
-                }
-            }
-        }
-        esbMetaData.setServlets(webModel.getServlets());
-
-        if(webModel.getAuthMethod() != null) {
-            LoginConfigMetaData loginConfig = new LoginConfigMetaData();
-            loginConfig.setAuthMethod(webModel.getAuthMethod());
-            loginConfig.setRealmName("Authentication Realm for '" + esbMetaData.getArchiveName() + "'");
-            webMetaData.setLoginConfig(loginConfig);
-        }
-        if(webModel.getAuthDomain() != null) {
-            webMetaData.setSecurityDomain(webModel.getAuthDomain());
-        }
-        if(!webModel.getSecurityRoles().isEmpty()) {
-            SecurityRolesMetaData secRolesMetaData = new SecurityRolesMetaData();
-            webMetaData.setSecurityRoles(secRolesMetaData);
-            for(String role : webModel.getSecurityRoles()) {
-                SecurityRoleMetaData secRoleMetaData = new SecurityRoleMetaData();
-                secRoleMetaData.setRoleName(role);
-                secRolesMetaData.add(secRoleMetaData);
-            }
-        }
-
-        if(webMetaDataCreated) {
-            webMetaData.setContextRoot(esbMetaData.getDeploymentName());
-            webMetaData.setServlets(servlets);
-            webMetaData.setServletMappings(servletMappings);
-            webMetaData.setFilters(filters);
-            webMetaData.setFilterMappings(filterMappings);
-            webMetaData.setWebserviceDescriptions(descriptions);
-            webMetaData.setSecurityContraints(securityConstraintsMDs);
-
-            esbMetaData.setPublishers(publishers);
-
-            unit.addAttachment(JBossWebMetaData.class, webMetaData);
-        }
-    }
-
-    @Override
-    public void undeploy(final VFSDeploymentUnit unit, final EsbMetaData esbMetaData)
-    {
-        try
-        {
-            removeVirtualFile(unit, DYNAMIC_CL_DIR_KEY);
-            removeVirtualFile(unit, DYNAMIC_WEBINF_CL_DIR_KEY);
-        }
-        finally
-        {
-            try
-            {
-                removeFromClassPath(unit, DYNAMIC_WEBINF_CL_URL_KEY);
-                removeFromClassPath(unit, DYNAMIC_CL_URL_KEY);
-            }
-            catch (final Exception e)
-            {
-                log.warn("Error deleting dynamic class root for " + unit.getName(), e);
-            }
-        }
-    }
-
-    private void removeVirtualFile(final VFSDeploymentUnit unit, final String attachmenKey)
-    {
-        final VirtualFile file = unit.removeAttachment(attachmenKey, VirtualFile.class);
-        if (file != null)
-        {
-            unit.removeClassPath(file);
-        }
-    }
-
-    private void removeFromClassPath(final VFSDeploymentUnit unit, final String attachmentKey)
-    {
-        final URL url = unit.removeAttachment(attachmentKey, URL.class);
-        if (url != null)
-        {
-            MemoryFileFactory.delete(url);
-        }
-    }
-
-    private boolean hasWebServices(final List<WebserviceInfo> endpointServices)
-    {
-        return endpointServices != null && endpointServices.size() > 0;
-    }
-
-    private ServletMappingMetaData createServletMapping(final ESBServiceEndpointInfo serviceInfo)
-    {
-        final ServletMappingMetaData mapping = new ServletMappingMetaData();
-        mapping.setServletName(serviceInfo.getServletName());
-        mapping.setUrlPatterns(Arrays.asList(new String[] { "/ebws" + serviceInfo.getServletPath()}));
-        return mapping;
-    }
-
-    private JBossServletMetaData createServlets(final ESBServiceEndpointInfo serviceInfo, final JAXWSProviderClassGenerator generator, final boolean includeHandlers) throws WebServicePublishException
-    {
-        final JBossServletMetaData servlet = new JBossServletMetaData();
-        servlet.setServletName(serviceInfo.getServletName());
-        servlet.setServletClass(serviceInfo.getClassName());
-        servlet.setLoadOnStartup(1);
-        return servlet;
-    }
-
-    private FilterMetaData createFilter(final ESBServiceEndpointInfo serviceInfo)
-    {
-        // Filter
-        final FilterMetaData filter = new FilterMetaData();
-        filter.setFilterName(serviceInfo.getServletName() + "_Filter");
-        filter.setFilterClass(ESBResponseFilter.class.getName());
-
-        // Set up the initparam 'OneWay'
-        final ParamValueMetaData oneWayInitParam = new ParamValueMetaData();
-        oneWayInitParam.setParamName("OneWay");
-        oneWayInitParam.setParamValue("true");
-        filter.setInitParam(Arrays.asList(new ParamValueMetaData[] {oneWayInitParam}));
-        return filter;
-    }
-
-    private FilterMappingMetaData createFilterMapping(ESBServiceEndpointInfo serviceInfo, FilterMetaData filter) {
-        FilterMappingMetaData mapping = new FilterMappingMetaData();
-        mapping.setFilterName(filter.getFilterName());
-        mapping.setServletNames(Arrays.asList(new String[] {serviceInfo.getServletName()}));
-        return mapping;
-    }
-
-    private JBossServletMetaData createServlet(Servlet servlet) {
-        JBossServletMetaData servletMD = new JBossServletMetaData();
-
-        servletMD.setServletName(servlet.getName());
-        servletMD.setServletClass(servlet.getRuntimeClass());
-        servletMD.setLoadOnStartup(1);
-
-        List<ParamValueMetaData> initParamsMetaData = createParamsMetaData(servlet.getParams());
-        if(initParamsMetaData != null) {
-            servletMD.setInitParam(initParamsMetaData);
-        }
-
-        return servletMD;
-    }
-
-    private ServletMappingMetaData createServletMapping(Servlet servlet) {
-        final ServletMappingMetaData mapping = new ServletMappingMetaData();
-        mapping.setServletName(servlet.getName());
-        mapping.setUrlPatterns(servlet.getUrlMappings());
-        return mapping;
-    }
-
-    private FilterMetaData createFilter(final Filter filter)
-    {
-        FilterMetaData filterMetaData = new FilterMetaData();
-
-        filterMetaData.setFilterName(filter.getName());
-        filterMetaData.setFilterClass(filter.getRuntimeClass());
-
-        List<ParamValueMetaData> initParamsMetaData = createParamsMetaData(filter.getParams());
-        if(initParamsMetaData != null) {
-            filterMetaData.setInitParam(initParamsMetaData);
-        }
-
-        return filterMetaData;
-    }
-
-    private List<ParamValueMetaData> createParamsMetaData(List<KeyValuePair> initParams) {
-        List<ParamValueMetaData> initParamsMetaData = null;
-        if(!initParams.isEmpty()) {
-            initParamsMetaData = new ArrayList<ParamValueMetaData>();
-            for(KeyValuePair initParam : initParams) {
-                ParamValueMetaData initParamMetaData = new ParamValueMetaData();
-
-                initParamMetaData.setParamName(initParam.getKey());
-                initParamMetaData.setParamValue(initParam.getValue());
-                initParamsMetaData.add(initParamMetaData);
-            }
-        }
-        return initParamsMetaData;
-    }
-
-    private FilterMappingMetaData createFilterMapping(Filter filter) {
-        FilterMappingMetaData mapping = new FilterMappingMetaData();
-        mapping.setFilterName(filter.getName());
-        mapping.setServletNames(Arrays.asList(new String[] {filter.getTargetServlet().getName()}));
-        return mapping;
-    }
-}

Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployer.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployer.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -1,300 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * 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.soa.esb.listeners.deployers.mc;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
-import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
-import org.jboss.soa.esb.listeners.config.WebserviceInfo;
-import org.jboss.soa.esb.listeners.deployers.mc.util.VfsUtil;
-import org.jboss.virtual.MemoryFileFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * MC deployer that generates a wsdl and then adds this wsdl to 
- * a virtual memory file system.
- * <p/>
- * This deployer accepts an EsbMetaData instance and looks for the existence of any WebService (WS) 
- * information. If WS information is found a wsdl will be generated and it will be added
- * to the deployment unit as a metadata location. The wsdl file is added as a VirtualFile 
- * to an in-memory virtual file system.
- * <p/>
- * 
- * This deployer is set at the POST_CLASSLOADER deployment stage as it requries
- * access to classloaders for generating the wsdl.
- * 
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class EsbWsdlDeployer extends AbstractSimpleVFSRealDeployer<EsbMetaData>
-{
-    public static final String WSDL_DIR = "WEB-INF/wsdl/";
-
-    private Logger log = Logger.getLogger(EsbWsdlDeployer.class);
-    
-    /**
-     * Key used for attaching a list of VirtualFile representing generated wsdl files.
-     */
-    static final String WSDL_LOCATIONS_KEY = "WSDL-LOCATIONS-KEY";
-    
-    /**
-     * Key used for attaching a URL representing a ref to 
-     * a dynamically created in-memory virtual file system.
-     */
-    static final String DYNAMIC_ROOT_URL_KEY = "WSDL-DYNAMIC-ROOT-URL";
-    
-    /**
-     * Key used for attaching a URL representing a ref to 
-     * a dynamically created in-memory virtual file system.
-     */
-    static final String DYNAMIC_ROOT_DIR_KEY = "WSDL-DYNAMIC-ROOT-DIR";
-    
-    /**
-     * {@link VirtualFileFilter} that selects '.xsd'.
-     */
-    private static final VirtualFileFilter schemaFileFilter = new SchemaFileFilter();
-    
-    /**
-     * No-args constructor.
-     */
-    public EsbWsdlDeployer()
-    {
-        super(EsbMetaData.class);
-        // Need access to classloaders.
-        setStage(DeploymentStages.POST_CLASSLOADER);
-    }
-    
-    /**
-     * Generates a wsdl for all web services specified in the {@link EsbMetaData}s model and makes it available
-     * as deployment unit metadata.
-     * <p/>
-     * Deploy will inspect the {@link EsbMetaData} and see if its model contains web services information and 
-     * if so generates the wsdl for them, and will add any additional schemas in the deployment unit to an in-memory
-     * virtual file system.
-     * <p/>
-     * 
-     * @param unit The {@link VFSDeploymentUnit} for this deploment.
-     * @param esbMetaData The {@link EsbMetaData} for this deployment.
-     */
-    @Override
-    public void deploy(final VFSDeploymentUnit unit, final EsbMetaData esbMetaData) throws DeploymentException
-    {
-        final List<WebserviceInfo> webServices = esbMetaData.getModel().getWebserviceServices();
-        if (webServices != null && webServices.size() > 0)
-        {
-            try
-            {
-                final String inMemRootName = esbMetaData.getDeploymentName() + "_WSDL";
-                final URL inMemRootUrl = VfsUtil.createInMemUrl(inMemRootName);
-                final VirtualFile inMemRootDir = VfsUtil.createInMemoryFs(inMemRootUrl);
-                // Attach the in-memory root url so we can remove it in undeploy.
-                unit.addAttachment(DYNAMIC_ROOT_URL_KEY, inMemRootUrl);
-                // Attach the in-memory root dir so we can remove it in undeploy.
-                unit.addAttachment(DYNAMIC_ROOT_DIR_KEY, inMemRootDir);
-                
-                final List<URL> wsdls = new ArrayList<URL>();
-                
-                if (webServices.size() > 0)
-                {
-                    for (WebserviceInfo wsInfo : webServices)
-                    {
-                        final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(wsInfo);
-                        
-                        // Generate the wsdl for the web service.
-                        final URL wsdlUrl = VfsUtil.createInMemUrl(inMemRootUrl, serviceInfo.getWSDLFileName());
-                        VirtualFile wsdlFile = VfsUtil.addFile(inMemRootUrl, serviceInfo.getWSDLFileName(), "".getBytes());
-                        
-                        // Add any schemas in the deployment unit to the in-memory vfs.
-                        List<VirtualFile> schemas = getSchemas(unit.getRoot());
-                        addSchemasToVfs(schemas, wsdlFile.getParent(), esbMetaData.getArchiveName());
-                        
-                        final String wsdl = ESBContractGenerator.generateWSDL(wsInfo, serviceInfo, unit.getClassLoader());
-                        log.info("Generating wsdl url : " + wsdlUrl);
-                        
-                        // Add the wsdl in the virtual file system
-                        VfsUtil.addFile(inMemRootUrl, serviceInfo.getWSDLFileName(), wsdl.getBytes());
-                        wsdls.add(wsdlUrl);
-                    }
-                    
-                    // Add the root of the virtual file system as a meta data location.
-                    unit.appendMetaDataLocation(inMemRootDir);
-                }
-                
-                // Attach all the wsdl locations so that we can remove them in undeploy.
-                unit.addAttachment(WSDL_LOCATIONS_KEY, wsdls);
-            }
-            catch (final Exception e)
-            {
-                throw new DeploymentException("Failed to create webservice artifact", e);
-            }
-        }
-    }
-    
-    /**
-     * Retrieves all the schemas (.xsd) from the virtual file root passed in.
-     * 
-     * @param root The virtual file that should be searched recursively for schemas.
-     * @return List<VirtualFile> List of virtual files that are schemas.
-     * @throws IOException If an exception in the search occurs.
-     */
-    List<VirtualFile> getSchemas(final VirtualFile root) throws IOException
-    {
-        return root.getChildrenRecursively(schemaFileFilter);
-    }
-    
-    /**
-     * Will add all the schemas to the virtual file system specified by toVfs.
-     * <p/>
-     * For example, the following vfs file:
-     * "Quickstart_publish_as_webservice.esb/request.xsd"
-     * will be added to the virtual toVfs with the following url:
-     * "vfsmemory://Quickstart_publish_as_webservice_WSDL/WEB-INF/wsdl/ESBServiceSample/request.xsd"
-     * <p/>
-     * 
-     * @param schemas The schemas to add.
-     * @param toVfs The destination vfs to which the schemas should be added.
-     * @param archiveName Is the name of this archive deployment. 
-     *          
-     * @throws MalformedURLException
-     * @throws IOException
-     * @throws URISyntaxException
-     */
-    void addSchemasToVfs(final List<VirtualFile> schemas, VirtualFile toVfs, String archiveName) throws MalformedURLException, IOException, URISyntaxException
-    {
-        Map<VirtualFile, String> schemaJars = getSchmeaJarPaths(schemas, toVfs);
-        if (schemaJars.size() > 0)
-        {
-			log.info("Adding schemas from jars: " + schemaJars.values());
-            VfsUtil.addFiles(schemaJars, toVfs.toURL(), WSDL_DIR + toVfs.getName());
-            // The schemas in jars will have a path containing the '.jar' suffix in it.
-            // The above addFiles method will remove the 'suffix' and we don't want the
-            // incorrect paths to be added. 
-			schemas.removeAll(schemaJars.keySet());
-        }
-        
-        log.info("Adding schemas: " + schemas);
-        VfsUtil.addFiles(schemas, toVfs.toURL(), archiveName, WSDL_DIR + toVfs.getName());
-    }
-    
-    /**
-     * Undeploy will inspect the deployment unit to see if the deploy method attached a
-     * {@link VirtualFile} representing an in-memory file system. If one exists it will
-     * be removed.
-     * <p/>
-     * 
-     * @param unit The {@link VFSDeploymentUnit} for this deploment.
-     * @param esbMetaData The {@link EsbMetaData} for this deployment.
-     */
-    @Override
-    public void undeploy(final VFSDeploymentUnit unit, final EsbMetaData esbMetaData) 
-    {
-        try
-        {
-            final List<URL> locations = unit.removeAttachment(WSDL_LOCATIONS_KEY, List.class);
-            if (locations != null)
-            {
-                for (URL url : locations)
-                {
-                    MemoryFileFactory.delete(url);
-                }
-            }
-        }
-        finally
-        {
-            try
-            {
-                final URL rootUrl = unit.removeAttachment(DYNAMIC_ROOT_URL_KEY, URL.class);
-                if (rootUrl != null)
-                {
-                    MemoryFileFactory.deleteRoot(rootUrl);
-                    // Also need remove the root from the metadata locations.
-                    unit.removeMetaDataLocation(VFS.getVFS(rootUrl).getRoot());
-                }
-                
-            }
-            catch (final Exception e)
-            {
-                log.warn("Error deleting dynamic class root for " + unit.getName(), e);
-            }
-        }
-    }
-    
-    /**
-     * A {@link VirtualFileFilter} that selects all files ending with '.xsd'.
-     * 
-     * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
-     *
-     */
-    private static class SchemaFileFilter implements VirtualFileFilter
-    {
-        public boolean accepts(final VirtualFile file)
-        {
-            return file.getName().endsWith(".xsd");
-        }
-    }
-
-    /**
-     * Returns a map of the original {@link VirtualFile} to the schemas and a new path
-     * to the schema. 
-     * </p>
-     * The Microcontainer is able to recursively find all files in nested archives, for 
-     * example all '.xsd' files. If the schema in question is in a nested jar then the 
-     * name of the jar will be included in the VFS path name. This is not desired in our
-     * case and this method will remove the jar name from the path.
-     * 
-     * @param schemas The schema from which jar paths should be extracted.
-     * 
-     * @return Map containing the orginal paths as keys and a pruned paths as 
-     * its value.
-     * 
-     * @throws IOException 
-     * @throws URISyntaxException 
-     */
-    public Map<VirtualFile, String> getSchmeaJarPaths (final List<VirtualFile> schemas, final VirtualFile toVfs) throws IOException, URISyntaxException
-    {
-        final Map<VirtualFile, String> schemaJarPaths = new HashMap<VirtualFile, String>();
-        for (VirtualFile virtualFile : schemas)
-        {
-            final String pathName = virtualFile.getPathName();
-            final int indexOf = pathName.indexOf(".jar");
-            if (indexOf != -1)
-            {
-                schemaJarPaths.put(virtualFile, pathName.substring(indexOf+4));
-            }
-        }
-        return schemaJarPaths;
-    }
-
-}

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployerUnitTest.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployerUnitTest.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -29,6 +29,7 @@
 import junit.framework.JUnit4TestAdapter;
 
 import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
 import org.junit.Test;
 
 /**
@@ -42,7 +43,7 @@
     public void getSchemasFromFileShouldReturnEmptyMap() throws DeploymentException
     {
         File file = new File(getClass().getResource("schemasDir/mock.xsd").getFile());
-        Map<String, String> schemas = JBoss4ESBDeployer.getSchemasFromDirectory(file);
+        Map<String, String> schemas = JBossDeployerUtil.getSchemasFromDirectory(file);
         assertTrue(schemas.isEmpty());
     }
     
@@ -50,7 +51,7 @@
     public void getSchemasFromDirectory() throws DeploymentException
     {
         File directory = new File(getClass().getResource("schemasDir").getFile());
-        Map<String, String> schemas = JBoss4ESBDeployer.getSchemasFromDirectory(directory);
+        Map<String, String> schemas = JBossDeployerUtil.getSchemasFromDirectory(directory);
         assertAddedSchemas(schemas);
     }
     
@@ -59,7 +60,7 @@
     {
         URL resource = getClass().getResource("schemasDir.esb");
         File archive = new File(resource.getFile());
-        Map<String, String> schemas = JBoss4ESBDeployer.getSchemasFromArchive(archive);
+        Map<String, String> schemas = JBossDeployerUtil.getSchemasFromArchive(archive);
         assertAddedSchemas(schemas);
     }
     
@@ -68,14 +69,14 @@
     {
         final URL resource = getClass().getResource("schemasExploded.esb");
         final File jbossEsbXml = new File(resource.getFile() + File.separator + "META-INF" + File.separator + "jboss-esb.xml" );
-        final Map<String, String> schemas = JBoss4ESBDeployer.getSchemas(jbossEsbXml);
+        final Map<String, String> schemas = JBossDeployerUtil.getSchemas(jbossEsbXml);
         assertAddedSchemas(schemas);
     }
     
     @Test
     public void getSchemasFromArchiveNullArchive() throws DeploymentException
     {
-        Map<String, String> schemas = JBoss4ESBDeployer.getSchemasFromArchive(null);
+        Map<String, String> schemas = JBossDeployerUtil.getSchemasFromArchive(null);
         assertTrue(schemas.isEmpty());
     }
     

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilderUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilderUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilderUnitTest.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
+
+/**
+ * Unit test for WebGatewayBuilder. 
+ * 
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+public class WebGatewayBuilderUnitTest extends TestCase {
+
+    public void test() throws ConfigurationException, DeploymentException {
+        String jbossEsbXml = JBossDeployerUtil.readEsbConfig(getClass().getResourceAsStream("jbossesb_config_webgateway.xml"));
+        ModelAdapter model = JBossDeployerUtil.getJbossEsbModel(jbossEsbXml);
+        String deploymentName = "webgateway";
+        File esbWarFiles = new File(System.getProperty("java.io.tmpdir"));
+        File esbArchive = new File(getClass().getResource("webgateway.esb").getFile());
+        ClassLoader localCl = Thread.currentThread().getContextClassLoader();
+
+        WebGatewayBuilder builder = new WebGatewayBuilder(esbWarFiles, esbArchive, deploymentName, localCl, model);
+
+        File war = builder.build();
+        assertTrue(war.exists());
+        assertEquals("webgateway.war", war.getName());
+        war.delete();
+    }
+}

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_webgateway.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_webgateway.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_webgateway.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,35 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_publish_as_webservice_Request_esb"
+                      selector="serviceName='HelloWorldPubService'"
+                  />
+              </jms-bus>
+
+          </jms-provider>
+      </providers>
+      
+      <services>
+        <service 
+        	category="ESBServiceSample" 
+        	name="HelloWorldPubService" 
+        	description="Hello world ESB Service">
+			<security moduleName="JBossWS"/>
+            <listeners>
+                <jms-listener name="helloWorld"
+                              busidref="quickstartEsbChannel"
+                              maxThreads="1"
+                />
+            </listeners>
+            <actions  inXsd="/request.xsd" outXsd="/response.xsd" faultXsd="/fault.xsd" validate="true">
+                   <action name="action" class="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.ESBWSListenerAction" process="displayMessage"/>  
+            </actions>
+        </service>
+      </services>
+     
+</jbossesb>

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/webgateway.esb
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/webgateway.esb
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployerUnitTest.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -51,6 +51,7 @@
         EsbMetaData esbMetaData = TestUtil.getEsbMetaData(new EsbConfigParser(), dir, archiveName);
         VFSDeploymentUnit deploymentUnit = TestUtil.getDeploymentUnit(dir, archiveName);
         
+        esbDeployer.setWarFilesDir(System.getProperty("java.io.tmpdir"));
         esbDeployer.deploy(deploymentUnit, esbMetaData);
         Object attachment = deploymentUnit.getAttachment(BeanMetaData.class.getName() + "_ESB");
         assertTrue(attachment instanceof BeanMetaData);

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * 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.soa.esb.listeners.deployers.mc;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.plugins.main.MainDeployerImpl;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.soa.esb.listeners.deployers.mc.util.VfsUtil;
-import org.jboss.test.kernel.junit.MicrocontainerTest;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Unit tests for {@link EsbWebServiceDeployer}.
- * <p/>
- * 
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EsbWebServiceDeployerUnitTest extends MicrocontainerTest
-{
-    private Deployment deployment;
-    private MainDeployerImpl mainDeployer;
-    
-    public EsbWebServiceDeployerUnitTest(String name)
-    {
-        super(name);
-    }
-    
-    @Override
-    public void afterSetUp() throws Exception
-    {
-        super.afterSetUp();
-        
-        final String archiveName = "exploded-esb-archive.esb";
-        final URL dir = getClass().getResource("/org/jboss/soa/esb/listeners/deployers/mc/test_esb_archives");
-        final VirtualFile archiveFile = VFS.getVirtualFile(dir, archiveName);
-        deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(archiveFile);
-        mainDeployer = (MainDeployerImpl) getBean("MainDeployer");
-        mainDeployer.deploy(deployment);
-    }
-    
-    public void testJBossWebMetaDataCreated() throws Throwable
-    {
-        final DeploymentUnit unit = mainDeployer.getDeploymentUnit(deployment.getName());
-        final JBossWebMetaData webMD = unit.getAttachment(JBossWebMetaData.class);
-        assertNotNull(webMD);
-        
-        final JBossServletsMetaData servlets = webMD.getServlets();
-        assertEquals(1, servlets.size());
-        
-        final String servletClassName = servlets.iterator().next().getServletClass();
-        assertEquals("esb.ws.FirstServiceESB.SimpleListener.Implementation", servletClassName);
-        
-        final List<ServletMappingMetaData> mappings = webMD.getServletMappings();
-        assertEquals(1, mappings.size());
-        assertEquals("FirstServiceESB_SimpleListener", mappings.get(0).getServletName());
-        assertEquals(1, mappings.get(0).getUrlPatterns().size());
-        assertEquals("/ebws/FirstServiceESB/SimpleListener", mappings.get(0).getUrlPatterns().get(0));
-    }
-    
-    public void testServletAddedToClassPath() throws Throwable
-    {
-        final VFSDeploymentUnit unit = (VFSDeploymentUnit) mainDeployer.getDeploymentUnit(deployment.getName());
-        final VirtualFile classesDir = getWebInfClassesDir(unit.getClassPath());
-        
-        assertNotNull(classesDir.getChild("esb/ws/FirstServiceESB/SimpleListener/Implementation.class"));
-    }
-    
-    public void testUndeployCleanup() throws DeploymentException, MalformedURLException, IOException
-    {
-        final EsbWebServiceDeployer wsDeployer = (EsbWebServiceDeployer) getBean("EsbWebServiceDeployer");
-        
-        final VFSDeploymentUnit unit = (VFSDeploymentUnit) mainDeployer.getDeploymentUnit(deployment.getName());
-        final URL inMemRootUrl = VfsUtil.createInMemUrl("exploded-esb-archive");
-        final VirtualFile inMemRootDir = VfsUtil.createInMemoryFs(inMemRootUrl);
-        unit.addAttachment(EsbWebServiceDeployer.DYNAMIC_CL_DIR_KEY, inMemRootDir);
-        unit.addAttachment(EsbWebServiceDeployer.DYNAMIC_CL_URL_KEY, inMemRootUrl);
-        
-        wsDeployer.undeploy(unit, null);
-        
-        assertNull(unit.getAttachment(EsbWebServiceDeployer.DYNAMIC_CL_DIR_KEY));
-        assertNull(unit.getAttachment(EsbWebServiceDeployer.DYNAMIC_CL_URL_KEY));
-        
-        final VirtualFile classesDir = getWebInfClassesDir(unit.getClassPath());
-        assertNull(classesDir);
-    }
-    
-    public void tearDown() throws Exception
-    {
-        mainDeployer.undeploy(deployment);
-        super.tearDown();
-    }
-
-    private VirtualFile getWebInfClassesDir(final List<VirtualFile> classpath)
-    {
-        for (VirtualFile file : classpath)
-        {
-            if (file.getPathName().equals("WEB-INF/classes"))
-            {
-                return file;
-            }
-        }
-        return null;
-    }
-    
-}

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployerUnitTest.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
-            xmlns="urn:jboss:bean-deployer:2.0">
-            
-    <bean name="EsbConfigParser" class="org.jboss.soa.esb.listeners.deployers.mc.EsbConfigParser"/>
-   
-    <bean name="EsbWebServiceDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWebServiceDeployer"/>
-   
-    <!-- bean name="EsbWsdlDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWsdlDeployer"/-->
-   
-    <bean name="EsbDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbDeployer"/>
-   
-    <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
-        <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
-        <property name="deployers"><inject bean="Deployers"/></property>
-    </bean>
-
-    <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
-        <property name="structureBuilder">
-            <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
-        </property>
-        <incallback method="addDeployer"/>
-        <uncallback method="removeDeployer"/>
-    </bean>
-
-    <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
-        <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
-        <incallback method="addDeployer"/>
-        <uncallback method="removeDeployer"/>
-    </bean>
-    
-    <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.GroupingStructure">
-        <property name="shortCircuitFilter">
-            <inject bean="EsbFilter"/>
-        </property>
-        <property name="metaDataPaths">
-            <array elementClass="java.lang.String">
-                <value>META-INF</value>
-                <value>.</value>
-            </array>
-        </property>
-        <property name="libs">
-            <set elementClass="java.lang.String">
-                <value>.</value>
-                <value>jars</value>
-            </set>
-        </property>
-        <property name="libFilter">
-            <inject bean="JarFilter"/>
-        </property>
-        <property name="groups">
-            <set elementClass="java.lang.String">
-                <value>.</value>
-                <value>wars</value>
-            </set>
-        </property>
-        <property name="groupFilter">
-            <inject bean="WarFilter"/>
-        </property>
-    </bean>
-    
-    <bean name="EsbFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
-        <constructor>
-            <parameter>.esb</parameter>
-        </constructor>
-    </bean>
-    
-    <bean name="JarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
-        <constructor>
-            <parameter>.jar</parameter>
-        </constructor>
-    </bean>
-    
-    <bean name="WarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
-        <constructor>
-            <parameter>.war</parameter>
-        </constructor>
-    </bean>
-   
-</deployment>

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.java	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -1,144 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * 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.soa.esb.listeners.deployers.mc;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.deployers.plugins.main.MainDeployerImpl;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.test.kernel.junit.MicrocontainerTest;
-import org.jboss.virtual.MemoryFileFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Unit test for {@link EsbWsdlDeployer}
- * <p/>
- * 
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class EsbWsdlDeployerUnitTest extends MicrocontainerTest
-{
-    private URL dir = getClass().getResource("/org/jboss/soa/esb/listeners/deployers/mc/test_esb_archives");
-    private VFSDeployment deployment;
-    private MainDeployerImpl mainDeployer;
-
-    public EsbWsdlDeployerUnitTest(String name)
-    {
-        super(name);
-    }
-    
-    @Override
-    public void afterSetUp() throws Exception
-    {
-        super.afterSetUp();
-        
-        final String archiveName = "exploded-esb-archive.esb";
-        final VirtualFile archiveFile = VFS.getVirtualFile(dir, archiveName);
-        deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(archiveFile);
-        mainDeployer = (MainDeployerImpl) getBean("MainDeployer");
-        mainDeployer.deploy(deployment);
-    }
-    
-    public void testGetAllSchemas() throws Throwable
-    {
-        final VirtualFile virtualFile = VFS.getVirtualFile(dir, "exploded-esb-archive.esb");
-        final EsbWsdlDeployer esbWsdlDeployer = new EsbWsdlDeployer();
-        final List<VirtualFile> schemas = esbWsdlDeployer.getSchemas(virtualFile);
-        
-        assertNotNull(schemas);
-        assertEquals(1, schemas.size());
-    }
-    
-    public void testAddSchemasToVFS() throws IOException, URISyntaxException
-    {
-        final List<VirtualFile> addedSchemas = getSchemasFromExplodedEsbArchive();
-        assertNotNull(addedSchemas);
-        assertEquals(3, addedSchemas.size());
-        assertSchemaPaths(addedSchemas);
-    }
-    
-    private void assertSchemaPaths(final List<VirtualFile> schemaPaths) throws MalformedURLException, URISyntaxException
-    {
-        for (final VirtualFile schemaFile : schemaPaths)
-        {
-            final String fileName = schemaFile.getName();
-            if (fileName.equals("request.xsd"))
-            {
-                assertEquals("vfsmemory://junit/WEB-INF/wsdl/request.xsd", schemaFile.toURL().toString());
-            }
-            if (fileName.equals("custom-request-type.xsd"))
-            {
-                assertEquals("vfsmemory://junit/WEB-INF/wsdl/types/custom-request-type.xsd", schemaFile.toURL().toString());
-            }
-            if (fileName.equals("jarsubdir.xsd"))
-            {
-                assertEquals("vfsmemory://junit/WEB-INF/wsdl/jarsubdir/jarsubdir.xsd", schemaFile.toURL().toString());
-            }
-        }
-    }
-    
-    private List<VirtualFile> getSchemasFromExplodedEsbArchive() throws IOException, URISyntaxException
-    {
-        final String archiveName = "exploded-esb-archive-subdeployment.esb";
-        final VirtualFile virtualFile = VFS.getVirtualFile(dir, archiveName);
-        final EsbWsdlDeployer esbWsdlDeployer = new EsbWsdlDeployer();
-        final List<VirtualFile> schemas = esbWsdlDeployer.getSchemas(virtualFile);
-        
-        final URL dynamicClassRootUrl = new URL("vfsmemory", "junit", "");
-        final VirtualFile dynamicClasspathDir = MemoryFileFactory.createRoot(dynamicClassRootUrl).getRoot();
-        final URL wsdlUrl = new URL(dynamicClassRootUrl + "/somefile");
-        VirtualFile putFile = MemoryFileFactory.putFile(wsdlUrl, "dummy".getBytes());
-        
-        esbWsdlDeployer.addSchemasToVfs(schemas, putFile.getParent(), archiveName);
-        
-        return esbWsdlDeployer.getSchemas(dynamicClasspathDir);
-    }
-    
-    public void testUndeployCleanup() throws DeploymentException, MalformedURLException, IOException
-    {
-        final String wsdl = "WEB-INF/wsdl/FirstServiceESB/SimpleListener.wsdl";
-        final EsbWsdlDeployer wsdlDeployer = (EsbWsdlDeployer) getBean("EsbWsdlDeployer");
-        
-        final VFSDeploymentUnit unit = (VFSDeploymentUnit) mainDeployer.getDeploymentUnit(deployment.getName());
-        assertNotNull(unit.getMetaDataFile(wsdl));
-        
-        wsdlDeployer.undeploy(unit, null);
-        
-        assertNull(unit.getMetaDataFile(wsdl));
-        assertNull(unit.getAttachment(EsbWsdlDeployer.WSDL_LOCATIONS_KEY));
-        assertNull(unit.getAttachment(EsbWsdlDeployer.DYNAMIC_ROOT_URL_KEY));
-    }
-    
-    public void tearDown() throws Exception
-    {
-        mainDeployer.undeploy(deployment);
-        super.tearDown();
-    }
-}

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWsdlDeployerUnitTest.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
-            xmlns="urn:jboss:bean-deployer:2.0">
-            
-   <bean name="EsbConfigParser" class="org.jboss.soa.esb.listeners.deployers.mc.EsbConfigParser"/>
-   
-   <bean name="EsbWebServiceDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWebServiceDeployer"/>
-   
-   <bean name="EsbWsdlDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWsdlDeployer"/>
-   
-   <bean name="EsbDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbDeployer"/>
-   
-   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
-      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
-      <property name="deployers"><inject bean="Deployers"/></property>
-   </bean>
-
-   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
-      <property name="structureBuilder">
-         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
-      </property>
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-
-   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
-      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-   
-   <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.GroupingStructure">
-        <property name="shortCircuitFilter">
-            <inject bean="EsbFilter"/>
-        </property>
-        <property name="metaDataPaths">
-            <array elementClass="java.lang.String">
-                <value>META-INF</value>
-                <value>.</value>
-            </array>
-        </property>
-        <property name="libs">
-            <set elementClass="java.lang.String">
-                <value>.</value>
-                <value>jars</value>
-            </set>
-        </property>
-        <property name="libFilter">
-            <inject bean="JarFilter"/>
-        </property>
-        <property name="groups">
-            <set elementClass="java.lang.String">
-                <value>.</value>
-                <value>wars</value>
-            </set>
-        </property>
-        <property name="groupFilter">
-            <inject bean="WarFilter"/>
-        </property>
-    </bean>
-    
-    <bean name="EsbFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
-        <constructor>
-            <parameter>.esb</parameter>
-        </constructor>
-    </bean>
-    
-    <bean name="JarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
-        <constructor>
-            <parameter>.jar</parameter>
-        </constructor>
-    </bean>
-    
-    <bean name="WarFilter" class="org.jboss.soa.esb.listeners.deployers.mc.util.VfsFileFilter">
-        <constructor>
-            <parameter>.war</parameter>
-        </constructor>
-    </bean>
-   
-    <bean name="ClassLoaderDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.TestClassLoaderDeployer"/>
-   
-</deployment>

Modified: labs/jbossesb/trunk/qa/base-cp.xml
===================================================================
--- labs/jbossesb/trunk/qa/base-cp.xml	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/qa/base-cp.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -85,6 +85,7 @@
 			<fileset dir="${qa.lib}/ext" includes="*.jar" />
 			<!-- common client jars -->
 			<fileset dir="${org.jboss.esb.server.home}/client" includes="jaxb-api.jar jaxb-impl.jar jaxb-xjc.jar"/>
+			<fileset dir="${org.jboss.esb.server.home}/client" includes="servlet-api.jar" />
 			<pathelement location="${org.jboss.esb.server.home}/client/jbossall-client.jar" />
 			<pathelement location="${org.jboss.esb.server.server}/deploy/jbossesb.sar/rosetta.aop"/>
 			<pathelement location="${pwd}" />
@@ -162,6 +163,7 @@
             <fileset dir="${org.jboss.esb.server.common.lib}" includes="commons-collections.jar"/>
             <fileset dir="${org.jboss.esb.server.common.lib}" includes="jboss-jaxws.jar jboss-saaj.jar jbossws-common.jar jbossws-spi.jar"/>
             <fileset dir="${org.jboss.esb.server.common.lib}" includes="jbossws-common.jar jbossws-framework.jar jbossws-native-jaxrpc.jar jbossws-native-saaj.jar jbossws-spi.jar"/>
+			<fileset dir="${org.jboss.esb.server.common.lib}" includes="servlet-api.jar" />
 
 			<fileset dir="${product.dir}/../testlib" >
                 <include name="emma*.jar" />

Modified: labs/jbossesb/trunk/qa/junit/build.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/build.xml	2010-07-16 05:27:41 UTC (rev 33931)
+++ labs/jbossesb/trunk/qa/junit/build.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -173,6 +173,20 @@
             <include name="META-INF/*.xml"/>
          </fileset>
       </jar>
+      <jar jarfile="${qa.build.lib}/webgateway.esb">
+         <fileset dir="${qa.junit.resources}/server/webgateway">
+            <include name="*.xml"/>
+            <include name="*.xsd"/>
+            <include name="types/*.xsd"/>
+            <include name="types/subtypes/*.xsd"/>
+            <include name="META-INF/*.xml"/>
+         </fileset>
+      </jar>
+      <war jarfile="${qa.build.lib}/sysprop.war" webxml="${qa.junit.resources}/server/sysprop/WEB-INF/web.xml">
+         <classes dir="${qa.junit.classes}">
+            <include name="org/jboss/soa/esb/server/sysprop/*.class"/>
+         </classes>
+      </war>
    </target>
 
    <target name="one-test" if="test" depends="jars"

Added: labs/jbossesb/trunk/qa/junit/resources/server/sysprop/WEB-INF/web.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/sysprop/WEB-INF/web.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/sysprop/WEB-INF/web.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+    "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+  <display-name>System Property Deployer</display-name>
+  <description>
+     System Property Deployer Servlet
+  </description>
+  <servlet>
+    <servlet-name>SysPropServlet</servlet-name>
+    <servlet-class>org.jboss.soa.esb.server.sysprop.SysPropServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>SysPropServlet</servlet-name>
+    <url-pattern>/esb-sysprop</url-pattern>
+  </servlet-mapping>
+</web-app>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/deployment.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/deployment.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/deployment.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,6 @@
+<jbossesb-deployment>
+  <depends>jboss.esb:deployment=soap.esb</depends>
+  <depends>jboss.esb:deployment=simple.esb</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb_reply</depends>
+</jbossesb-deployment>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/META-INF/jboss-esb.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,37 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_publish_as_webservice_Request_esb"
+                      selector="serviceName='HelloWorldPubService'"
+                  />
+              </jms-bus>
+
+          </jms-provider>
+      </providers>
+      
+      <services>
+        <service 
+            category="ESBServiceSample" 
+            name="${esb.test.prop.service.name}" 
+            description="Hello world ESB Service">
+            <security moduleName="JBossWS"/>
+            <listeners>
+                <jms-listener name="helloWorld"
+                              busidref="quickstartEsbChannel"
+                              maxThreads="1"
+                />
+            </listeners>
+            <actions  inXsd="/request.xsd" outXsd="/response.xsd" faultXsd="/fault.xsd" validate="true">
+                <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
+                  <property name="printfull" value="false"/>
+                </action>
+            </actions>
+        </service>
+      </services>
+     
+</jbossesb>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/fault.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/fault.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/fault.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,9 @@
+<xs:schema version="1.0" targetNamespace="http://www.jboss.org/sayHi" xmlns:x1="http://www.jboss.org/sayHi"  xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="sayFault" type="x1:fault"/>
+  <xs:complexType name="fault">
+    <xs:sequence>
+      <xs:element name="code" type="xs:string"/>
+      <xs:element name="faultString" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/jbm-queue-service.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb_reply"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+</server>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/request.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/request.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/request.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,19 @@
+<xs:schema version="1.0" 
+    targetNamespace="http://www.jboss.org/sayHi" 
+    xmlns:x1="http://www.jboss.org/sayHi" 
+    xmlns:cust="http://www.jboss.org/custom-request" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+  <xs:import namespace="http://www.jboss.org/custom-request" schemaLocation="./types/custom-request-type.xsd"/>
+  
+  <xs:element name="sayHi" type="x1:sayHi"/>
+  
+  <xs:complexType name="sayHi">
+    <xs:sequence>
+      <xs:element name="arg0" type="xs:string" minOccurs="1"/>
+	  <xs:element ref="cust:customType" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+  
+</xs:schema>
+

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/response.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/response.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/response.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,17 @@
+<xs:schema version="1.0" 
+	targetNamespace="http://www.jboss.org/sayHi" 
+	xmlns:x1="http://www.jboss.org/sayHi"  
+	xmlns:cust="http://www.jboss.org/custom-response"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+	elementFormDefault="qualified">
+
+  <xs:import namespace="http://www.jboss.org/custom-response" schemaLocation="types/custom-response-type.xsd"/>
+
+  <xs:element name="sayHiResponse" type="x1:sayHiResponse"/>
+  <xs:complexType name="sayHiResponse">
+    <xs:sequence>
+      <xs:element name="arg0" type="xs:string" minOccurs="0"/>
+	  <xs:element name="importedElement" type="cust:customType" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-request-type.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-request-type.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-request-type.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,18 @@
+<xs:schema version="1.0" 
+    targetNamespace="http://www.jboss.org/custom-request" 
+    xmlns:cust="http://www.jboss.org/custom-request"  
+    xmlns:sub="http://www.jboss.org/custom-subtype"  
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    elementFormDefault="qualified">
+
+  <xs:import namespace="http://www.jboss.org/custom-subtype" schemaLocation="./subtypes/custom-subtype-type.xsd"/>
+  
+  <xs:element name="customType" type="cust:CustomType"/>
+  
+  <xs:complexType name="CustomType">
+    <xs:sequence>
+      <xs:element name="type" type="xs:string" minOccurs="1"/>
+	  <xs:element ref="sub:subType" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-response-type.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-response-type.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/custom-response-type.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,8 @@
+<xs:schema version="1.0" targetNamespace="http://www.jboss.org/custom-response" xmlns:cust="http://www.jboss.org/custom-response"  xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+  <xs:complexType name="customType">
+    <xs:sequence>
+      <xs:element name="type" type="xs:string" minOccurs="1"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/subtypes/custom-subtype-type.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/subtypes/custom-subtype-type.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/subtypes/custom-subtype-type.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,19 @@
+<xs:schema version="1.0" 
+    targetNamespace="http://www.jboss.org/custom-subtype" 
+    xmlns:sub="http://www.jboss.org/custom-subtype" 
+    xmlns:t="http://www.jboss.org/type2" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    elementFormDefault="qualified">
+    
+  <xs:import namespace="http://www.jboss.org/type2" schemaLocation="../type2-type.xsd"/>
+
+  <xs:element name="subType" type="sub:SubType"/>
+  
+  <xs:complexType name="SubType">
+    <xs:sequence>
+      <xs:element name="type" type="xs:string" minOccurs="0"/>
+	  <xs:element ref="t:type2" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+

Added: labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/type2-type.xsd
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/type2-type.xsd	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/webgateway/types/type2-type.xsd	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,15 @@
+<xs:schema version="1.0" 
+    targetNamespace="http://www.jboss.org/type2" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    xmlns:t="http://www.jboss.org/type2" 
+    elementFormDefault="qualified">
+
+  <xs:element name="type2" type="t:Type2"/>
+  
+  <xs:complexType name="Type2">
+    <xs:sequence>
+      <xs:element name="type" type="xs:string" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/JBESB_2874_DeployUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/JBESB_2874_DeployUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/JBESB_2874_DeployUnitTest.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,94 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.soa.esb.server;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import junit.framework.Test;
+
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * TestCase to test dependee's re-deployment and property substitution between a dependent's restarts.
+ *
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+
+public class JBESB_2874_DeployUnitTest extends JBossTestCase
+{
+   static boolean deployed = false;
+   static int test = 0;
+
+   public JBESB_2874_DeployUnitTest(String name)
+   {
+      super(name);
+   }
+
+   public void testDeployment() throws Exception
+   {
+      ObjectName sysProps = new ObjectName("jboss:name=SystemProperties,type=Service");
+      ObjectName esbDeployment = new ObjectName("jboss.esb:deployment=webgateway.esb");
+      ObjectName esbDepends = new ObjectName("jboss.esb:deployment=simple.esb");
+      String[] sig = {String.class.getName()};
+      Object[] args = {"jboss.server.temp.dir"};
+
+      String tmpdir = (String)invoke(sysProps, "get", args, sig);
+      File tempFile = new File(tmpdir + File.separator + "esbwarfiles" + File.separator + "webgateway.war");
+      assertTrue(tempFile.getPath() + " was not created!", tempFile.exists());
+
+      String jbossEsbXml = (String)invoke(esbDeployment, "getJbossEsbXml", new Object[]{}, new String[]{});
+      String expected = "expected_JBESB_2874_01.xml";
+      assertTrue("Generated jboss-esb.xml not as expected. See " + expected + ".  Generated xml: \n" + 
+                    jbossEsbXml, XMLHelper.compareXMLContent(getClass().getResourceAsStream(expected), new ByteArrayInputStream(jbossEsbXml.getBytes())));
+
+      // Modify the system property between deployment
+      sig = new String[] {String.class.getName(), String.class.getName()};
+      args = new Object[] {"esb.test.prop.service.name", "ModifiedHelloWorldPubService"};
+      invoke(sysProps, "set", args, sig);
+
+      // Undeploy the depends service
+      undeploy("simple.esb");
+      // Temp war file should be undeployed and deleted by now
+      assertFalse(tempFile.getPath() + " was not deleted!", tempFile.exists());
+
+      // Deploy the depends service
+      redeploy("simple.esb");
+      // Temp war file should be recreated by now
+      assertTrue(tempFile.getPath() + " was not re-created!", tempFile.exists());
+
+      jbossEsbXml = (String)invoke(esbDeployment, "getJbossEsbXml", new Object[]{}, new String[]{});
+      expected = "expected_JBESB_2874_02.xml";
+      assertTrue("Generated jboss-esb.xml not as expected. See " + expected + ".  Generated xml: \n" + 
+                    jbossEsbXml, XMLHelper.compareXMLContent(getClass().getResourceAsStream(expected), new ByteArrayInputStream(jbossEsbXml.getBytes())));
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(JBESB_2874_DeployUnitTest.class, "sysprop.war, simple.esb, webgateway.esb");
+   }
+
+}

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_01.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_01.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_01.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,37 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_publish_as_webservice_Request_esb"
+                      selector="serviceName='HelloWorldPubService'"
+                  />
+              </jms-bus>
+
+          </jms-provider>
+      </providers>
+      
+      <services>
+        <service 
+            category="ESBServiceSample" 
+            name="HelloWorldPubService" 
+            description="Hello world ESB Service">
+            <security moduleName="JBossWS"/>
+            <listeners>
+                <jms-listener name="helloWorld"
+                              busidref="quickstartEsbChannel"
+                              maxThreads="1"
+                />
+            </listeners>
+            <actions  inXsd="/request.xsd" outXsd="/response.xsd" faultXsd="/fault.xsd" validate="true">
+                <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
+                  <property name="printfull" value="false"/>
+                </action>
+            </actions>
+        </service>
+      </services>
+     
+</jbossesb>

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_02.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_02.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/expected_JBESB_2874_02.xml	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,37 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_publish_as_webservice_Request_esb"
+                      selector="serviceName='HelloWorldPubService'"
+                  />
+              </jms-bus>
+
+          </jms-provider>
+      </providers>
+      
+      <services>
+        <service 
+            category="ESBServiceSample" 
+            name="ModifiedHelloWorldPubService" 
+            description="Hello world ESB Service">
+            <security moduleName="JBossWS"/>
+            <listeners>
+                <jms-listener name="helloWorld"
+                              busidref="quickstartEsbChannel"
+                              maxThreads="1"
+                />
+            </listeners>
+            <actions  inXsd="/request.xsd" outXsd="/response.xsd" faultXsd="/fault.xsd" validate="true">
+                <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
+                  <property name="printfull" value="false"/>
+                </action>
+            </actions>
+        </service>
+      </services>
+     
+</jbossesb>

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/sysprop/SysPropServlet.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/sysprop/SysPropServlet.java	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/sysprop/SysPropServlet.java	2010-07-16 07:12:34 UTC (rev 33932)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.soa.esb.server.sysprop;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A Servlet that initializes certain System properties needed by junit tests.
+ *
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ * @version $Revision: 1.0 $
+ */
+public class SysPropServlet extends HttpServlet
+{
+    private Logger log = Logger.getLogger(SysPropServlet.class);
+
+    public void init(ServletConfig config) throws ServletException
+    {
+        super.init(config);
+        System.setProperty("esb.test.prop.service.name", "HelloWorldPubService");
+        log.info("System properties initialized!");
+    }
+
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+    {
+        PrintWriter pw = new PrintWriter (response.getOutputStream());
+        pw.println("Not Implemented!");
+        pw.close();
+    }
+}



More information about the jboss-svn-commits mailing list