[jboss-svn-commits] JBL Code SVN: r29581 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/internal/soa/esb/publish and 22 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 12 11:55:31 EDT 2009
Author: dward
Date: 2009-10-12 11:55:30 -0400 (Mon, 12 Oct 2009)
New Revision: 29581
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProviderLifecycleResource.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java
Removed:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/readme.txt
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java
labs/jbossesb/trunk/product/tools/console/contract-web/src/main/webapp/index.jsp
Log:
Fix for https://jira.jboss.org/jira/browse/JBESB-2822
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -19,10 +19,13 @@
*/
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.helpers.KeyValuePair;
+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 +43,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) );
+ String path = servlet.getWebModel().getEsbName();
+ path = path.substring(0, path.length() - 4) + urlMapping; // remove ".war" and add urlMapping
+ while (path.endsWith("*") || path.endsWith("/")) {
+ path = path.substring(0, path.length()-1);
+ }
+ String address = ( secure ? HttpConfiguration.getSecureAddress(path) : HttpConfiguration.getAddress(path) );
+ servlet.getParams().add( new KeyValuePair(Servlet.ENDPOINT_ADDRESS, address) );
+ servlet.setEndpointAddress(address); // for the deployers
+ }
private void addSecurityConstraints(ConfigTree webEndpointConfig, Servlet servlet) {
@@ -100,4 +126,4 @@
}
return securityConstraints;
}
-}
\ No newline at end of file
+}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/Servlet.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -21,19 +21,25 @@
*/
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.
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class Servlet extends AbstractWebComponent {
+
+ public static final String ENDPOINT_ADDRESS = "endpointAddress";
+ 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 +65,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/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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 ContractReferencePublisher.
+ *
+ * @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/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/AbstractContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProviderLifecycleResource.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProviderLifecycleResource.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProviderLifecycleResource.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -0,0 +1,132 @@
+/*
+ * 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.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.lifecycle.LifecyclePriorities;
+import org.jboss.soa.esb.lifecycle.LifecycleResource;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceException;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceFactory;
+import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
+
+/**
+ * ContractProviderLifecycleResource.
+ *
+ * @author dward at jboss.org
+ */
+public class ContractProviderLifecycleResource
+{
+
+ private static final Logger logger = Logger.getLogger(ContractProviderLifecycleResource.class);
+
+ private static final LifecycleResource<Map<String, ContractProvider>> lifecycleContractProviders =
+ new LifecycleResource<Map<String, ContractProvider>>(new LifecycleContractProviderFactory(), LifecyclePriorities.CONTRACT_PROVIDER_PRIORITY);
+
+ private ContractProviderLifecycleResource() {}
+
+ public static void putContractProviders(List<ServiceContract> serviceContracts)
+ throws LifecycleResourceException
+ {
+ if (serviceContracts != null)
+ {
+ for (ServiceContract serviceContract : serviceContracts)
+ {
+ Service service = serviceContract.getService();
+ putContractProvider( service.getCategory(), service.getName(), serviceContract.getContractProvider() );
+ }
+ }
+ }
+
+ public static void putContractProvider(String serviceCategory, String serviceName, ContractProvider contractProvider)
+ throws LifecycleResourceException
+ {
+ AssertArgument.isNotNull(contractProvider, "contractProvider");
+ String key = buildKey(serviceCategory, serviceName);
+ Map<String, ContractProvider> map = lifecycleContractProviders.getLifecycleResource();
+ synchronized(map)
+ {
+ map.put(key, contractProvider);
+ }
+ }
+
+ public static ContractProvider getContractProvider(String serviceCategory, String serviceName)
+ throws LifecycleResourceException
+ {
+ String key = buildKey(serviceCategory, serviceName);
+ Map<String, ContractProvider> map = lifecycleContractProviders.getLifecycleResource();
+ synchronized(map)
+ {
+ return map.get(key);
+ }
+ }
+
+ private static String buildKey(String serviceCategory, String serviceName)
+ {
+ AssertArgument.isNotNullAndNotEmpty(serviceCategory, "serviceCategory");
+ AssertArgument.isNotNullAndNotEmpty(serviceName, "serviceName");
+ StringBuilder sb = new StringBuilder();
+ sb.append(ContractProvider.class.getSimpleName());
+ sb.append("?deployment=");
+ sb.append(LifecycleResourceManager.getSingleton().getIdentity());
+ sb.append('&');
+ sb.append(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+ sb.append('=');
+ sb.append(serviceCategory);
+ sb.append('&');
+ sb.append(ListenerTagNames.SERVICE_NAME_TAG);
+ sb.append('=');
+ sb.append(serviceName);
+ return sb.toString();
+ }
+
+ private static class LifecycleContractProviderFactory implements LifecycleResourceFactory<Map<String, ContractProvider>>
+ {
+
+ public Map<String, ContractProvider> createLifecycleResource(String lifecycleIdentity) throws LifecycleResourceException
+ {
+ return new HashMap<String, ContractProvider>();
+ }
+
+ public void destroyLifecycleResource(Map<String, ContractProvider> resource, String lifecycleIdentity) throws LifecycleResourceException
+ {
+ if (resource.size() > 0)
+ {
+ if ( logger.isInfoEnabled() )
+ {
+ for ( String key : resource.keySet() )
+ {
+ logger.info("Removing " + key);
+ }
+ }
+ resource.clear();
+ }
+ }
+
+ }
+
+}
Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractProviderLifecycleResource.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/internal/soa/esb/publish/DefaultContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -126,6 +126,17 @@
* @throws ConfigurationException Failed to load the resource.
*/
public static InputStream getResource(String resource) throws ConfigurationException {
+ return getResource(resource, StreamUtils.class);
+ }
+
+ /**
+ * Load a stream resource.
+ * @param resource Resource filesystem/classpath/URL location.
+ * @return The resource stream.
+ * @param caller The class of the caller.
+ * @throws ConfigurationException Failed to load the resource.
+ */
+ public static InputStream getResource(String resource, Class<?> caller) throws ConfigurationException {
try {
// Try it as a File resource...
File file = new File(resource);
@@ -135,7 +146,7 @@
}
// Try it as a classpath resource ...
- InputStream stream = ClassUtil.getResourceAsStream(resource, StreamUtils.class);
+ InputStream stream = ClassUtil.getResourceAsStream(resource, caller);
if(stream != null) {
return stream;
}
Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/email/Emailer.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -127,7 +127,7 @@
if(obj instanceof byte[]) {
content = new String((byte[]) obj);
- payloadBytes = ((byte[]) obj).clone();
+ payloadBytes = (byte[])((byte[]) obj).clone();
} else {
content = obj.toString();
payloadBytes = content.getBytes();
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -0,0 +1,272 @@
+/*
+ * 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 final class HttpConfiguration
+{
+
+ private static final Logger logger = Logger.getLogger(HttpConfiguration.class);
+
+ private static MBeanServer mbeanServer = null;
+
+ private HttpConfiguration() {}
+
+ private static MBeanServer getMBeanServer()
+ {
+ if (mbeanServer == null)
+ {
+ synchronized(HttpConfiguration.class)
+ {
+ if (mbeanServer == null)
+ {
+ mbeanServer = MBeanServerLocator.locateJBoss();
+ }
+ }
+ }
+ return mbeanServer;
+ }
+
+ public static String getHost()
+ {
+ return getHost(Environment.DEFAULT_HOST);
+ }
+
+ public static 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 static int getPort()
+ {
+ return getPort(8080);
+ }
+
+ public static 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 static int getSecurePort()
+ {
+ return getSecurePort(8443);
+ }
+
+ public static 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 static int getConnectorPort(String protocol, boolean secure)
+ {
+ int port = -1;
+ try
+ {
+ MBeanServer mbs = getMBeanServer();
+ Set<?> connectorNames = mbs.queryNames(new ObjectName("jboss.web:type=Connector,*"), null);
+ for (Object current : connectorNames)
+ {
+ ObjectName currentName = (ObjectName)current;
+ try
+ {
+ int connectorPort = (Integer)mbs.getAttribute(currentName, "port");
+ boolean connectorSecure = (Boolean)mbs.getAttribute(currentName, "secure");
+ String connectorProtocol = (String)mbs.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 static String getAddress()
+ {
+ return getAddress(null);
+ }
+
+ public static String getAddress(String path)
+ {
+ return buildAddress(path, false);
+ }
+
+ public static String getSecureAddress()
+ {
+ return getSecureAddress(null);
+ }
+
+ public static String getSecureAddress(String path)
+ {
+ return buildAddress(path, true);
+ }
+
+ private static 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 static URL getURL() throws MalformedURLException
+ {
+ return new URL( getAddress() );
+ }
+
+ public static URL getURL(String path) throws MalformedURLException
+ {
+ return new URL( getAddress(path) );
+ }
+
+ public static URL getSecureURL() throws MalformedURLException
+ {
+ return new URL( getSecureAddress() );
+ }
+
+ public static URL getSecureURL(String path) throws MalformedURLException
+ {
+ return new URL( getSecureAddress(path) );
+ }
+
+ public static URI getURI() throws URISyntaxException
+ {
+ return new URI( getAddress() );
+ }
+
+ public static URI getURI(String path) throws URISyntaxException
+ {
+ return new URI( getAddress(path) );
+ }
+
+ public static URI getSecureURI() throws URISyntaxException
+ {
+ return new URI( getSecureAddress() );
+ }
+
+ public static URI getSecureURI(String path) throws URISyntaxException
+ {
+ return new URI( getSecureAddress(path) );
+ }
+
+ public static boolean isResponseStatusEnabled()
+ {
+ return isResponseStatusEnabled(true);
+ }
+
+ public static boolean isResponseStatusEnabled(boolean defaultValue)
+ {
+ String global = Configuration.getHttpResponseStatusEnabled();
+ if (global != null)
+ {
+ return Boolean.valueOf(global).booleanValue();
+ }
+ return defaultValue;
+ }
+
+}
Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/lifecycle/LifecyclePriorities.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -32,6 +32,11 @@
public final class LifecyclePriorities
{
/**
+ * The contract provider priority.
+ */
+ public static final int CONTRACT_PROVIDER_PRIORITY = 25000;
+
+ /**
* The rule base priority.
*/
public static final int RULE_BASE_PRIORITY = 50000;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -21,44 +21,61 @@
*/
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.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.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 +485,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 +517,29 @@
// Add a sub-deloyment for the web model...
if(!webModel.getServlets().isEmpty()) {
+
+ // Handle the ServiceContracts
+ List<ServiceContract> modelServiceContracts = model.getServiceContracts();
+ if (modelServiceContracts != null && modelServiceContracts.size() > 0) {
+ List<ServiceContract> actionableServiceContracts = new ArrayList<ServiceContract>();
+ for (Servlet servlet : webModel.getServlets()) {
+ Service service = servlet.getService();
+ String endpointAddress = servlet.getEndpointAddress();
+ if (service != null && endpointAddress != null) {
+ for (ServiceContract serviceContract : modelServiceContracts) {
+ if (service.equals(serviceContract.getService())) {
+ actionableServiceContracts.add(serviceContract);
+ publishers.add(
+ new DefaultContractReferencePublisher(
+ service, serviceContract.getDescription(), endpointAddress ) );
+ break; // first ServiceContract matching a Servlet wins!
+ }
+ }
+ }
+ }
+ deployment.setServiceContracts(actionableServiceContracts);
+ }
+
// Finalize the webDeployment...
webDeployment.finalizeArchive();
@@ -511,7 +551,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();
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jboss.internal.soa.esb.publish.ContractProviderLifecycleResource;
import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
@@ -39,6 +40,7 @@
private final String jbossEsbXml;
private String deploymentName ;
private List<ContractReferencePublisher> publishers ;
+ private List<ServiceContract> serviceContracts;
private ManagedLifecycleController controller;
private ClassLoader classloader;
@@ -67,6 +69,11 @@
{
this.publishers = publishers ;
}
+
+ public void setServiceContracts(final List<ServiceContract> serviceContracts)
+ {
+ this.serviceContracts = serviceContracts;
+ }
public ManagedLifecycleController getController()
{
@@ -112,6 +119,7 @@
Thread.currentThread().setContextClassLoader(classloader);
controller = Configuration.create(jbossEsbXml, serviceName, publishers);
controller.start();
+ ContractProviderLifecycleResource.putContractProviders(serviceContracts);
}
finally
{
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServiceContract.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/XMLBeansModel.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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,53 @@
}
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(), ServiceContract.class);
+ } catch (ClassNotFoundException e) {
+ break; // will not be found via junit classloading
+ } catch (NoClassDefFoundError ncdfe) {
+ break; // will not be found via junit classloading
+ }
+ 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);
+ break; // first Action with a ContractProvider wins!
+ }
+ }
+ }
+ }
+ }
+ }
+ return serviceContractList;
+ }
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/XMLBeansModel.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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,53 @@
}
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(), ServiceContract.class);
+ } catch (ClassNotFoundException e) {
+ break; // will not be found via junit classloading
+ } catch (NoClassDefFoundError ncdfe) {
+ break; // will not be found via junit classloading
+ }
+ 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);
+ break; // first Action with a ContractProvider wins!
+ }
+ }
+ }
+ }
+ }
+ }
+ return serviceContractList;
+ }
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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,55 @@
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(), ServiceContract.class);
+ } catch (ClassNotFoundException e) {
+ break; // will not be found via junit classloading
+ } catch (NoClassDefFoundError ncdfe) {
+ break; // will not be found via junit classloading
+ }
+ 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);
+ break; // first Action with a ContractProvider wins!
+ }
+ }
+ }
+ }
+ }
+ }
+ return serviceContractList;
+ }
+
public String getAuthDomain()
{
WarSecurity warSecurity = getWarSecurity();
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployer.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -167,6 +167,13 @@
bmdBuilder.addPropertyMetaData("publishers", esbMetaData.getPublishers());
}
+ if (esbMetaData.getServiceContracts().size() > 0)
+ {
+ // set service contracts on the deployment instance, or rather tell MC to do this for us.
+ log.debug("Adding service contracts : " + esbMetaData.getServiceContracts());
+ bmdBuilder.addPropertyMetaData("serviceContracts", esbMetaData.getServiceContracts());
+ }
+
return bmdBuilder.getBeanMetaData();
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbDeployment.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -26,9 +26,11 @@
import javax.management.ObjectName;
import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.publish.ContractProviderLifecycleResource;
import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
import org.jboss.soa.esb.listeners.config.ServicePublisher;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
@@ -53,6 +55,7 @@
private final String jbossEsbXml;
private String deploymentName;
private List<ContractReferencePublisher> publishers;
+ private List<ServiceContract> serviceContracts;
private ManagedLifecycleController controller;
private final String mbeanName;
@@ -77,6 +80,11 @@
{
this.publishers = publishers;
}
+
+ public void setServiceContracts(final List<ServiceContract> serviceContracts)
+ {
+ this.serviceContracts = serviceContracts;
+ }
public ManagedLifecycleController getController()
{
@@ -112,6 +120,7 @@
{
controller = Configuration.create(jbossEsbXml, new ObjectName(mbeanName), publishers);
controller.start();
+ ContractProviderLifecycleResource.putContractProviders(serviceContracts);
}
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbMetaData.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -30,6 +30,7 @@
import org.jboss.internal.soa.esb.assertion.AssertArgument;
import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.soa.esb.listeners.config.ServiceContract;
import org.jboss.soa.esb.listeners.config.model.ModelAdapter;
/**
@@ -61,6 +62,9 @@
/** The publishers for this deployment */
private List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>();
+ /** The service contracts for this deployment */
+ private List<ServiceContract> serviceContracts = new ArrayList<ServiceContract>();
+
/**
* Sole constructor.
*
@@ -151,6 +155,26 @@
{
return Collections.unmodifiableList(publishers);
}
+
+ /**
+ * Sets the service contracts for this deployment.
+ *
+ * @param serviceContracts The service contracts for this deployment.
+ */
+ public void setServiceContracts(final List<ServiceContract> serviceContracts)
+ {
+ this.serviceContracts = serviceContracts;
+ }
+
+ /**
+ * Gets the service contracts for this deployment.
+ *
+ * @return List<ServiceContract> List of service contracts for this deployment.
+ */
+ public List<ServiceContract> getServiceContracts()
+ {
+ return Collections.unmodifiableList(serviceContracts);
+ }
/**
* @return String String representation of this metadata.
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -30,31 +30,43 @@
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.internal.soa.esb.listeners.war.Filter;
+import org.jboss.internal.soa.esb.listeners.war.SecurityConstraints;
+import org.jboss.internal.soa.esb.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.listeners.war.WebModel;
import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.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 +209,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 +233,28 @@
throw new DeploymentException("Failed to capture web metadata from ESB configuration.", e);
}
+ // Handle the ServiceContracts
+ List<ServiceContract> modelServiceContracts = esbMetaData.getModel().getServiceContracts();
+ if (modelServiceContracts != null && modelServiceContracts.size() > 0) {
+ List<ServiceContract> actionableServiceContracts = new ArrayList<ServiceContract>();
+ for (Servlet servlet : webModel.getServlets()) {
+ Service service = servlet.getService();
+ String endpointAddress = servlet.getEndpointAddress();
+ if (service != null && endpointAddress != null) {
+ for (ServiceContract serviceContract : modelServiceContracts) {
+ if (service.equals(serviceContract.getService())) {
+ actionableServiceContracts.add(serviceContract);
+ publishers.add(
+ new DefaultContractReferencePublisher(
+ service, serviceContract.getDescription(), endpointAddress ) );
+ break; // first ServiceContract matching a Servlet wins!
+ }
+ }
+ }
+ }
+ esbMetaData.setServiceContracts(actionableServiceContracts);
+ }
+
// Add the filters...
for(Filter filter : webModel.getFilters()) {
webMetaDataCreated = true;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -19,34 +19,41 @@
*/
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.listeners.war.Servlet;
+import org.jboss.internal.soa.esb.publish.ContractInfo;
+import org.jboss.internal.soa.esb.publish.ContractProvider;
+import org.jboss.internal.soa.esb.publish.ContractProviderLifecycleResource;
+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.lifecycle.LifecycleResourceException;
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 +77,7 @@
private Service service;
private ServiceInvoker serviceInvoker;
+ private ContractInfo contract = null;
private boolean asyncInvoke;
private int asyncStatusCode = HttpServletResponse.SC_OK;
private byte[] asyncPayload;
@@ -80,13 +88,27 @@
private Map<String, Integer> exceptionMappings;
public void init(ServletConfig config) throws ServletException {
- service = new Service(config.getInitParameter(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG), config.getInitParameter(ListenerTagNames.TARGET_SERVICE_NAME_TAG));
+ String serviceCategory = config.getInitParameter(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG);
+ String serviceName = config.getInitParameter(ListenerTagNames.TARGET_SERVICE_NAME_TAG);
+ service = new Service(serviceCategory, serviceName);
try {
serviceInvoker = new ServiceInvoker(service);
} catch (MessageDeliverException e) {
throw new ServletException("Unable to create ServiceInvoker for Service '" + service + "'.", e);
}
-
+
+ try {
+ ContractProvider contractProvider = ContractProviderLifecycleResource.getContractProvider(serviceCategory, serviceName);
+ String endpointAddress = config.getInitParameter(Servlet.ENDPOINT_ADDRESS);
+ if (contractProvider != null) {
+ contract = contractProvider.provideContract(endpointAddress);
+ }
+ } catch (LifecycleResourceException lre) {
+ throw new ServletException(lre);
+ } catch (IOException ioe) {
+ throw new ServletException(ioe);
+ }
+
ConfigTree configTree = toConfigTree(config);
try {
messageComposer = MessageComposer.Factory.getInstance(configTree.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG, HttpMessageComposer.class.getName()), configTree);
@@ -130,6 +152,19 @@
}
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ // if it's a wsdl request, serve up the contract then short-circuit
+ if ("wsdl".equalsIgnoreCase(req.getQueryString())) {
+ resp.setCharacterEncoding("UTF-8");
+ String mimeType = (contract != null ? contract.getMimeType() : "text/xml");
+ resp.setContentType(mimeType);
+ String data = (contract != null ? contract.getData() : "<definitions/>");
+ resp.setContentLength(data.length());
+ Writer writer = new BufferedWriter(resp.getWriter());
+ writer.write(data);
+ writer.flush();
+ return;
+ }
+
HttpRequestWrapper wrapper = new HttpRequestWrapper(req, resp, service);
Message inMessage;
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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,12 @@
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.isResponseStatusEnabled() );
}
// JBESB-2761
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/samples/quickstarts/webservice_proxy_basic/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/readme.txt 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/readme.txt 2009-10-12 15:55:30 UTC (rev 29581)
@@ -31,7 +31,7 @@
'runhttp' (alias 'runtest') target description:
- This will exercise the target webservice *via* the SOAPProxy, first going
through a Http Gateway Listener.
- - The request url is: http://localhost:9090
+ - The request url is: http://localhost:8080/Quickstart_webservice_proxy_basic/http/Proxy_Basic/Proxy
- Running it will create output like this in the server console:
01:19:15,983 INFO [STDOUT] Message before SOAPProxy:
@@ -41,13 +41,13 @@
...and this in the client console:
- [java] **** REQUEST URL: http://localhost:9090
+ [java] **** REQUEST URL: http://localhost:8080/Quickstart_webservice_proxy_basic/http/Proxy_Basic/Proxy
[java] **** REQUEST BODY: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hello="http://webservice_proxy_basic/helloworld"><soapenv:Header/><soapenv:Body><hello:sayHello><toWhom>dward</toWhom></hello:sayHello></soapenv:Body></soapenv:Envelope>
[java] 01:19:15,946 DEBUG [main][header] >> "POST / HTTP/1.1[\r][\n]"
[java] 01:19:15,978 DEBUG [main][header] >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[java] 01:19:15,978 DEBUG [main][header] >> "SOAPAction: ""[\r][\n]"
[java] 01:19:15,979 DEBUG [main][header] >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
- [java] 01:19:15,979 DEBUG [main][header] >> "Host: localhost:9090[\r][\n]"
+ [java] 01:19:15,979 DEBUG [main][header] >> "Host: localhost:8080[\r][\n]"
[java] 01:19:15,979 DEBUG [main][header] >> "Content-Length: 253[\r][\n]"
[java] 01:19:15,980 DEBUG [main][header] >> "[\r][\n]"
[java] 01:19:15,980 DEBUG [main][content] >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hello="http://webservice_proxy_basic/helloworld"><soapenv:Header/><soapenv:Body><hello:sayHello><toWhom>dward</toWhom></hello:sayHello></soapenv:Body></soapenv:Envelope>"
@@ -75,7 +75,7 @@
Configuration:
- wsdl (required): The original wsdl url whose WS endpoint will get re-written and exposed as
new wsdl from the ESB:
- http://localhost:8080/contract/contract.jsp?serviceCat=Proxy_Basic&serviceName=Proxy&protocol=http
+ http://localhost:8080/Quickstart_webservice_proxy_basic/http/Proxy_Basic/Proxy?wsdl
Depending upon the <definitions><service><port><soap:address location attribute's protocol
(for example "http"), a protocol-specific SOAPProxyTransport implementation is used.
For other possible configuration properties, see the specific SOAPProxyTransport implementations
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/readme.txt 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/readme.txt 2009-10-12 15:55:30 UTC (rev 29581)
@@ -31,7 +31,7 @@
- This will exercise the Hello webservice *via* a SOAPProxy, first going
through a Http Gateway Listener, then a ContentBasedRouter
to know whih proxied web service to invoke, which in this case is HelloWS.
- - The request url is: http://localhost:9090
+ - The request url is: http://localhost:8080/Quickstart_webservice_proxy_routed/http/Proxy_Routed/Proxy_CBR
- Running it will create output like this in the server console:
01:02:33,412 INFO [STDOUT] Message before ContentBasedRouter:
@@ -44,13 +44,13 @@
...and this in the client console:
- [java] **** REQUEST URL: http://localhost:9090
+ [java] **** REQUEST URL: http://localhost:8080/Quickstart_webservice_proxy_routed/http/Proxy_Routed/Proxy_CBR
[java] **** REQUEST BODY: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hello="http://webservice_proxy_routed/hello"><soapenv:Header/><soapenv:Body><hello:sayHello><toWhom>dward</toWhom></hello:sayHello></soapenv:Body></soapenv:Envelope>
[java] 01:02:33,380 DEBUG [main][header] >> "POST / HTTP/1.1[\r][\n]"
[java] 01:02:33,401 DEBUG [main][header] >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[java] 01:02:33,402 DEBUG [main][header] >> "SOAPAction: ""[\r][\n]"
[java] 01:02:33,402 DEBUG [main][header] >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
- [java] 01:02:33,403 DEBUG [main][header] >> "Host: localhost:9090[\r][\n]"
+ [java] 01:02:33,403 DEBUG [main][header] >> "Host: localhost:8080[\r][\n]"
[java] 01:02:33,403 DEBUG [main][header] >> "Content-Length: 249[\r][\n]"
[java] 01:02:33,403 DEBUG [main][header] >> "[\r][\n]"
[java] 01:02:33,403 DEBUG [main][content] >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hello="http://webservice_proxy_routed/hello"><soapenv:Header/><soapenv:Body><hello:sayHello><toWhom>dward</toWhom></hello:sayHello></soapenv:Body></soapenv:Envelope>"
@@ -69,7 +69,7 @@
- This will exercise the Goodbye webservice *via* a SOAPProxy, first going
through a Http Gateway Listener, then a ContentBasedRouter
to know whih proxied web service to invoke, which in this case is GoodbyeWS.
- - The request url is: http://localhost:9090
+ - The request url is: http://localhost:8080/Quickstart_webservice_proxy_routed/http/Proxy_Routed/Proxy_CBR
- Running it will create output like this in the server console:
01:03:32,618 INFO [STDOUT] Message before ContentBasedRouter:
@@ -82,13 +82,13 @@
...and this in the client console:
- [java] **** REQUEST URL: http://localhost:9090
+ [java] **** REQUEST URL: http://localhost:8080/Quickstart_webservice_proxy_routed/http/Proxy_Routed/Proxy_CBR
[java] **** REQUEST BODY: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:goodbye="http://webservice_proxy_routed/goodbye"><soapenv:Header/><soapenv:Body><goodbye:sayGoodbye><toWhom>dward</toWhom></goodbye:sayGoodbye></soapenv:Body></soapenv:Envelope>
[java] 01:03:32,488 DEBUG [main][header] >> "POST / HTTP/1.1[\r][\n]"
[java] 01:03:32,520 DEBUG [main][header] >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[java] 01:03:32,520 DEBUG [main][header] >> "SOAPAction: ""[\r][\n]"
[java] 01:03:32,521 DEBUG [main][header] >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
- [java] 01:03:32,528 DEBUG [main][header] >> "Host: localhost:9090[\r][\n]"
+ [java] 01:03:32,528 DEBUG [main][header] >> "Host: localhost:8080[\r][\n]"
[java] 01:03:32,529 DEBUG [main][header] >> "Content-Length: 261[\r][\n]"
[java] 01:03:32,529 DEBUG [main][header] >> "[\r][\n]"
[java] 01:03:32,529 DEBUG [main][content] >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:goodbye="http://webservice_proxy_routed/goodbye"><soapenv:Header/><soapenv:Body><goodbye:sayGoodbye><toWhom>dward</toWhom></goodbye:sayGoodbye></soapenv:Body></soapenv:Envelope>"
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml 2009-10-12 15:55:30 UTC (rev 29581)
@@ -69,7 +69,8 @@
</copy>
<echo message=""/>
- <echo message="IMPORTANT: Copy ${build.dir}/server.xml into jbossesb-server-4.x/server/default/deploy/jboss-web.deployer/server.xml *before* starting server!!!"/>
+ <echo message="IMPORTANT for 4.x: Copy ${build.dir}/server.xml into jbossesb-server-4.x/server/default/deploy/jboss-web.deployer/server.xml *before* starting server!!!"/>
+ <echo message="IMPORTANT for 5.x: Copy ${build.dir}/server.xml into jboss-5.x/server/default/deploy/jbossweb.sar/server.xml *before* starting server!!!"/>
<echo message=""/>
</target>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml 2009-10-12 15:55:30 UTC (rev 29581)
@@ -2,9 +2,9 @@
<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>
+ <!-- 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>
<providers>
<http-provider name="HTTP-PROVIDER">
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/readme.txt 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/readme.txt 2009-10-12 15:55:30 UTC (rev 29581)
@@ -36,7 +36,7 @@
- This will exercise the target webservice *via* the SOAPProxy, first going through a Http Gateway Listener
and having it's incoming SOAP request be *transformed* and having a <processDate> elemented added to the body!
- Note that the wsl is transformed as well (see "Project file descriptions" below)!
- - The request url is: http://localhost:9090
+ - The request url is: http://localhost:8080/Quickstart_webservice_proxy_versioning/http/Proxy_Versioning/Proxy-OldVersion
- Running it will create output like this in the server console:
01:05:59,535 INFO [STDOUT] Message before Transformation:
@@ -58,13 +58,13 @@
- And this in the client console:
- [java] **** REQUEST URL: http://localhost:9090
+ [java] **** REQUEST URL: http://localhost:8080/Quickstart_webservice_proxy_versioning/http/Proxy_Versioning/Proxy-OldVersion
[java] **** REQUEST BODY: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://webservice_proxy_versioning/invoicing"><soapenv:Header/><soapenv:Body><inv:processInvoice><invoiceNumber>0123456789</invoiceNumber></inv:processInvoice></soapenv:Body></soapenv:Envelope>
[java] 01:05:59,443 DEBUG [main][header] >> "POST / HTTP/1.1[\r][\n]"
[java] 01:05:59,464 DEBUG [main][header] >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[java] 01:05:59,464 DEBUG [main][header] >> "SOAPAction: ""[\r][\n]"
[java] 01:05:59,465 DEBUG [main][header] >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
- [java] 01:05:59,465 DEBUG [main][header] >> "Host: localhost:9090[\r][\n]"
+ [java] 01:05:59,465 DEBUG [main][header] >> "Host: localhost:8080[\r][\n]"
[java] 01:05:59,465 DEBUG [main][header] >> "Content-Length: 282[\r][\n]"
[java] 01:05:59,465 DEBUG [main][header] >> "[\r][\n]"
[java] 01:05:59,466 DEBUG [main][content] >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://webservice_proxy_versioning/invoicing"><soapenv:Header/><soapenv:Body><inv:processInvoice><invoiceNumber>0123456789</invoiceNumber></inv:processInvoice></soapenv:Body></soapenv:Envelope>"
@@ -82,7 +82,7 @@
'runnew' target description:
- This will exercise the target webservice *via* the SOAPProxy, first going through a Http Gateway Listener.
- Nothing interesting here; it is just like the webservice_proxy_basic quickstart.
- - The request url is: http://localhost:9090
+ - The request url is: http://localhost:8080/Quickstart_webservice_proxy_versioning/http/Proxy_Versioning/Proxy-NewVersion
- Running it will create output like this in the server console:
01:06:52,304 INFO [STDOUT] Message before SOAPProxy:
@@ -93,7 +93,7 @@
- And this in the client console:
- [java] **** REQUEST URL: http://localhost:9999
+ [java] **** REQUEST URL: http://localhost:8080/Quickstart_webservice_proxy_versioning/http/Proxy_Versioning/Proxy-NewVersion
[java] **** REQUEST BODY: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://webservice_proxy_versioning/invoicing"><soapenv:Header/><soapenv:Body><inv:processInvoice><invoiceNumber>0123456789</invoiceNumber><processDate>2005-12-13T14:13:28.443+01:00</processDate></inv:processInvoice></soapenv:Body></soapenv:Envelope>
[java] 01:06:52,210 DEBUG [main][header] >> "POST / HTTP/1.1[\r][\n]"
[java] 01:06:52,248 DEBUG [main][header] >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
@@ -144,7 +144,7 @@
Proxy_Versioning_WsdlTransform.xml:
Transforms the new service endpoing WSDL so it can be used in the old service endpoint.
It uses Smooks to remove the newly added <processDate> element.
- http://localhost:8080/contract/contract.jsp?serviceCat=Proxy_Versioning&serviceName=Proxy-OldVersion&protocol=http
+ http://localhost:8080/Quickstart_webservice_proxy_versioning/http/Proxy_Versioning/Proxy-OldVersion?wsdl
build.xml:
Targets and structure description:
Modified: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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,46 @@
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
+ {
+ ContractInfo contract;
+ if (endpointAddressOverride != null)
+ {
+ try
+ {
+ initializeTransformer();
+ }
+ catch (ConfigurationException ce)
+ {
+ throw new IOException( ce.getMessage() );
+ }
+ contract = getContractInfo( new EPR(URI.create(endpointAddressOverride)) );
+ }
+ else
+ {
+ contract = new ContractInfo( "text/xml", getWsdl(getWsdlAddress()) );
+ }
+ return contract;
+ }
+
}
Modified: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlLoader.java 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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/trunk/product/tools/console/contract-web/src/main/webapp/index.jsp
===================================================================
--- labs/jbossesb/trunk/product/tools/console/contract-web/src/main/webapp/index.jsp 2009-10-12 15:50:31 UTC (rev 29580)
+++ labs/jbossesb/trunk/product/tools/console/contract-web/src/main/webapp/index.jsp 2009-10-12 15:55:30 UTC (rev 29581)
@@ -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