[jboss-svn-commits] JBL Code SVN: r29559 - in labs/jbossesb/workspace/dward/httpcontract/product: rosetta/src/org/jboss/internal/soa/esb/publish and 17 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 8 10:57:28 EDT 2009


Author: dward
Date: 2009-10-08 10:57:27 -0400 (Thu, 08 Oct 2009)
New Revision: 29559

Added:
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java
Removed:
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java
Modified:
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractInfo.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java
   labs/jbossesb/workspace/dward/httpcontract/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
   labs/jbossesb/workspace/dward/httpcontract/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml
   labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java
   labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java
   labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java
   labs/jbossesb/workspace/dward/httpcontract/product/tools/console/contract-web/src/main/webapp/index.jsp
Log:
work for https://jira.jboss.org/jira/browse/JBESB-2822


Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -19,10 +19,12 @@
  */
 package org.jboss.internal.soa.esb.listeners.war;
 
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.http.HttpConfiguration;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.gateway.http.HttpGatewayServlet;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.ConfigurationException;
 
 /**
  * Http Gateway deployment factory.
@@ -40,28 +42,51 @@
     public void updateWebModel(ConfigTree webEndpointConfig, WebModel webModel) throws ConfigurationException {
         String servletName = webEndpointConfig.getRequiredAttribute("name");
         Servlet servlet = new Servlet(servletName, HttpGatewayServlet.class.getName(), webModel);
-
-        // Set the endpoint urlPattern so as to map requests from that namespace into
-        // this servlet instance...
+        
+        // Set the service associated with the servlet
+        servlet.setService( Service.getGatewayTargetService(webEndpointConfig) );
+        
+        // Reuse the urlMapping for the servlet urlPattern and building the endpoint address
+    	String urlMapping;
         String urlPattern = webEndpointConfig.getAttribute(URL_PATTERN);
         if(urlPattern != null) {
             if(urlPattern.startsWith("/")) {
-                servlet.getUrlMappings().add("/http" + urlPattern);
+            	urlMapping = "/http" + urlPattern;
             } else {
-                servlet.getUrlMappings().add("/http/" + urlPattern);
+                urlMapping = "/http/" + urlPattern;
             }
         } else {
             String serviceCat = webEndpointConfig.getAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG);
             String serviceName = webEndpointConfig.getAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG);
-            servlet.getUrlMappings().add("/http/" + serviceCat + "/" + serviceName);
+            urlMapping = "/http/" + serviceCat + "/" + serviceName;
         }
 
+        // Set the endpoint urlPattern so as to map requests from that namespace into
+        // this servlet instance...
+        servlet.getUrlMappings().add(urlMapping);
+        
+        // Add the endpoint address of the servlet...
+        addEndpointAddress(webEndpointConfig, servlet, urlMapping);
+
         // Add the security configurations for the servlet...
         addSecurityConstraints(webEndpointConfig, servlet);
 
         // Map all config tree attributes as servlet parameters...
         servlet.getParams().addAll(webEndpointConfig.attributesAsList());
     }
+    
+    private void addEndpointAddress(ConfigTree webEndpointConfig, Servlet servlet, String urlMapping) {
+        String transportGuarantee = webEndpointConfig.getAttribute(TRANSPORT_GUARANTEE);
+        boolean secure = ( "CONFIDENTIAL".equals(transportGuarantee) || "INTEGRAL".equals(transportGuarantee) );
+        HttpConfiguration httpConfig = HttpConfiguration.getInstance();
+        String path = servlet.getWebModel().getEsbName();
+        path = path.substring(0, path.length() - 4) + urlMapping; // remove ".war" and add urlMapping
+        if (path.endsWith("*")) {
+        	path = path.substring(0, path.length()-1);
+        }
+        String address = ( secure ? httpConfig.getSecureAddress(path) : httpConfig.getAddress(path) );
+       	servlet.setEndpointAddress(address);
+    }
 
     private void addSecurityConstraints(ConfigTree webEndpointConfig, Servlet servlet) {
 
@@ -100,4 +125,4 @@
         }
         return securityConstraints;
     }
-}
\ No newline at end of file
+}

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -21,9 +21,11 @@
  */
 package org.jboss.internal.soa.esb.listeners.war;
 
+import java.util.ArrayList;
 import java.util.List;
-import java.util.ArrayList;
 
+import org.jboss.soa.esb.Service;
+
 /**
  * Servlet configuration model.
  * 
@@ -31,9 +33,11 @@
  */
 public class Servlet extends AbstractWebComponent {
 
+	private Integer loadOnStartup = null;
     private List<String> urlMappings = new ArrayList<String>();
     private SecurityConstraints securityConstraints;
-    private Integer loadOnStartup = null;
+    private Service service = null;
+    private String endpointAddress = null;
 
     public Servlet(String name, String runtimeClass, WebModel webModel) {
         super(name, runtimeClass, webModel);
@@ -59,4 +63,21 @@
     protected void setSecurityConstraints(SecurityConstraints securityConstraints) {
         this.securityConstraints = securityConstraints;
     }
+    
+    public Service getService() {
+    	return service;
+    }
+    
+    public void setService(Service service) {
+    	this.service = service;
+    }
+    
+    public String getEndpointAddress() {
+    	return endpointAddress;
+    }
+    
+    public void setEndpointAddress(String endpointAddress) {
+    	this.endpointAddress = endpointAddress;
+    }
+    
 }

Added: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java	                        (rev 0)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -0,0 +1,90 @@
+/*
+ * 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-2009
+ */
+package org.jboss.internal.soa.esb.publish;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.soa.esb.Service;
+
+/**
+ * Base class for ContractReferenceublisher.
+ * 
+ * @author dward at jboss.org
+ */
+public abstract class AbstractContractReferencePublisher implements ContractReferencePublisher
+{
+	
+	private final Service service;
+	private final String description;
+	
+	public AbstractContractReferencePublisher(Service service, String description)
+	{
+		this.service = service;
+		this.description = description;
+	}
+
+	public final Service getService()
+	{
+		return service;
+	}
+	
+	public final String getDescription()
+	{
+		return description;
+	}
+	
+	public final URI getServiceURI()
+	{
+		String endpointAddress = getEndpointAddress();
+		if (endpointAddress != null)
+		{
+			try
+			{
+				return new URI(endpointAddress);
+			}
+			catch (URISyntaxException use)
+			{
+				// fall through
+			}
+		}
+		return null;
+	}
+	
+	public final URI getServiceContractURI()
+	{
+		String endpointAddress = getEndpointAddress();
+		if (endpointAddress != null)
+		{
+			try
+			{
+				return new URI(endpointAddress + "?wsdl");
+			}
+			catch (URISyntaxException use)
+			{
+				// fall through
+			}
+		}
+		return null;
+	}
+	
+	public abstract String getEndpointAddress();
+
+}


Property changes on: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractInfo.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractInfo.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractInfo.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -29,6 +29,9 @@
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public class ContractInfo {
+	
+	public static final String MIME_TYPE = ContractInfo.class.getName() + ".mimeType";
+	public static final String DATA = ContractInfo.class.getName() + ".data";
 
     private String mimeType;
     private String data;

Added: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java	                        (rev 0)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -0,0 +1,39 @@
+/*
+ * 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-2009
+ */
+package org.jboss.internal.soa.esb.publish;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * ContractProvider.
+ * 
+ * @author dward at jboss.org
+ */
+public interface ContractProvider
+{
+	
+	public void setContractProperties(Properties contractProperties);
+	
+	public ContractInfo provideContract() throws IOException;
+	
+	public ContractInfo provideContract(String endpointAddressOverride) throws IOException;
+	
+}


Property changes on: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java	                        (rev 0)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -0,0 +1,45 @@
+/*
+ * 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-2009
+ */
+package org.jboss.internal.soa.esb.publish;
+
+import org.jboss.soa.esb.Service;
+
+/**
+ * DefaultContractReferencePublisher.
+ * 
+ * @author dward at jboss.org
+ */
+public class DefaultContractReferencePublisher extends AbstractContractReferencePublisher
+{
+	
+	private final String endpointAddress;
+	
+	public DefaultContractReferencePublisher(Service service, String description, String endpointAddress)
+	{
+		super(service, description);
+		this.endpointAddress = endpointAddress;
+	}
+	
+	public final String getEndpointAddress()
+	{
+		return endpointAddress;
+	}
+	
+}


Property changes on: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -45,7 +45,6 @@
 import org.jboss.internal.soa.esb.webservice.AddressingHandler;
 import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
 import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
 import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
 import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
 import org.jboss.mx.util.ObjectNameConverter;

Deleted: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2008, 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.internal.soa.esb.webservice;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
-import org.jboss.soa.esb.Service;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-
-public class ESBServiceContractPublisher implements ContractReferencePublisher {
-	private String address;
-	private final String endpointName;
-	private final Service service ;
-	private final String description ;
-	
-	public ESBServiceContractPublisher(final Service service, final String description, final String jaxwsEndpoint) {
-		this.service = service ;
-		this.description = description ;
-		endpointName = jaxwsEndpoint;
-	}
-	
-    /**
-     * Get the service represented by this contract configuration.
-     * @return The service.
-     */
-    public Service getService() {
-        return service ;
-    }
-    
-    /**
-     * Get the service description represented by this contract configuration.
-     * @return The service description.
-     */
-    public String getDescription() {
-        return description ;
-    }
-    
-    /**
-     * Get the URI of the service.
-     * @return The service URI.
-     */
-    public URI getServiceURI() {
-        final String address = getEndpointAddress() ;
-        if (address != null) {
-            try {
-                return new URI(address) ;
-            } catch (final URISyntaxException urise) {} // fall through
-        }
-        return null ;
-    }
-    
-    /**
-     * Get the URI of the contract.
-     * @return The contract URI.
-     */
-    public URI getServiceContractURI() {
-        final String address = getEndpointAddress() ;
-        if (address != null) {
-            try {
-                return new URI(address+"?wsdl") ;
-            } catch (final URISyntaxException urise) {} // fall through
-        }
-        return null ;
-    }
-
-	private String getEndpointAddress() {
-		if (address != null) {
-			return address;
-		}
-		
-		SPIProvider spiProv = SPIProviderResolver.getInstance().getProvider();
-		EndpointRegistryFactory factory = spiProv
-				.getSPI(EndpointRegistryFactory.class);
-		EndpointRegistry registry = factory.getEndpointRegistry();
-		Set<ObjectName> objectNames = registry.getEndpoints();
-
-		for (ObjectName objectName : objectNames) {
-			String endpoint = objectName
-					.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
-
-			if (endpoint != null && endpoint.equals(endpointName)) {
-				Endpoint ep = registry.getEndpoint(objectName);
-				address = ep.getAddress();
-				return  address;
-			}
-		}
-
-		return null;
-	}
-}

Added: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java	                        (rev 0)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, 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.internal.soa.esb.webservice;
+
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jboss.internal.soa.esb.publish.AbstractContractReferencePublisher;
+import org.jboss.soa.esb.Service;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+
+public class ESBServiceContractReferencePublisher extends AbstractContractReferencePublisher {
+	
+	private final String endpointName;
+	private String endpointAddress;
+	
+	public ESBServiceContractReferencePublisher(Service service, String description, String endpointName) {
+		super(service, description);
+		this.endpointName = endpointName;
+	}
+
+	public String getEndpointAddress() {
+		if (endpointAddress != null) {
+			return endpointAddress;
+		}
+		
+		SPIProvider spiProv = SPIProviderResolver.getInstance().getProvider();
+		EndpointRegistryFactory factory = spiProv
+				.getSPI(EndpointRegistryFactory.class);
+		EndpointRegistry registry = factory.getEndpointRegistry();
+		Set<ObjectName> objectNames = registry.getEndpoints();
+
+		for (ObjectName objectName : objectNames) {
+			String endpoint = objectName
+					.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+
+			if (endpoint != null && endpoint.equals(endpointName)) {
+				Endpoint ep = registry.getEndpoint(objectName);
+				endpointAddress = ep.getAddress();
+				return endpointAddress;
+			}
+		}
+
+		return null;
+	}
+}


Property changes on: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -48,6 +48,10 @@
 			new KeyValuePair(Environment.SMTP_PORT, 					getSmtpPort()),
 			new KeyValuePair(Environment.SMTP_FROM, 					getSmtpFrom()),
 			new KeyValuePair(Environment.SMTP_AUTH, 					getSmtpAuth()),
+			new KeyValuePair(Environment.HTTP_HOST, 					getHttpHost()),
+			new KeyValuePair(Environment.HTTP_PORT, 					getHttpPort()),
+			new KeyValuePair(Environment.HTTP_SECURE_PORT, 				getHttpSecurePort()),
+			new KeyValuePair(Environment.HTTP_RESPONSE_STATUS_ENABLED, 	getHttpResponseStatusEnabled()),
 			new KeyValuePair(Environment.JNDI_SERVER_URL, 				getJndiServerURL()),
 			new KeyValuePair(Environment.JNDI_SERVER_CONTEXT_FACTORY,   getJndiServerContextFactory()),
 			new KeyValuePair(Environment.JNDI_SERVER_PKG_PREFIX, 	    getJndiServerPkgPrefix()),
@@ -122,6 +126,26 @@
 	{
 		return ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.SMTP_AUTH);
 	}
+	
+	public static String getHttpHost()
+	{
+		return ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.HTTP_HOST);
+	}
+	
+	public static String getHttpPort()
+	{
+		return ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.HTTP_PORT);
+	}
+	
+	public static String getHttpSecurePort()
+	{
+		return ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.HTTP_SECURE_PORT);
+	}
+	
+	public static String getHttpResponseStatusEnabled()
+	{
+		return ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.HTTP_RESPONSE_STATUS_ENABLED);
+	}
 
 	public static String getJndiServerURL()
 	{

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -50,6 +50,11 @@
         public static final String SMTP_FROM     = "org.jboss.soa.esb.mail.smtp.from";
         public static final String SMTP_AUTH     = "org.jboss.soa.esb.mail.smtp.auth";
 
+		public static final String HTTP_HOST = "org.jboss.soa.esb.http.host";
+		public static final String HTTP_PORT = "org.jboss.soa.esb.http.port";
+		public static final String HTTP_SECURE_PORT = "org.jboss.soa.esb.http.securePort";
+		public static final String HTTP_RESPONSE_STATUS_ENABLED = "org.jboss.soa.esb.http.responseStatusEnabled";
+
         public static final String FTP_LOCALDIR  = "org.jboss.soa.esb.ftp.localdir";
         public static final String FTP_REMOTEDIR = "org.jboss.soa.esb.ftp.remotedir";
         public static final String FTP_SOCKET_TIMEOUT = "org.jboss.soa.esb.ftp.timeout";

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -79,6 +79,18 @@
         this.propertyFile = propertyFile ;
     }
     
+    public static String getBindAddress()
+    {
+        String esbBindAddress = System.getProperty(Environment.ESB_BIND_ADDRESS) ;
+        if (esbBindAddress == null)
+        {
+            String serverBindAddress = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS) ;
+            esbBindAddress = JBossESBPropertyService.fixRemoteAddress(serverBindAddress) ;
+            System.setProperty(Environment.ESB_BIND_ADDRESS, esbBindAddress) ;
+        }
+        return esbBindAddress;
+    }
+    
     private static String fixRemoteAddress(final String address)
     {
         try
@@ -100,13 +112,8 @@
     protected void createService()
         throws Exception
     {
-        final String bindHost = System.getProperty(Environment.ESB_BIND_ADDRESS) ;
-        if (bindHost == null)
-        {
-            final String bindAddress = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS) ;
-            final String esbBindAddress = JBossESBPropertyService.fixRemoteAddress(bindAddress) ;
-            System.setProperty(Environment.ESB_BIND_ADDRESS, esbBindAddress) ;
-        }
+    	// initialize ${jboss.esb.bind.address}
+        getBindAddress();
         
         if (propertyFile != null)
         {

Added: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java	                        (rev 0)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -0,0 +1,276 @@
+/*
+ * 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-2009
+ */
+package org.jboss.soa.esb.http;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Set;
+
+import javax.management.AttributeNotFoundException;
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.common.JBossESBPropertyService;
+
+/**
+ * HttpConfiguration.
+ * 
+ * @author dward at jboss.org
+ */
+public class HttpConfiguration
+{
+	
+	private static final Logger logger = Logger.getLogger(HttpConfiguration.class);
+	
+	private static HttpConfiguration INSTANCE = null;
+	
+	public static HttpConfiguration getInstance()
+	{
+		if (INSTANCE == null)
+		{
+			synchronized(HttpConfiguration.class)
+			{
+				if (INSTANCE == null)
+				{
+					INSTANCE = new HttpConfiguration( MBeanServerLocator.locateJBoss() );
+				}
+			}
+		}
+		return INSTANCE;
+	}
+	
+	private MBeanServer mbeanServer;
+	
+	private HttpConfiguration(MBeanServer mbeanServer)
+	{
+		this.mbeanServer = mbeanServer;
+	}
+	
+	public String getHost()
+	{
+		return getHost(Environment.DEFAULT_HOST);
+	}
+	
+	public String getHost(String defaultValue)
+	{
+		String global = Configuration.getHttpHost();
+		if (global != null)
+		{
+			return global;
+		}
+		String bindAddress = JBossESBPropertyService.getBindAddress();
+		if (bindAddress != null)
+		{
+			return bindAddress;
+		}
+		return defaultValue;
+	}
+	
+	public int getPort()
+	{
+		return getPort(8080);
+	}
+	
+	public int getPort(int defaultValue)
+	{
+		String global = Configuration.getHttpPort();
+		if (global != null)
+		{
+			return Integer.valueOf(global).intValue();
+		}
+		int port = getConnectorPort("HTTP/1.1", false);
+		if (port > -1)
+		{
+			return port;
+		}
+		return defaultValue;
+	}
+	
+	public int getSecurePort()
+	{
+		return getSecurePort(8443);
+	}
+	
+	public int getSecurePort(int defaultValue)
+	{
+		String global = Configuration.getHttpSecurePort();
+		if (global != null)
+		{
+			return Integer.valueOf(global).intValue();
+		}
+		int port = getConnectorPort("HTTP/1.1", true);
+		if (port > -1)
+		{
+			return port;
+		}
+		return defaultValue;
+	}
+	
+	private int getConnectorPort(String protocol, boolean secure)
+	{
+		int port = -1;
+		try
+		{
+			Set<?> connectorNames = mbeanServer.queryNames(new ObjectName("jboss.web:type=Connector,*"), null);
+			for (Object current : connectorNames)
+			{
+				ObjectName currentName = (ObjectName)current;
+				try
+				{
+					int connectorPort = (Integer)mbeanServer.getAttribute(currentName, "port");
+					boolean connectorSecure = (Boolean)mbeanServer.getAttribute(currentName, "secure");
+					String connectorProtocol = (String)mbeanServer.getAttribute(currentName, "protocol");
+					if (protocol.equals(connectorProtocol) && secure == connectorSecure)
+					{
+						if (port > -1)
+						{
+							logger.warn("Found multiple connectors for protocol='" + protocol + "' and secure='" + secure + "', using first port found '" + port + "'");
+						}
+						else
+						{
+							port = connectorPort;
+						}
+					}
+				}
+				catch (AttributeNotFoundException ignored) {}
+			}
+		}
+		catch (JMException ignored)
+		{
+			port = -1;
+		}
+		return port;
+	}
+	
+	public String getAddress()
+	{
+		return buildAddress(null, false);
+	}
+	
+	public String getAddress(String path)
+	{
+		return buildAddress(path, false);
+	}
+	
+	public String getSecureAddress()
+	{
+		return buildAddress(null, true);
+	}
+	
+	public String getSecureAddress(String path)
+	{
+		return buildAddress(path, true);
+	}
+	
+	private String buildAddress(String path, boolean secure)
+	{
+		StringBuilder sb = new StringBuilder();
+		if (secure)
+		{
+			sb.append( "https://" );
+			sb.append( getHost() );
+			sb.append( ":" );
+			sb.append( getSecurePort() );
+		}
+		else
+		{
+			sb.append( "http://" );
+			sb.append( getHost() );
+			sb.append( ":" );
+			sb.append( getPort() );
+		}
+		if (path != null)
+		{
+			path = path.trim();
+			if (path.length() > 0)
+			{
+				if ( !path.startsWith("/") )
+				{
+					sb.append("/");
+				}
+				sb.append(path);
+			}
+		}
+		return sb.toString();
+	}
+	
+	public URL getURL() throws MalformedURLException
+	{
+		return new URL( getAddress() );
+	}
+	
+	public URL getURL(String path) throws MalformedURLException
+	{
+		return new URL( getAddress(path) );
+	}
+	
+	public URL getSecureURL() throws MalformedURLException
+	{
+		return new URL( getSecureAddress() );
+	}
+	
+	public URL getSecureURL(String path) throws MalformedURLException
+	{
+		return new URL( getSecureAddress(path) );
+	}
+	
+	public URI getURI() throws URISyntaxException
+	{
+		return new URI( getAddress() );
+	}
+	
+	public URI getURI(String path) throws URISyntaxException
+	{
+		return new URI( getAddress(path) );
+	}
+	
+	public URI getSecureURI() throws URISyntaxException
+	{
+		return new URI( getSecureAddress() );
+	}
+	
+	public URI getSecureURI(String path) throws URISyntaxException
+	{
+		return new URI( getSecureAddress(path) );
+	}
+	
+	public boolean isResponseStatusEnabled()
+	{
+		return isResponseStatusEnabled(true);
+	}
+	
+	public boolean isResponseStatusEnabled(boolean defaultValue)
+	{
+		String global = Configuration.getHttpResponseStatusEnabled();
+		if (global != null)
+		{
+			return Boolean.valueOf(global).booleanValue();
+		}
+		return defaultValue;
+	}
+
+}


Property changes on: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -21,44 +21,63 @@
 */
 package org.jboss.soa.esb.listeners.config;
 
-import java.io.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
 import java.util.Map.Entry;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
+import javax.management.JMException;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.JMException;
 
 import org.jboss.deployment.DeploymentException;
 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.ContractInfo;
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.publish.DefaultContractReferencePublisher;
 import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
 import org.jboss.internal.soa.esb.util.StreamUtils;
 import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
 import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
+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.listeners.war.*;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.MetaData;
 import org.jboss.metadata.XmlFileLoader;
 import org.jboss.mx.loading.LoaderRepositoryFactory;
 import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.mx.util.ObjectNameConverter;
+import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
 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.DeploymentArchive;
 import org.jboss.system.ServiceControllerMBean;
 import org.jboss.web.AbstractWebContainer;
 import org.w3c.dom.Element;
@@ -468,7 +487,7 @@
                            new Filter(serviceInfo.getServletName() + "_Filter", ESBResponseFilter.class.getName(), servlet);
                        }
 
-                       final ContractReferencePublisher publisher = new ESBServiceContractPublisher(service, webserviceInfo.getDescription(), serviceInfo.getServletName()) ;
+                       final ContractReferencePublisher publisher = new ESBServiceContractReferencePublisher(service, webserviceInfo.getDescription(), serviceInfo.getServletName()) ;
                        publishers.add(publisher) ;
                    }
                }
@@ -500,6 +519,35 @@
 
         // Add a sub-deloyment for the web model...
         if(!webModel.getServlets().isEmpty()) {
+        	
+            // Add the contract and ContractReferencePublisher...
+        	List<ServiceContract> serviceContractList = model.getServiceContracts();
+        	if (serviceContractList != null && serviceContractList.size() > 0) {
+	            for (Servlet servlet : webModel.getServlets()) {
+	            	Service service = servlet.getService();
+	            	String endpointAddress = servlet.getEndpointAddress();
+	            	if (service != null && endpointAddress != null) {
+	            		for (ServiceContract serviceContract : serviceContractList) {
+	            			if (service.equals(serviceContract.getService())) {
+	            				ContractInfo contract;
+	            				try {
+	            					contract = serviceContract.getContractProvider().provideContract(endpointAddress);
+	            				} catch (IOException ioe) {
+	            					throw new DeploymentException(ioe);
+	            				}
+	            				String mimeType = "<![CDATA[" + contract.getMimeType() + "]]>";
+	            				String data = "<![CDATA[" + contract.getData() + "]]>";
+	            				servlet.getParams().add(new KeyValuePair(ContractInfo.MIME_TYPE, mimeType));
+	            				servlet.getParams().add(new KeyValuePair(ContractInfo.DATA, data));
+	            				publishers.add(
+	            					new DefaultContractReferencePublisher(
+	            						service, serviceContract.getDescription(), endpointAddress ) );
+	            			}
+	            		}
+	            	}
+	            }
+        	}
+            
             // Finalize the webDeployment...
             webDeployment.finalizeArchive();
 
@@ -511,7 +559,7 @@
                 // Maintain a list of sub deployments so we can clean them
                 // up on undeploy...
                 getSubDeployments(di).add(file);
-            } catch (Throwable throwable        ) {
+            } catch (Throwable throwable) {
                 if(file.exists()) {
                     file.delete();
                 }

Added: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java	                        (rev 0)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -0,0 +1,59 @@
+/*
+ * 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-2009
+ */
+package org.jboss.soa.esb.listeners.config;
+
+import org.jboss.internal.soa.esb.publish.ContractProvider;
+import org.jboss.soa.esb.Service;
+
+/**
+ * ServiceContract.
+ * 
+ * @author dward at jboss.org
+ */
+public class ServiceContract
+{
+	
+	private final Service service;
+	private final String description;
+	private final ContractProvider contractProvider;
+	
+	public ServiceContract(Service service, String description, ContractProvider contractProvider)
+	{
+		this.service = service;
+		this.description = description;
+		this.contractProvider = contractProvider;
+	}
+	
+	public Service getService()
+	{
+		return service;
+	}
+	
+	public String getDescription()
+	{
+		return description;
+	}
+	
+	public ContractProvider getContractProvider()
+	{
+		return contractProvider;
+	}
+
+}


Property changes on: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -31,17 +31,18 @@
 import java.util.Set;
 
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
+import org.jboss.internal.soa.esb.publish.ContractProvider;
 import org.jboss.internal.soa.esb.publish.ContractPublisher;
 import org.jboss.internal.soa.esb.publish.Publish;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.common.Environment;
 import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.jboss.soa.esb.listeners.config.xbeanmodel101.AbstractScheduledListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel101.Bus;
 import org.jboss.soa.esb.listeners.config.xbeanmodel101.BusProvider;
-import org.jboss.soa.esb.listeners.config.xbeanmodel101.JbossesbDocument;
 import org.jboss.soa.esb.listeners.config.xbeanmodel101.JcaGatewayDocument;
 import org.jboss.soa.esb.listeners.config.xbeanmodel101.Listener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel101.ListenersDocument;
@@ -533,4 +534,50 @@
         }
         return endpointServices ;
     }
+    
+    public List<ServiceContract> getServiceContracts()
+    {
+        final List<ServiceContract> serviceContractList = new ArrayList<ServiceContract>() ;
+        final Services services = jbossesb.getServices() ;
+        if (services != null)
+        {
+            for(final Service service : services.getServiceList())
+            {
+                final Actions actions = service.getActions() ;
+                if (actions != null)
+                {
+                	for (Action action : actions.getActionList())
+                	{
+                        Class<?> actionClass;
+                        try {
+                            actionClass = (Class<?>) ClassUtil.forName(action.getClass1(), ServicePublisher.class);
+                        } catch (ClassNotFoundException e) {
+                            throw new RuntimeException("Failed to find action class '" + action.getClass1() + "'.", e);
+                        }
+                        Publish publishAnnotation = (Publish)actionClass.getAnnotation(Publish.class);
+                        if (publishAnnotation != null) {
+                        	Class<?> publisherClass = publishAnnotation.value();
+                        	if (ContractProvider.class.isAssignableFrom(publisherClass)) {
+                        		ContractProvider provider;
+                        		try {
+	                        		provider = (ContractProvider)publisherClass.newInstance();
+	                        		Properties properties = toProperties(action.getPropertyList());
+	                        		provider.setContractProperties(properties);
+                        		} catch (Exception e) {
+                        			throw new RuntimeException("Failed to create ContractProvider", e);
+                        		}
+	                        	ServiceContract serviceContract = new ServiceContract(
+	                        		new org.jboss.soa.esb.Service(service.getCategory(), service.getName()),
+	                        		service.getDescription(),
+	                        		provider
+	                        	);
+	                        	serviceContractList.add(serviceContract);
+                        	}
+                        }
+                	}
+                }
+            }
+        }
+        return serviceContractList;
+    }
 }

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -31,17 +31,18 @@
 import java.util.Set;
 
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
+import org.jboss.internal.soa.esb.publish.ContractProvider;
 import org.jboss.internal.soa.esb.publish.ContractPublisher;
 import org.jboss.internal.soa.esb.publish.Publish;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.common.Environment;
 import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.jboss.soa.esb.listeners.config.xbeanmodel110.AbstractScheduledListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel110.Bus;
 import org.jboss.soa.esb.listeners.config.xbeanmodel110.BusProvider;
-import org.jboss.soa.esb.listeners.config.xbeanmodel110.JbossesbDocument;
 import org.jboss.soa.esb.listeners.config.xbeanmodel110.JcaGatewayDocument;
 import org.jboss.soa.esb.listeners.config.xbeanmodel110.Listener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel110.ListenersDocument;
@@ -534,4 +535,50 @@
         }
         return endpointServices ;
     }
+    
+    public List<ServiceContract> getServiceContracts()
+    {
+        final List<ServiceContract> serviceContractList = new ArrayList<ServiceContract>() ;
+        final Services services = jbossesb.getServices() ;
+        if (services != null)
+        {
+            for(final Service service : services.getServiceList())
+            {
+                final Actions actions = service.getActions() ;
+                if (actions != null)
+                {
+                	for (Action action : actions.getActionList())
+                	{
+                        Class<?> actionClass;
+                        try {
+                            actionClass = (Class<?>) ClassUtil.forName(action.getClass1(), ServicePublisher.class);
+                        } catch (ClassNotFoundException e) {
+                            throw new RuntimeException("Failed to find action class '" + action.getClass1() + "'.", e);
+                        }
+                        Publish publishAnnotation = (Publish)actionClass.getAnnotation(Publish.class);
+                        if (publishAnnotation != null) {
+                        	Class<?> publisherClass = publishAnnotation.value();
+                        	if (ContractProvider.class.isAssignableFrom(publisherClass)) {
+                        		ContractProvider provider;
+                        		try {
+	                        		provider = (ContractProvider)publisherClass.newInstance();
+	                        		Properties properties = toProperties(action.getPropertyList());
+	                        		provider.setContractProperties(properties);
+                        		} catch (Exception e) {
+                        			throw new RuntimeException("Failed to create ContractProvider", e);
+                        		}
+	                        	ServiceContract serviceContract = new ServiceContract(
+	                        		new org.jboss.soa.esb.Service(service.getCategory(), service.getName()),
+	                        		service.getDescription(),
+	                        		provider
+	                        	);
+	                        	serviceContractList.add(serviceContract);
+                        	}
+                        }
+                	}
+                }
+            }
+        }
+        return serviceContractList;
+    }
 }

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -31,14 +31,25 @@
 import java.util.Set;
 
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
+import org.jboss.internal.soa.esb.publish.ContractProvider;
 import org.jboss.internal.soa.esb.publish.ContractPublisher;
 import org.jboss.internal.soa.esb.publish.Publish;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.common.Environment;
 import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
-import org.jboss.soa.esb.listeners.config.xbeanmodel120.*;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.AbstractScheduledListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.Bus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.BusProvider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.DualListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.GatewayOnlyListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.Listener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.ListenersDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.MepType;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.Provider;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.Schedule;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.ActionDocument.Action;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.ActionsDocument.Actions;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.GlobalsDocument.Globals;
@@ -577,6 +588,52 @@
         return endpointServices ;
     }
     
+    public List<ServiceContract> getServiceContracts()
+    {
+        final List<ServiceContract> serviceContractList = new ArrayList<ServiceContract>() ;
+        final Services services = jbossesb.getServices() ;
+        if (services != null)
+        {
+            for(final Service service : services.getServiceList())
+            {
+                final Actions actions = service.getActions() ;
+                if (actions != null)
+                {
+                	for (Action action : actions.getActionList())
+                	{
+                        Class<?> actionClass;
+                        try {
+                            actionClass = (Class<?>) ClassUtil.forName(action.getClass1(), ServicePublisher.class);
+                        } catch (ClassNotFoundException e) {
+                            throw new RuntimeException("Failed to find action class '" + action.getClass1() + "'.", e);
+                        }
+                        Publish publishAnnotation = (Publish)actionClass.getAnnotation(Publish.class);
+                        if (publishAnnotation != null) {
+                        	Class<?> publisherClass = publishAnnotation.value();
+                        	if (ContractProvider.class.isAssignableFrom(publisherClass)) {
+                        		ContractProvider provider;
+                        		try {
+	                        		provider = (ContractProvider)publisherClass.newInstance();
+	                        		Properties properties = toProperties(action.getPropertyList());
+	                        		provider.setContractProperties(properties);
+                        		} catch (Exception e) {
+                        			throw new RuntimeException("Failed to create ContractProvider", e);
+                        		}
+	                        	ServiceContract serviceContract = new ServiceContract(
+	                        		new org.jboss.soa.esb.Service(service.getCategory(), service.getName()),
+	                        		service.getDescription(),
+	                        		provider
+	                        	);
+	                        	serviceContractList.add(serviceContract);
+                        	}
+                        }
+                	}
+                }
+            }
+        }
+        return serviceContractList;
+    }
+    
     public String getAuthDomain()
     {
         WarSecurity warSecurity = getWarSecurity();

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -31,6 +31,7 @@
 import org.apache.xmlbeans.XmlException;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.jboss.soa.esb.listeners.config.mappers.XMLBeansModel;
@@ -156,6 +157,15 @@
         {
             return model.getWebserviceServices() ;
         }
+        
+        /**
+         * Get the list of service contracts.
+         * @return The list of service contracts.
+         */
+        public List<ServiceContract> getServiceContracts()
+        {
+            return model.getServiceContracts() ;
+        }
 
         /**
          * This feature in not implemented in the 1.0.1 version of the schema.

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -31,6 +31,7 @@
 import org.apache.xmlbeans.XmlException;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.jboss.soa.esb.listeners.config.mappers110.XMLBeansModel;
@@ -155,6 +156,15 @@
         {
             return model.getWebserviceServices() ;
         }
+        
+        /**
+         * Get the list of service contracts.
+         * @return The list of service contracts.
+         */
+        public List<ServiceContract> getServiceContracts()
+        {
+            return model.getServiceContracts() ;
+        }
 
         /**
          * This feature in not implemented in the 1.0.1 version of the schema.

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -30,6 +30,7 @@
 import org.apache.xmlbeans.XmlException;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.jboss.soa.esb.listeners.config.mappers120.XMLBeansModel;
@@ -154,6 +155,15 @@
         {
             return model.getWebserviceServices() ;
         }
+        
+        /**
+         * Get the list of service contracts.
+         * @return The list of service contracts.
+         */
+        public List<ServiceContract> getServiceContracts()
+        {
+            return model.getServiceContracts() ;
+        }
 
         public String getAuthDomain()
         {

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -27,6 +27,7 @@
 
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.ServicePublisher;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
 import org.w3c.dom.Document;
@@ -81,6 +82,12 @@
     public List<WebserviceInfo> getWebserviceServices() ;
     
     /**
+     * Get the list of service contracts.
+     * @return The list of service contracts.
+     */
+    public List<ServiceContract> getServiceContracts() ;
+    
+    /**
      * Gets the global authentication domain.
      * 
      * @return String The name of the authentication domain.

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -20,6 +20,7 @@
  */
 package org.jboss.soa.esb.listeners.deployers.mc;
 
+import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -30,31 +31,44 @@
 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.ContractInfo;
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.publish.DefaultContractReferencePublisher;
 import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
 import org.jboss.internal.soa.esb.webservice.ESBResponseFilter;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
+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.internal.soa.esb.listeners.war.WebModel;
-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.SecurityConstraints;
 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.javaee.spec.SecurityRoleMetaData;
 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.*;
+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.ConfigurationException;
 import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.listeners.config.ModelUtil;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
 import org.jboss.soa.esb.listeners.config.WebserviceInfo;
-import org.jboss.soa.esb.listeners.config.ModelUtil;
 import org.jboss.soa.esb.listeners.deployers.mc.util.VfsUtil;
 import org.jboss.virtual.MemoryFileFactory;
 import org.jboss.virtual.VirtualFile;
@@ -197,7 +211,7 @@
                     description.setWsdlPublishLocation(serviceInfo.getWSDLFileName());
                     descriptions.add(description);
                     
-                    final ContractReferencePublisher publisher = new ESBServiceContractPublisher(service, wsInfo.getDescription(), serviceInfo.getServletName());
+                    final ContractReferencePublisher publisher = new ESBServiceContractReferencePublisher(service, wsInfo.getDescription(), serviceInfo.getServletName());
                     publishers.add(publisher);
                 }
             }
@@ -221,6 +235,34 @@
             throw new DeploymentException("Failed to capture web metadata from ESB configuration.", e);
         }
         
+        // Add the contract and ContractReferencePublisher..
+        final List<ServiceContract> serviceContractList = esbMetaData.getModel().getServiceContracts();
+    	if (serviceContractList != null && serviceContractList.size() > 0) {
+            for (Servlet servlet : webModel.getServlets()) {
+            	Service service = servlet.getService();
+            	String endpointAddress = servlet.getEndpointAddress();
+            	if (service != null && endpointAddress != null) {
+            		for (ServiceContract serviceContract : serviceContractList) {
+            			if (service.equals(serviceContract.getService())) {
+            				ContractInfo contract;
+            				try {
+            					contract = serviceContract.getContractProvider().provideContract(endpointAddress);
+            				} catch (IOException ioe) {
+            					throw new DeploymentException(ioe);
+            				}
+            				String mimeType = "<![CDATA[" + contract.getMimeType() + "]]>";
+            				String data = "<![CDATA[" + contract.getData() + "]]>";
+            				servlet.getParams().add(new KeyValuePair(ContractInfo.MIME_TYPE, mimeType));
+            				servlet.getParams().add(new KeyValuePair(ContractInfo.DATA, data));
+            				publishers.add(
+            					new DefaultContractReferencePublisher(
+            						service, serviceContract.getDescription(), endpointAddress ) );
+            			}
+            		}
+            	}
+            }
+    	}
+        
         // Add the filters...
         for(Filter filter : webModel.getFilters()) {
             webMetaDataCreated = true;

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -19,34 +19,37 @@
  */
 package org.jboss.soa.esb.listeners.gateway.http;
 
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.publish.ContractInfo;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.http.HttpServletSecUtil;
-import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.client.ServiceInvoker;
 import org.jboss.soa.esb.couriers.FaultMessageException;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.security.auth.ws.WSSecurityInfoExtractor;
-import org.jboss.soa.esb.services.security.PublicCryptoUtil;
-import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.listeners.message.MessageComposer;
+import org.jboss.soa.esb.http.HttpServletSecUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.mappers120.HttpGatewayMapper;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.apache.log4j.Logger;
+import org.jboss.soa.esb.listeners.message.MessageComposer;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.security.PublicCryptoUtil;
+import org.jboss.soa.esb.util.ClassUtil;
 
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import javax.servlet.ServletConfig;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.Map;
-
 /**
  * Http Gateway Servlet.
  * <p/>
@@ -70,6 +73,9 @@
 
     private Service service;
     private ServiceInvoker serviceInvoker;
+    private String contractMimeType;
+    private String contractData;
+    private boolean contractAvailable = false;
     private boolean asyncInvoke;
     private int asyncStatusCode = HttpServletResponse.SC_OK;
     private byte[] asyncPayload;
@@ -86,7 +92,13 @@
         } catch (MessageDeliverException e) {
             throw new ServletException("Unable to create ServiceInvoker for Service '" + service + "'.", e);
         }
-
+        
+        contractMimeType = config.getInitParameter(ContractInfo.MIME_TYPE);
+        contractData = config.getInitParameter(ContractInfo.DATA);
+        if (contractMimeType != null && contractMimeType.length() > 0 && contractData != null && contractData.length() > 0) {
+        	contractAvailable = true;
+        }
+        
         ConfigTree configTree = toConfigTree(config);
         try {
             messageComposer = MessageComposer.Factory.getInstance(configTree.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG, HttpMessageComposer.class.getName()), configTree);
@@ -130,6 +142,17 @@
     }
 
     protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+    	// if it's a wsdl request and we have contract to serve, serve it then short-circuit
+    	if (contractAvailable && "wsdl".equalsIgnoreCase(req.getQueryString())) {
+    		resp.setCharacterEncoding("UTF-8");
+    		resp.setContentType(contractMimeType);
+    		resp.setContentLength(contractData.length());
+    		Writer writer = new BufferedWriter(resp.getWriter());
+    		writer.write(contractData);
+    		writer.flush();
+    		return;
+    	}
+    	
         HttpRequestWrapper wrapper = new HttpRequestWrapper(req, resp, service);
 
         Message inMessage;

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -20,8 +20,8 @@
 package org.jboss.soa.esb.message;
 
 import org.jboss.remoting.transport.http.HTTPMetadataConstants;
-import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.http.HttpConfiguration;
 import org.jboss.soa.esb.listeners.gateway.HttpMessageComposer;
 
 /**
@@ -48,21 +48,13 @@
 public class ResponseStatus
 {
 
-	public static final String ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG = "http.responseStatusEnabled";
-	public static final String GLOBAL_HTTP_RESPONSE_STATUS_ENABLED_CONFIG = "org.jboss.soa.esb." + ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG;
-
-	private static boolean GLOBAL_HTTP_RESPONSE_STATUS_ENABLED;
-	static {
-		GLOBAL_HTTP_RESPONSE_STATUS_ENABLED =
-			ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE)
-				.getProperty(GLOBAL_HTTP_RESPONSE_STATUS_ENABLED_CONFIG, "true").equals("true");
-	}
-
 	private ResponseStatus() {}
 
 	// JBESB-2761
 	public static boolean isHttpEnabled(ConfigTree actionConfig) {
-		return actionConfig.getBooleanAttribute(ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG, GLOBAL_HTTP_RESPONSE_STATUS_ENABLED);
+		return actionConfig.getBooleanAttribute(
+				"http.responseStatusEnabled",
+				HttpConfiguration.getInstance().isResponseStatusEnabled() );
 	}
 
 	// JBESB-2761

Modified: labs/jbossesb/workspace/dward/httpcontract/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -7,7 +7,7 @@
 import junit.framework.TestCase;
 
 import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractReferencePublisher;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
@@ -67,7 +67,7 @@
         
         assertEquals("Service count", 4, ServicePublisher.getServices().size());
 
-        final ESBServiceContractPublisher publisher = new ESBServiceContractPublisher(new Service("C", "3"), "test", "endpoint") ;
+        final ESBServiceContractReferencePublisher publisher = new ESBServiceContractReferencePublisher(new Service("C", "3"), "test", "endpoint") ;
         ServicePublisher.addContractReferencePublishers(controller2, Arrays.asList(publisher)) ;
         assertEquals("C3", 2, ServicePublisher.getServicePublishers(new Service("C", "3")).size()) ;
         

Modified: labs/jbossesb/workspace/dward/httpcontract/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml	2009-10-08 14:57:27 UTC (rev 29559)
@@ -2,9 +2,8 @@
 <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
 
 	<globals>
-        <!-- Security setting for all http-providers and all EBWSs in this jboss-esb.xml file.-->
-        <war-security method="BASIC" domain="JBossWS" /> <!-- uname: "kermit" pw: "thefrog" -->
-    </globals>
+		<war-security method="BASIC" domain="java:/jaas/JBossWS" />
+	</globals>
 
 	<providers>
 		<http-provider name="HTTP-PROVIDER">
@@ -20,6 +19,7 @@
 		<service category="Proxy_Security" name="Proxy"
 				 description="Security WebService Proxy"
 				 invmScope="GLOBAL">
+			<security moduleName="JBossWS" />
 			<listeners>
 				<http-gateway name="HTTP-GATEWAY" busidref="HTTP-BUS" urlPattern="ProxyWS/*" />
 			</listeners>

Modified: labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -85,6 +85,13 @@
     public Properties getActionProperties() {
         return actionProperties;
     }
+    
+    /**
+     * Set the action properties.
+     */
+    protected void setActionProperties(Properties actionProperties) {
+    	this.actionProperties = actionProperties;
+    }
 
     /**
      * Get the WSDL Address.

Modified: labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -22,10 +22,15 @@
 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import java.util.Properties;
 
+import org.jboss.internal.soa.esb.publish.ContractInfo;
+import org.jboss.internal.soa.esb.publish.ContractProvider;
 import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.actions.soap.AuthBASICWsdlContractPublisher;
+import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.helpers.ConfigTree;
 
 /**
@@ -33,18 +38,19 @@
  * 
  * @author dward at jboss.org
  */
-public class SOAPProxyWsdlContractPublisher extends AuthBASICWsdlContractPublisher
+public class SOAPProxyWsdlContractPublisher extends AuthBASICWsdlContractPublisher implements ContractProvider
 {
 	
 	@Override
 	public String getWsdl(String wsdlAddress) throws IOException
 	{
+		String wsdl;
+		Properties properties = getActionProperties();
 		ConfigTree config = new ConfigTree("config");
-		Properties props = getActionProperties();
-		for ( Object key : props.keySet() )
+		for ( Object key : properties.keySet() )
 		{
 			String name = (String)key;
-			String value = props.getProperty(name);
+			String value = properties.getProperty(name);
 			config.setAttribute(name, value);
 		}
 		SOAPProxyWsdlLoader loader = SOAPProxyWsdlLoader.newLoader(config);
@@ -52,13 +58,48 @@
 		try
 		{
 			is = new BufferedInputStream( loader.getURL().openStream() );
-			return StreamUtils.readStreamString(is, "UTF-8");
+			wsdl = StreamUtils.readStreamString(is, "UTF-8");
 		}
 		finally
 		{
 			try { if (is != null) is.close(); } catch (Throwable t) {}
 			loader.cleanup();
 		}
+		return wsdl;
 	}
 	
+	public void setContractProperties(Properties contractProperties)
+	{
+		setActionProperties(contractProperties);
+	}
+	
+	public ContractInfo provideContract() throws IOException
+	{
+		return provideContract(null);
+	}
+	
+	public ContractInfo provideContract(String endpointAddressOverride) throws IOException
+	{
+		String wsdl;
+		Properties properties = getActionProperties();
+		if (endpointAddressOverride != null)
+		{
+			try
+			{
+				initializeTransformer();
+			}
+			catch (ConfigurationException ce)
+			{
+				throw new IOException( ce.getMessage() );
+			}
+			ContractInfo info = getContractInfo( new EPR(URI.create(endpointAddressOverride)) );
+			wsdl = info.getData();
+		}
+		else
+		{
+			wsdl = getWsdl( properties.getProperty("wsdl") );
+		}
+		return new ContractInfo("text/xml", wsdl);
+	}
+	
 }

Modified: labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java	2009-10-08 14:57:27 UTC (rev 29559)
@@ -29,8 +29,11 @@
 import java.net.URL;
 import java.util.Properties;
 
+import javax.management.JMException;
+import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.actions.soap.AuthBASICWsdlContractPublisher;
 import org.jboss.soa.esb.helpers.ConfigTree;
@@ -51,15 +54,43 @@
 public abstract class SOAPProxyWsdlLoader
 {
 	
-	public abstract URL getURL() throws MalformedURLException;
+	private File tempDir = null;
 	
-	public void cleanup() {}
+	private File getTempDir() throws IOException
+	{
+		if (tempDir == null)
+		{
+			synchronized (SOAPProxyWsdlLoader.class)
+			{
+				if (tempDir == null)
+				{
+					MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+					try
+					{
+						tempDir = (File)mbeanServer.getAttribute(new ObjectName("jboss.system:type=ServerConfig"), "ServerTempDir");
+					}
+					catch (JMException ignored) {}
+					if ( tempDir == null || !tempDir.exists() )
+					{
+						File tempFile = File.createTempFile(SOAPProxyWsdlLoader.class.getName() + "-", ".tmp");
+						tempDir = tempFile.getParentFile();
+						tempFile.delete();
+					}
+				}
+			}
+		}
+		return tempDir;
+	}
 	
 	public File createTempFile() throws IOException
 	{
-		return File.createTempFile(SOAPProxyWsdlLoader.class.getName() + "-", ".wsdl");
+		return File.createTempFile( SOAPProxyWsdlLoader.class.getName() + "-", ".wsdl", getTempDir() );
 	}
 	
+	public abstract URL getURL() throws MalformedURLException;
+	
+	public void cleanup() {}
+	
 	public static WSDLDefinitions loadDefinitions(ConfigTree config) throws IOException
 	{
 		SOAPProxyWsdlLoader loader = newLoader(config);
@@ -103,7 +134,7 @@
 		{
 			return new InternalSOAPProxyWsdlLoader( address.substring(11, address.length()) );
 		}
-		throw new IOException("unrecognized wsdl location: " + address);
+		throw new IOException("unrecognized wsdl address: " + address);
 	}
 	
 	private static class HttpSOAPProxyWsdlLoader extends SOAPProxyWsdlLoader

Modified: labs/jbossesb/workspace/dward/httpcontract/product/tools/console/contract-web/src/main/webapp/index.jsp
===================================================================
--- labs/jbossesb/workspace/dward/httpcontract/product/tools/console/contract-web/src/main/webapp/index.jsp	2009-10-08 14:54:11 UTC (rev 29558)
+++ labs/jbossesb/workspace/dward/httpcontract/product/tools/console/contract-web/src/main/webapp/index.jsp	2009-10-08 14:57:27 UTC (rev 29559)
@@ -82,7 +82,7 @@
                         final URI serviceContractURI = contractReferencePublisher.getServiceContractURI() ;
     %>
          <fieldset>
-            <legend><b><%=serviceURI.getScheme()%></b></legend>
+            <legend><b><%=serviceURI.getScheme().toUpperCase()%></b></legend>
 
             <ul>
                 <li><b>Endpoint</b>: <%=serviceURI%></li>



More information about the jboss-svn-commits mailing list