[jboss-svn-commits] JBL Code SVN: r28836 - in labs/jbossesb/workspace/tfennelly/httpg2/product: rosetta/src/org/jboss/internal/soa/esb/listeners/war and 8 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 5 08:35:53 EDT 2009


Author: tfennelly
Date: 2009-08-05 08:35:52 -0400 (Wed, 05 Aug 2009)
New Revision: 28836

Added:
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/SecurityConstraints.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jboss-web.xml.ftl
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/web.xml.ftl
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/empty.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet_and_filter.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_jbosswebxml.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_webxml.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_jbosswebxml.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_webxml.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_method_constraints_no_roles.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_role_constraints_no_methods.xml
Removed:
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/security/
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/web.xml.ftl
Modified:
   labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/AbstractWebComponent.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Filter.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpListenerMapper.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice_inonly/jboss-esb.xml
Log:
Eventually got the security working

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-08-05 12:35:52 UTC (rev 28836)
@@ -1700,7 +1700,7 @@
 			<xsd:complexContent>
 				<xsd:extension base="jesb:bus">
                     <xsd:choice minOccurs="0" maxOccurs="2">
-                        <xsd:element name="methods" minOccurs="0" maxOccurs="1">
+                        <xsd:element name="protected-methods" minOccurs="0" maxOccurs="1">
                             <xsd:complexType>
                                 <xsd:sequence>
                                     <xsd:element name="method" minOccurs="1" maxOccurs="5">
@@ -1721,7 +1721,7 @@
                                 </xsd:sequence>
                             </xsd:complexType>
                         </xsd:element>
-                        <xsd:element name="roles" minOccurs="0" maxOccurs="1">
+                        <xsd:element name="allowed-roles" minOccurs="0" maxOccurs="1">
                             <xsd:complexType>
                                 <xsd:sequence>
                                     <xsd:element name="role" minOccurs="1" maxOccurs="unbounded">
@@ -1750,7 +1750,7 @@
                     <xsd:sequence>
                         <xsd:element name="auth" minOccurs="0" maxOccurs="1">
                             <xsd:complexType>
-                                <xsd:attribute name="method" use="required">
+                                <xsd:attribute name="method" use="optional" default="BASIC">
                                     <xsd:simpleType>
                                         <xsd:restriction base="xsd:NMTOKEN">
                                             <xsd:enumeration value="BASIC" />
@@ -1759,6 +1759,11 @@
                                         </xsd:restriction>
                                     </xsd:simpleType>
                                 </xsd:attribute>
+                                <xsd:attribute name="domain" type="xsd:string" use="optional">
+                                    <xsd:annotation>
+                                        <xsd:documentation xml:lang="en">Security Domain.</xsd:documentation>
+                                    </xsd:annotation>
+                                </xsd:attribute>
                             </xsd:complexType>
                         </xsd:element>
                     </xsd:sequence>

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/AbstractWebComponent.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/AbstractWebComponent.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/AbstractWebComponent.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -34,15 +34,18 @@
  */
 public abstract class AbstractWebComponent {
     
-    protected String name;
-    protected String runtimeClass;
+    private String name;
+    private String runtimeClass;
+    private WebModel webModel;
     private List<KeyValuePair> params = new ArrayList<KeyValuePair>();
 
-    public AbstractWebComponent(String name, String runtimeClass) {
+    public AbstractWebComponent(String name, String runtimeClass, WebModel webModel) {
         AssertArgument.isNotNullAndNotEmpty(name, "name");
         AssertArgument.isNotNullAndNotEmpty(runtimeClass, "runtimeClass");
+        AssertArgument.isNotNull(webModel, "webModel");
         this.name = name;
         this.runtimeClass = runtimeClass;
+        this.webModel = webModel;
     }
 
     public String getName() {
@@ -53,6 +56,10 @@
         return runtimeClass;
     }
 
+    public WebModel getWebModel() {
+        return webModel;
+    }
+
     public List<KeyValuePair> getParams() {
         return params;
     }

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Filter.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Filter.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Filter.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -33,9 +33,10 @@
     private Servlet targetServlet;
 
     public Filter(String name, String runtimeClass, Servlet targetServlet) {
-        super(name, runtimeClass);
+        super(name, runtimeClass, targetServlet.getWebModel());
         AssertArgument.isNotNull(targetServlet, "targetServlet");
         this.targetServlet = targetServlet;
+        targetServlet.getWebModel().getFilters().add(this);
     }
 
     public Servlet getTargetServlet() {

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -19,10 +19,6 @@
  */
 package org.jboss.internal.soa.esb.listeners.war;
 
-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.security.Security;
-import org.jboss.internal.soa.esb.listeners.war.security.Constraints;
 import org.jboss.soa.esb.listeners.config.DeploymentResourceLocator;
 import org.jboss.soa.esb.listeners.gateway.HttpGatewayServlet;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
@@ -36,7 +32,10 @@
 public class HttpGatewayDeploymentFactory implements WebGatewayDeploymentFactory {
     
     public static final String URL_PATTERN = "urlPattern";
-    public static final String METHODS = "methods";
+    public static final String PROTECTED_METHODS = "protectedMethods";
+    public static final String ALLOWED_ROLES = "allowedRoles";
+    public static final String AUTH_METHOD = "authMethod";
+    public static final String AUTH_DOMAIN = "authDomain";
 
     public void setBusName(String busName) {
         // Not relevant to this factory!
@@ -48,7 +47,7 @@
 
     public void updateDeployment(ConfigTree webEndpointConfig, WebDeploymentArchive webDeployment) throws ConfigurationException {
         String servletName = webEndpointConfig.getRequiredAttribute("name");
-        Servlet servlet = new Servlet(servletName, HttpGatewayServlet.class.getName());
+        Servlet servlet = new Servlet(servletName, HttpGatewayServlet.class.getName(), webDeployment.getWebModel());
 
         // Set the endpoint urlPattern so as to map requests from that namespace into
         // this servlet instance...
@@ -71,44 +70,44 @@
         // Map all config tree attributes as servlet parameters...
         servlet.getParams().addAll(webEndpointConfig.attributesAsList());
 
-        // Add the servlet definition to the model...
-        webDeployment.getWebModel().getServlets().add(servlet);
+        // Set the authentication method and domain.  Yes... this can result in the auth method/domain being set
+        // and reset by multiple listeners, but the auth method source config should be the
+        // same for them all.  Also, we throw an exception from inside the WebModel if an attempt
+        // is made to reset it to something else...
+        webDeployment.getWebModel().setAuthMethod(webEndpointConfig.getAttribute(AUTH_METHOD));
+        webDeployment.getWebModel().setAuthDomain(webEndpointConfig.getAttribute(AUTH_DOMAIN));
     }
 
     private void addSecurityConstraints(ConfigTree webEndpointConfig, Servlet servlet) {
-        String methodsConfig = webEndpointConfig.getAttribute(METHODS);
-        Security security = getSecurity(servlet);
-        Constraints constraints = getConstraints(security);
 
+        String methodsConfig = webEndpointConfig.getAttribute(PROTECTED_METHODS);
         if(methodsConfig != null) {
+            SecurityConstraints securityConstraints = getSecurityConstraints(servlet);
             String[] methods = methodsConfig.split(",");
 
             // Add the specified methods...
             for(String method : methods) {
-                constraints.getAllowedMethods().add(method.trim());
+                securityConstraints.getProtectedMethods().add(method.trim());
             }
-        } else {
-            // If no methods are defined, then all default methods are
-            // allowed...
-            constraints.addDefaultAllowedMethods();
         }
-    }
 
-    private Security getSecurity(Servlet servlet) {
-        Security security = servlet.getSecurity();
-        if(security == null) {
-            security = new Security();
-            servlet.setSecurity(security);
+        String rolesConfig = webEndpointConfig.getAttribute(ALLOWED_ROLES);
+        if(rolesConfig != null) {
+            SecurityConstraints securityConstraints = getSecurityConstraints(servlet);
+            String[] roles = rolesConfig.split(",");
+
+            // Add the specified roles...
+            for(String role : roles) {
+                securityConstraints.getAllowedRoles().add(role.trim());
+            }
         }
-        return security;
     }
 
-    private Constraints getConstraints(Security security) {
-        Constraints constraints = security.getConstraints();
-        if(constraints == null) {
-            constraints = new Constraints();
-            security.setConstraints(constraints);
+    private SecurityConstraints getSecurityConstraints(Servlet servlet) {
+        SecurityConstraints securityConstraints = servlet.getSecurityConstraints();
+        if(securityConstraints == null) {
+            securityConstraints = new SecurityConstraints(servlet);
         }
-        return constraints;
+        return securityConstraints;
     }
 }
\ No newline at end of file

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/SecurityConstraints.java (from rev 28569, labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/security/Security.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/SecurityConstraints.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/SecurityConstraints.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,63 @@
+/*
+ * 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.internal.soa.esb.listeners.war;
+
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+
+import java.util.Set;
+import java.util.LinkedHashSet;
+
+/**
+ * Security Constraints.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SecurityConstraints {
+
+    private Servlet servlet;
+    private Set<String> protectedMethods = new LinkedHashSet<String>() ;
+    private Set<String> allowedRoles = new AllowedRoleSet<String>();
+
+    public SecurityConstraints(Servlet servlet) {
+        AssertArgument.isNotNull(servlet, "servlet");
+        this.servlet = servlet;
+        servlet.setSecurityConstraints(this);
+    }
+
+    public Set<String> getProtectedMethods() {
+        return protectedMethods;
+    }
+
+    public Set<String> getAllowedRoles() {
+        return allowedRoles;
+    }
+
+    private class AllowedRoleSet<T extends String> extends LinkedHashSet<String> {
+
+        public boolean add(String role) {
+            // Also add the role to the parent WebModel securityRoles, so the
+            // <security-role> entries can be easily added to the web.xml...
+            servlet.getWebModel().getSecurityRoles().add(role);
+            return super.add(role);
+        }
+    }
+}

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -21,12 +21,6 @@
  */
 package org.jboss.internal.soa.esb.listeners.war;
 
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.internal.soa.esb.listeners.war.security.Security;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-import javax.servlet.http.HttpServlet;
-import java.util.Properties;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -38,21 +32,22 @@
 public class Servlet extends AbstractWebComponent {
 
     private List<String> urlMappings = new ArrayList<String>();
-    private Security security;
+    private SecurityConstraints securityConstraints;
 
-    public Servlet(String name, String runtimeClass) {
-        super(name, runtimeClass);
+    public Servlet(String name, String runtimeClass, WebModel webModel) {
+        super(name, runtimeClass, webModel);
+        webModel.getServlets().add(this);
     }
 
     public List<String> getUrlMappings() {
         return urlMappings;
     }
 
-    public Security getSecurity() {
-        return security;
+    public SecurityConstraints getSecurityConstraints() {
+        return securityConstraints;
     }
 
-    public void setSecurity(Security security) {
-        this.security = security;
+    protected void setSecurityConstraints(SecurityConstraints securityConstraints) {
+        this.securityConstraints = securityConstraints;
     }
 }

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -31,13 +31,15 @@
 import java.util.Map;
 import java.util.HashMap;
 
+import freemarker.template.TemplateException;
+
 /**
  * Web deployment archive.
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public class WebDeploymentArchive extends DeploymentArchive {
 
-    private WebModel webModel = new WebModel();
+    private WebModel webModel;
     private boolean archiveFinalized = false;
 
     /**
@@ -47,6 +49,7 @@
      */
     public WebDeploymentArchive(String archiveName) {
         super(archiveName);
+        webModel = new WebModel(archiveName);
     }
 
     public WebModel getWebModel() {
@@ -57,8 +60,11 @@
     public void finalizeArchive() throws ConfigurationException {
         try {
             // Add the web.xml...
-            addWebDescriptor();
+            addWebXML();
 
+            // Add the jboss-web.xml...
+            addJBossWebXML();
+
             // TODO: Add jboss-web.xml
         } finally {
             // Mark as finalized...
@@ -66,19 +72,42 @@
         }
     }
 
-    private void addWebDescriptor() throws ConfigurationException {
-        FreeMarkerTemplate template = new FreeMarkerTemplate("web.xml.ftl", WebDeploymentArchive.class);
+    private void addWebXML() throws ConfigurationException {
+        try {
+            String webXml = getWebXML();
+            addEntry("WEB-INF/web.xml", new ByteArrayInputStream(webXml.getBytes("UTF-8")));
+        } catch (Exception e) {
+            throw new ConfigurationException("Error adding web.xml to web deployment.", e);
+        }
+    }
+
+    String getWebXML() throws TemplateException {
+        FreeMarkerTemplate template = new FreeMarkerTemplate("templates/web.xml.ftl", WebDeploymentArchive.class);
         Map contextObj = new HashMap();
 
         contextObj.put("webModel", webModel);
+        
+        return template.apply(contextObj);
+    }
 
+    private void addJBossWebXML() throws ConfigurationException {
         try {
-            addEntry("WEB-INF/web.xml", new ByteArrayInputStream(template.apply(contextObj).getBytes("UTF-8")));
+            String jbossWebXml = getJBossWebXML();
+            addEntry("WEB-INF/jboss-web.xml", new ByteArrayInputStream(jbossWebXml.getBytes("UTF-8")));
         } catch (Exception e) {
             throw new ConfigurationException("Error adding web.xml to web deployment.", e);
         }
     }
 
+    String getJBossWebXML() throws TemplateException {
+        FreeMarkerTemplate template = new FreeMarkerTemplate("templates/jboss-web.xml.ftl", WebDeploymentArchive.class);
+        Map contextObj = new HashMap();
+
+        contextObj.put("webModel", webModel);
+
+        return template.apply(contextObj);
+    }
+
     public final void addEntry(String path, InputStream data) {
         assertNotFinalized();
         super.addEntry(path, data);

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -21,8 +21,13 @@
  */
 package org.jboss.internal.soa.esb.listeners.war;
 
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * JEE WAR deployment model.
@@ -31,9 +36,22 @@
  */
 public class WebModel {
 
+    private String esbName;
     private List<Filter> filters = new ArrayList<Filter>();
     private List<Servlet> servlets = new ArrayList<Servlet>();
+    private Set<String> securityRoles = new HashSet<String>();
+    private String authMethod;
+    private String authDomain;
 
+    public WebModel(String esbName) {
+        AssertArgument.isNotNullAndNotEmpty(esbName, "esbName");
+        this.esbName = esbName;
+    }
+
+    public String getEsbName() {
+        return esbName;
+    }
+
     public List<Filter> getFilters() {
         return filters;
     }
@@ -41,4 +59,52 @@
     public List<Servlet> getServlets() {
         return servlets;
     }
+
+    public Set<String> getSecurityRoles() {
+        return securityRoles;
+    }
+
+    public String getAuthMethod() {
+        if(authMethod == null && (authDomain != null || !securityRoles.isEmpty())) {
+            // Default the method to "BASIC" if there's an authDomain,
+            // or role set, specified....
+            return "BASIC";
+        }
+
+        return authMethod;
+    }
+
+    public void setAuthMethod(String authMethod) throws ConfigurationException {
+        if(authMethod == null) {
+            // Just ignore it...
+            return;
+        }
+
+        // If it has already been set, create an error if the incoming value is something
+        // other than the current value?
+        if(this.authMethod != null && !this.authMethod.equals(authMethod)) {
+            throw new ConfigurationException("The authentication method for the web deployment associated with this deployment has already been set to '" + this.authMethod + "'.  Cannot reset to '" + authMethod + "'.");
+        }
+
+        this.authMethod = authMethod;
+    }
+
+    public String getAuthDomain() {
+        return authDomain;
+    }
+
+    public void setAuthDomain(String authDomain) throws ConfigurationException {
+        if(authDomain == null) {
+            // Just ignore it...
+            return;
+        }
+
+        // If it has already been set, create an error if the incoming value is something
+        // other than the current value?
+        if(this.authDomain != null && !this.authDomain.equals(authDomain)) {
+            throw new ConfigurationException("The authentication domain for the web deployment associated with this deployment has already been set to '" + this.authDomain + "'.  Cannot reset to '" + authDomain + "'.");
+        }
+
+        this.authDomain = authDomain;
+    }
 }

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jboss-web.xml.ftl (from rev 28569, labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/web.xml.ftl)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jboss-web.xml.ftl	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jboss-web.xml.ftl	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
+<jboss-web>
+
+    <#if webModel.authDomain??>
+    <security-domain>${webModel.authDomain}</security-domain>
+    </#if>
+
+</jboss-web>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jboss-web.xml.ftl
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/web.xml.ftl (from rev 28569, labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/web.xml.ftl)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/web.xml.ftl	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/web.xml.ftl	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+    <#list webModel.filters as filter>
+
+    <!-- Filter '${filter.name}' configuration... -->
+    <filter>
+        <filter-name>${filter.name}</filter-name>
+        <filter-class>${filter.runtimeClass}</filter-class>
+
+        <#list filter.params as param>
+        <init-param>
+            <param-name>${param.key}</param-name>
+            <param-value>${param.value}</param-value>
+        </init-param>
+        </#list>
+
+    </filter>
+
+    <filter-mapping>
+        <filter-name>${filter.name}</filter-name>
+        <servlet-name>${filter.targetServlet.name}</servlet-name>
+    </filter-mapping>
+    </#list>
+
+    <#list webModel.servlets as servlet>
+
+    <!-- Servlet '${servlet.name}' configuration... -->
+    <servlet>
+        <servlet-name>${servlet.name}</servlet-name>
+        <servlet-class>${servlet.runtimeClass}</servlet-class>
+
+        <#list servlet.params as param>
+        <init-param>
+            <param-name>${param.key}</param-name>
+            <param-value>${param.value}</param-value>
+        </init-param>
+        </#list>
+    
+    </servlet>
+
+    <#list servlet.urlMappings as urlMapping>
+    <servlet-mapping>
+        <servlet-name>${servlet.name}</servlet-name>
+        <url-pattern>${urlMapping}</url-pattern>
+    </servlet-mapping>
+    </#list>
+    </#list>
+
+    <!-- Security constraints... -->
+    <#list webModel.servlets as servlet>
+
+    <#if servlet.securityConstraints??>
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Localized "Reopen" constraints for servlet ${servlet.name}</web-resource-name>
+            <#list servlet.urlMappings as urlMapping>
+            <url-pattern>${urlMapping}</url-pattern>
+            </#list>
+            <#list servlet.securityConstraints.protectedMethods as method>
+            <http-method>${method}</http-method>
+            </#list>
+        </web-resource-collection>
+        <#if (servlet.securityConstraints.allowedRoles?size > 0)>
+        <auth-constraint>
+            <#list servlet.securityConstraints.allowedRoles as role>
+            <role-name>${role}</role-name>
+            </#list>
+        </auth-constraint>
+        <#else>
+        <auth-constraint/>
+        </#if>
+        <user-data-constraint>
+            <transport-guarantee>NONE</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+    </#if>
+
+    </#list>
+
+    <#if webModel.authMethod??>
+    <login-config>
+        <auth-method>${webModel.authMethod}</auth-method>
+        <realm-name>Authentication Realm for ${webModel.esbName}</realm-name>
+    </login-config>
+    </#if>
+
+    <#list webModel.securityRoles as role>
+    <security-role>
+        <role-name>${role}</role-name>
+    </security-role>
+    </#list>
+
+</web-app>

Deleted: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/web.xml.ftl
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/web.xml.ftl	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/web.xml.ftl	2009-08-05 12:35:52 UTC (rev 28836)
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
-         version="2.5">
-
-    <#list webModel.filters as filter>
-
-    <!-- Filter '${filter.name}' configuration... -->
-    <filter>
-        <filter-name>${filter.name}</filter-name>
-        <filter-class>${filter.runtimeClass}</filter-class>
-
-        <#list filter.params as param>
-        <init-param>
-            <param-name>${param.key}</param-name>
-            <param-value>${param.value}</param-value>
-        </init-param>
-        </#list>
-
-    </filter>
-
-    <filter-mapping>
-        <filter-name>${filter.name}</filter-name>
-        <servlet-name>${filter.targetServlet.name}</servlet-name>
-    </filter-mapping>
-    </#list>
-
-    <#list webModel.servlets as servlet>
-
-    <!-- Servlet '${servlet.name}' configuration... -->
-    <servlet>
-        <servlet-name>${servlet.name}</servlet-name>
-        <servlet-class>${servlet.runtimeClass}</servlet-class>
-
-        <#list servlet.params as param>
-        <init-param>
-            <param-name>${param.key}</param-name>
-            <param-value>${param.value}</param-value>
-        </init-param>
-        </#list>
-    
-    </servlet>
-
-    <#list servlet.urlMappings as urlMapping>
-    <servlet-mapping>
-        <servlet-name>${servlet.name}</servlet-name>
-        <url-pattern>${urlMapping}</url-pattern>
-    </servlet-mapping>
-    </#list>
-    </#list>
-
-    <!-- Security constraints... -->
-    <#list webModel.servlets as servlet>
-
-    <#if servlet.security??>
-    <!-- Servlet '${servlet.name}' security configuration... -->
-
-    <#if servlet.security.constraints??>
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>Global "Lockdown" constraints for servlet ${servlet.name}</web-resource-name>
-            <#list servlet.urlMappings as urlMapping>
-            <url-pattern>${urlMapping}</url-pattern>
-            </#list>
-        </web-resource-collection>
-        <auth-constraint />
-    </security-constraint>
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>Localized "Reopen" constraints for servlet ${servlet.name}</web-resource-name>
-            <#list servlet.urlMappings as urlMapping>
-            <url-pattern>${urlMapping}</url-pattern>
-            </#list>
-            <#list servlet.security.constraints.methods as method>
-            <http-method>${method}</http-method>
-            </#list>
-        </web-resource-collection>
-        <user-data-constraint>
-            <transport-guarantee>NONE</transport-guarantee>
-        </user-data-constraint>
-    </security-constraint>
-    </#if>
-
-    <#else>
-    <!-- Servlet '${servlet.name}' doesn't define a security! -->
-    </#if>
-
-    </#list>
-
-</web-app>

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -458,9 +458,8 @@
                        webDeployment.addEntry("WEB-INF/classes/" + wsClassName, wsClass);
 
                        // Servlet....
-                       final Servlet servlet = new Servlet(serviceInfo.getServletName(), serviceInfo.getClassName());
+                       final Servlet servlet = new Servlet(serviceInfo.getServletName(), serviceInfo.getClassName(), webDeployment.getWebModel());
                        servlet.getUrlMappings().add("/ebws" + serviceInfo.getServletPath());
-                       webDeployment.getWebModel().getServlets().add(servlet);
 
                        // Filter...
                        // At the moment we only need the filter to overcome a bug in JBossWS re In-Only endpoints, so
@@ -468,7 +467,6 @@
                        if(serviceInfo.isOneWay()) {
                            Filter filter = new Filter(serviceInfo.getServletName() + "_Filter", ESBResponseFilter.class.getName(), servlet);
                            filter.getParams().add(new KeyValuePair("OneWay", "true"));
-                           webDeployment.getWebModel().getFilters().add(filter);
                        }
 
                        final ContractReferencePublisher publisher = new ESBServiceContractPublisher(service, webserviceInfo.getDescription(), serviceInfo.getServletName()) ;

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpListenerMapper.java	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpListenerMapper.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -12,6 +12,8 @@
 import org.jboss.internal.soa.esb.listeners.war.HttpGatewayDeploymentFactory;
 import org.w3c.dom.Element;
 
+import java.util.List;
+
 /**
  * Http listener mapper.
  * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
@@ -60,8 +62,10 @@
 
         if(listener.getIsGateway()) {
             String urlPattern = listener.getUrlPattern();
-            PayloadAs.Enum payloadAs = listener.getPayloadAs();
-            HttpBus.Methods methods = bus.getMethods();
+            PayloadAs.Enum payloadAs = listener.getPayloadAs();            
+            List<HttpBus.ProtectedMethods> protectedMethodsList = bus.getProtectedMethodsList();
+            List<HttpBus.AllowedRoles> rolesList = bus.getAllowedRolesList();
+            HttpProvider.Auth authType = provider.getAuth();
 
             listenerNode.setAttribute(ListenerTagNames.GATEWAY_CLASS_TAG, HttpGatewayDeploymentFactory.class.getName());
 			listenerNode.setAttribute(ListenerTagNames.IS_GATEWAY_TAG, "true");
@@ -72,16 +76,34 @@
             if(payloadAs != null) {
                 listenerNode.setAttribute(HttpGatewayServlet.PAYLOAD_AS, payloadAs.toString());
             }
-            if(methods != null) {
-                StringBuilder methodString = new StringBuilder();
-                for(HttpBus.Methods.Method method : methods.getMethodList()) {
-                    if(methodString.length() > 0) {
-                        methodString.append(",");
+            if(protectedMethodsList != null && !protectedMethodsList.isEmpty()) {
+                HttpBus.ProtectedMethods methods = protectedMethodsList.get(0);
+                StringBuilder methodsString = new StringBuilder();
+                
+                for(HttpBus.ProtectedMethods.Method method : methods.getMethodList()) {
+                    if(methodsString.length() > 0) {
+                        methodsString.append(",");
                     }
-                    methodString.append(method.getName().toString());
+                    methodsString.append(method.getName().toString());
                 }
-                listenerNode.setAttribute(HttpGatewayDeploymentFactory.METHODS, methodString.toString());
+                listenerNode.setAttribute(HttpGatewayDeploymentFactory.PROTECTED_METHODS, methodsString.toString());
             }
+            if(rolesList != null && !rolesList.isEmpty()) {
+                HttpBus.AllowedRoles roles = rolesList.get(0);
+                StringBuilder rolesString = new StringBuilder();
+
+                for(HttpBus.AllowedRoles.Role role : roles.getRoleList()) {
+                    if(rolesString.length() > 0) {
+                        rolesString.append(",");
+                    }
+                    rolesString.append(role.getName().toString());
+                }
+                listenerNode.setAttribute(HttpGatewayDeploymentFactory.ALLOWED_ROLES, rolesString.toString());
+            }
+            if(authType != null) {
+                listenerNode.setAttribute(HttpGatewayDeploymentFactory.AUTH_METHOD, authType.getMethod().toString());
+                listenerNode.setAttribute(HttpGatewayDeploymentFactory.AUTH_DOMAIN, authType.getDomain());
+            }
         } else {
 			throw new ConfigurationException("Invalid <http-listener> config [" + listener.getName() +"]. <http-listener> is currently only supported as a gateway listener.");
         }

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,138 @@
+/*
+ * 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.internal.soa.esb.listeners.war;
+
+import junit.framework.TestCase;
+import freemarker.template.TemplateException;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.xml.sax.SAXException;
+import org.jboss.soa.esb.ConfigurationException;
+
+import java.io.StringReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class WebDeploymentArchiveUnitTest extends TestCase {
+
+    public void test_empty() throws TemplateException, IOException, SAXException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+
+        String webXML = modelArch.getWebXML();
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("empty.xml")), new StringReader(webXML));
+    }
+
+    public void test_plain_servlet() throws TemplateException, IOException, SAXException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+        Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
+
+        servlet.getUrlMappings().add("/x/*");
+
+        String webXML = modelArch.getWebXML();
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("plain_servlet.xml")), new StringReader(webXML));
+    }
+
+    public void test_plain_servlet_and_filter() throws TemplateException, IOException, SAXException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+        Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
+
+        servlet.getUrlMappings().add("/x/*");
+
+        // Just need to create the filter instance...
+        new Filter("servletXFilter", "com.acme.XServletFilter", servlet);
+
+        String webXML = modelArch.getWebXML();
+        //System.out.println(webXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("plain_servlet_and_filter.xml")), new StringReader(webXML));
+    }
+
+    public void test_with_method_constraints_no_roles() throws TemplateException, IOException, SAXException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+        Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
+        SecurityConstraints securityConstraints = new SecurityConstraints(servlet);
+
+        servlet.getUrlMappings().add("/x/*");
+
+        securityConstraints.getProtectedMethods().add("PUT");
+        securityConstraints.getProtectedMethods().add("POST");
+        securityConstraints.getProtectedMethods().add("DELETE");
+
+        String webXML = modelArch.getWebXML();
+        //System.out.println(webXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_method_constraints_no_roles.xml")), new StringReader(webXML));
+    }
+
+    public void test_with_role_constraints_no_methods() throws TemplateException, IOException, SAXException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+        Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
+        SecurityConstraints securityConstraints = new SecurityConstraints(servlet);
+
+        servlet.getUrlMappings().add("/x/*");
+
+        securityConstraints.getAllowedRoles().add("manager");
+        securityConstraints.getAllowedRoles().add("accountant");
+
+        String webXML = modelArch.getWebXML();
+        //System.out.println(webXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_role_constraints_no_methods.xml")), new StringReader(webXML));
+    }
+
+    public void test_with_authmethod() throws TemplateException, IOException, SAXException, ConfigurationException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+
+        modelArch.getWebModel().setAuthMethod("BASIC");
+
+        String webXML = modelArch.getWebXML();
+        //System.out.println(webXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authmethod_webxml.xml")), new StringReader(webXML));
+
+        String jbossWebXML = modelArch.getJBossWebXML();
+        //System.out.println(jbossWebXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authmethod_jbosswebxml.xml")), new StringReader(jbossWebXML));
+    }
+
+    public void test_with_authdomain() throws TemplateException, IOException, SAXException, ConfigurationException {
+        WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
+
+        modelArch.getWebModel().setAuthDomain("java:/jaas/JBossWS");
+
+        String webXML = modelArch.getWebXML();
+        //System.out.println(webXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authdomain_webxml.xml")), new StringReader(webXML));
+
+        String jbossWebXML = modelArch.getJBossWebXML();
+        //System.out.println(jbossWebXML);
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authdomain_jbosswebxml.xml")), new StringReader(jbossWebXML));
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/empty.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/empty.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/empty.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+
+    <!-- Security constraints... -->
+
+
+
+</web-app>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+
+    <!-- Servlet 'servletX' configuration... -->
+    <servlet>
+        <servlet-name>servletX</servlet-name>
+        <servlet-class>com.acme.XServlet</servlet-class>
+
+
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>servletX</servlet-name>
+        <url-pattern>/x/*</url-pattern>
+    </servlet-mapping>
+
+    <!-- Security constraints... -->
+
+
+</web-app>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet_and_filter.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet_and_filter.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/plain_servlet_and_filter.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+    <!-- Filter 'servletXFilter' configuration... -->
+    <filter>
+        <filter-name>servletXFilter</filter-name>
+        <filter-class>com.acme.XServletFilter</filter-class>
+
+
+    </filter>
+
+    <filter-mapping>
+        <filter-name>servletXFilter</filter-name>
+        <servlet-name>servletX</servlet-name>
+    </filter-mapping>
+
+
+    <!-- Servlet 'servletX' configuration... -->
+    <servlet>
+        <servlet-name>servletX</servlet-name>
+        <servlet-class>com.acme.XServlet</servlet-class>
+
+
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>servletX</servlet-name>
+        <url-pattern>/x/*</url-pattern>
+    </servlet-mapping>
+
+    <!-- Security constraints... -->
+
+
+
+
+
+</web-app>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_jbosswebxml.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_jbosswebxml.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_jbosswebxml.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
+<jboss-web>
+
+        <security-domain>java:/jaas/JBossWS</security-domain>
+
+</jboss-web>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_webxml.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_webxml.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authdomain_webxml.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+
+    <!-- Security constraints... -->
+
+    <login-config>
+        <auth-method>BASIC</auth-method>
+        <realm-name>Authentication Realm for testarch.esb</realm-name>
+    </login-config>
+
+
+</web-app>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_jbosswebxml.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_jbosswebxml.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_jbosswebxml.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
+<jboss-web>
+
+
+</jboss-web>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_webxml.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_webxml.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_authmethod_webxml.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+
+    <!-- Security constraints... -->
+
+    <login-config>
+        <auth-method>BASIC</auth-method>
+        <realm-name>Authentication Realm for testarch.esb</realm-name>
+    </login-config>
+
+
+</web-app>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_method_constraints_no_roles.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_method_constraints_no_roles.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_method_constraints_no_roles.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+
+    <!-- Servlet 'servletX' configuration... -->
+    <servlet>
+        <servlet-name>servletX</servlet-name>
+        <servlet-class>com.acme.XServlet</servlet-class>
+
+
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>servletX</servlet-name>
+        <url-pattern>/x/*</url-pattern>
+    </servlet-mapping>
+
+    <!-- Security constraints... -->
+
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Localized "Reopen" constraints for servlet servletX</web-resource-name>
+            <url-pattern>/x/*</url-pattern>
+            <http-method>PUT</http-method>
+            <http-method>POST</http-method>
+            <http-method>DELETE</http-method>
+        </web-resource-collection>
+        <auth-constraint/>
+        <user-data-constraint>
+            <transport-guarantee>NONE</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+
+
+
+
+</web-app>
\ No newline at end of file

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_role_constraints_no_methods.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_role_constraints_no_methods.xml	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/with_role_constraints_no_methods.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+
+
+    <!-- Servlet 'servletX' configuration... -->
+    <servlet>
+        <servlet-name>servletX</servlet-name>
+        <servlet-class>com.acme.XServlet</servlet-class>
+
+
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>servletX</servlet-name>
+        <url-pattern>/x/*</url-pattern>
+    </servlet-mapping>
+
+    <!-- Security constraints... -->
+
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Localized "Reopen" constraints for servlet servletX</web-resource-name>
+            <url-pattern>/x/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>manager</role-name>
+            <role-name>accountant</role-name>
+        </auth-constraint>
+        <user-data-constraint>
+            <transport-guarantee>NONE</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+
+
+    <login-config>
+        <auth-method>BASIC</auth-method>
+        <realm-name>Authentication Realm for testarch.esb</realm-name>
+    </login-config>
+
+    <security-role>
+        <role-name>accountant</role-name>
+    </security-role>
+    <security-role>
+        <role-name>manager</role-name>
+    </security-role>
+
+</web-app>
\ No newline at end of file

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -1,5 +1,5 @@
 <?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd" parameterReloadSecs="5">
+<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">
@@ -12,6 +12,9 @@
               </jms-bus>
 
           </jms-provider>
+          <http-provider name="http">
+              <http-bus busid="ordermgt" />
+          </http-provider>
       </providers>
       
       <services>
@@ -29,6 +32,14 @@
                    <action name="action" class="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.ESBWSListenerAction" process="displayMessage"/>  
             </actions>
         </service>
+          <service category="OrderManagement" name="Incoming" description="" invmScope="GLOBAL">
+              <listeners>
+                  <http-listener name="1" busidref="ordermgt" urlPattern="/in/*" is-gateway="true" />
+              </listeners>
+              <actions mep="RequestResponse">
+                  <action name="print" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+              </actions>
+          </service>
       </services>
      
 </jbossesb>

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice_inonly/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice_inonly/jboss-esb.xml	2009-08-05 12:04:29 UTC (rev 28835)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/publish_as_webservice_inonly/jboss-esb.xml	2009-08-05 12:35:52 UTC (rev 28836)
@@ -1,5 +1,5 @@
 <?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+<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">



More information about the jboss-svn-commits mailing list