[jboss-svn-commits] JBL Code SVN: r38289 - in labs/jbossesb/branches/JBESB_4_11_CP2/product: rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6 and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Feb 27 11:01:04 EST 2013
Author: tadayosi
Date: 2013-02-27 11:01:03 -0500 (Wed, 27 Feb 2013)
New Revision: 38289
Added:
labs/jbossesb/branches/JBESB_4_11_CP2/product/lib/ext/wss4j.jar
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jbossws-cxf.xml.ftl
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServiceConfiguration.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/security/
Modified:
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/WebGatewayBuilder.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/addressing/MAPBuilderFactory.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java
labs/jbossesb/branches/JBESB_4_11_CP2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/JBossWSFactory.java
Log:
JBESB-3906
Backport changes for JBESB-3898 from trunk to JBESB_4_11_CP2 branch.
Copied: labs/jbossesb/branches/JBESB_4_11_CP2/product/lib/ext/wss4j.jar (from rev 38280, labs/jbossesb/trunk/product/lib/ext/wss4j.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/WebGatewayBuilder.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/WebGatewayBuilder.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/deployer-as6/src/org/jboss/soa/esb/listeners/deployers/mc/as6/WebGatewayBuilder.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -110,6 +110,7 @@
// in a jboss-esb.xml file.
webModel.setAuthDomain(model.getAuthDomain());
webModel.setAuthMethod(model.getAuthMethod());
+ webModel.generateCXFXML(true);
// Add the EBWS components...
createWebserviceWars(webDeployment);
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -21,10 +21,6 @@
*/
package org.jboss.internal.soa.esb.listeners.war;
-import org.jboss.soa.esb.util.DeploymentArchive;
-import org.jboss.soa.esb.util.FreeMarkerTemplate;
-import org.jboss.soa.esb.ConfigurationException;
-
import java.io.InputStream;
import java.io.IOException;
import java.io.ByteArrayInputStream;
@@ -33,6 +29,12 @@
import freemarker.template.TemplateException;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.internal.soa.esb.webservice.WebServiceConfiguration;
+import org.jboss.soa.esb.util.DeploymentArchive;
+import org.jboss.soa.esb.util.FreeMarkerTemplate;
+import org.jboss.soa.esb.ConfigurationException;
+
/**
* Web deployment archive.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -69,6 +71,11 @@
// Add the jboss-web.xml...
addJBossWebXML();
+
+ // Add the jbossws-cxf.xml...
+ if (webModel.hasCXFXML() && JBossDeployerUtil.isCXFImpl()) {
+ addJBossWSCXFXML();
+ }
} finally {
// Mark as finalized...
archiveFinalized = true;
@@ -111,6 +118,27 @@
return template.apply(contextObj);
}
+ private void addJBossWSCXFXML() throws ConfigurationException {
+ try {
+ String jbossWSCXFXml = getJBossWSCXFXML();
+ addEntry("WEB-INF/jbossws-cxf.xml", new ByteArrayInputStream(jbossWSCXFXml.getBytes("UTF-8")));
+ } catch (Exception e) {
+ throw new ConfigurationException("Error adding jbossws-cxf.xml to web deployment.", e);
+ }
+ }
+
+ String getJBossWSCXFXML() throws TemplateException {
+ FreeMarkerTemplate template = new FreeMarkerTemplate("templates/jbossws-cxf.xml.ftl", WebDeploymentArchive.class);
+ Map contextObj = new HashMap();
+
+ contextObj.put("webModel", webModel);
+ contextObj.put("host", WebServiceConfiguration.HOST);
+ contextObj.put("port", String.valueOf(WebServiceConfiguration.PORT));
+ contextObj.put("securePort", String.valueOf(WebServiceConfiguration.SECUREPORT));
+
+ return template.apply(contextObj);
+ }
+
public final void addEntry(String path, InputStream data) {
assertNotFinalized();
super.addEntry(path, data);
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebModel.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -40,6 +40,7 @@
private Set<String> securityRoles = new LinkedHashSet<String>();
private String authMethod;
private String authDomain;
+ private Boolean cxfXML;
public WebModel(String esbName) {
AssertArgument.isNotNullAndNotEmpty(esbName, "esbName");
@@ -92,6 +93,14 @@
return authMethod;
}
+ public Boolean hasCXFXML() {
+ return cxfXML;
+ }
+
+ public void generateCXFXML(Boolean cxfXML) {
+ this.cxfXML = cxfXML;
+ }
+
public void setAuthMethod(String authMethod) throws ConfigurationException {
if(authMethod == null) {
// Just ignore it...
Copied: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jbossws-cxf.xml.ftl (from rev 38280, labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jbossws-cxf.xml.ftl)
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jbossws-cxf.xml.ftl (rev 0)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/templates/jbossws-cxf.xml.ftl 2013-02-27 16:01:03 UTC (rev 38289)
@@ -0,0 +1,51 @@
+<beans
+ xmlns='http://www.springframework.org/schema/beans'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xmlns:beans='http://www.springframework.org/schema/beans'
+ xmlns:jaxws='http://cxf.apache.org/jaxws'
+ xmlns:util='http://www.springframework.org/schema/util'
+ xsi:schemaLocation='http://cxf.apache.org/core
+ http://cxf.apache.org/schemas/core.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-2.0.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd'>
+
+ <#if webModel.authDomain??>
+ <bean id="UsernameTokenAuthentication" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="UsernameToken" />
+ <entry key="passwordCallbackClass" value="org.jboss.internal.soa.esb.webservice.security.cxf.JaasUserPassCallbackHandler"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </#if>
+
+ <#list webModel.servlets as servlet>
+ <#list servlet.urlMappings as urlMapping>
+ <jaxws:endpoint
+ id='${servlet.name}'
+ <#if servlet.securityConstraints??>
+ <#if servlet.securityConstraints.transportGuarantee??>
+ <#if servlet.securityConstraints.transportGuarantee == "CONFIDENTIAL"??>
+ address='https://${host}:${securePort}/${webModel.esbName}${urlMapping}'
+ </#if>
+ </#if>
+ <#else>
+ address='http://${host}:${port}/${webModel.esbName}${urlMapping}'
+ </#if>
+ implementor='${servlet.runtimeClass}'>
+ <jaxws:inInterceptors>
+ <#if webModel.authDomain??>
+ <ref bean="UsernameTokenAuthentication"/>
+ </#if>
+ <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
+ </jaxws:inInterceptors>
+ </jaxws:endpoint>
+ </#list>
+ </#list>
+
+</beans>
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -70,11 +70,11 @@
* @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
*
*/
-public class JBossDeployerUtil
+public final class JBossDeployerUtil
{
- private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
+ private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
private static final String ESB_ARTIFACT_NAME = "jbossesb.esb" ;
-
+
private static final String HANDLER_CHAIN_PREFIX = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<handler-chains xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd\">" + "<handler-chain><protocol-bindings>##SOAP11_HTTP</protocol-bindings>";
private static final String HANDLER_CHAIN_POSTFIX = "</handler-chain></handler-chains>";
private static final String HANDLER_PREFIX = "<handler><handler-name>";
@@ -94,9 +94,24 @@
public static final String WSIMPL_UNKNOWN = "Unknown";
private static String WSIMPL;
private static Boolean WEB_META_DATA_PRESENT;
+ private static Boolean CXF_IMPL_PRESENT;
private JBossDeployerUtil() { }
+ public static synchronized Boolean isCXFImpl()
+ {
+ if (CXF_IMPL_PRESENT == null)
+ {
+ CXF_IMPL_PRESENT = getWSImpl().equals(WSIMPL_CXF) ? true : false;
+ }
+ return CXF_IMPL_PRESENT;
+ }
+
+ public static Boolean isNativeImpl()
+ {
+ return !isCXFImpl();
+ }
+
public static synchronized String getWSImpl()
{
if (WSIMPL == null)
@@ -162,7 +177,7 @@
if (serviceInfo.isAddressing())
{
sb.append(HANDLER_PREFIX).append(WSADDR_CONTEXT_NAME).append(HANDLER_MIDDLE).append(WSADDR_CONTEXT_HANDLER).append(HANDLER_POSTFIX);
- if (getWSImpl().equals(WSIMPL_NATIVE))
+ if (isNativeImpl())
{
sb.append(HANDLER_PREFIX).append(WSADDR_NAME).append(HANDLER_MIDDLE).append(WSADDR_HANDLER).append(HANDLER_POSTFIX);
}
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -118,7 +118,7 @@
annotation2.addMemberValue("value", enumValue);
attribute.addAnnotation(annotation2);
- if (epInfo.isAddressing() && JBossDeployerUtil.getWSImpl().equals(JBossDeployerUtil.WSIMPL_CXF))
+ if (epInfo.isAddressing() && JBossDeployerUtil.isCXFImpl())
{
Annotation annotation3 = new Annotation("javax.xml.ws.soap.Addressing", constantPool);
BooleanMemberValue boolEnabled = new BooleanMemberValue(constantPool);
Copied: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServiceConfiguration.java (from rev 38280, labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServiceConfiguration.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServiceConfiguration.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServiceConfiguration.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.internal.soa.esb.webservice;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.JBossDeployerUtil;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.soa.esb.common.Environment;
+
+/**
+ * JBossWS Configuration.
+ */
+public final class WebServiceConfiguration
+{
+ private static final Logger logger = Logger.getLogger(WebServiceConfiguration.class);
+
+ public static String HOST = Environment.DEFAULT_HOST;
+ public static Integer PORT = 8080;
+ public static Integer SECUREPORT = 8443;
+
+ private WebServiceConfiguration() {}
+
+ static
+ {
+ try
+ {
+ ObjectName wsConfig = new ObjectName("jboss.ws.ServerConfig:type=Service");
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ HOST = (String) mbeanServer.getAttribute(wsConfig, "webServiceHost");
+ PORT = (Integer) mbeanServer.getAttribute(wsConfig, "webServicePort");
+ SECUREPORT = (Integer) mbeanServer.getAttribute(wsConfig, "webServiceSecurePort");
+ }
+ catch(JMException jme)
+ {
+ logger.error(jme);
+ }
+ }
+}
\ No newline at end of file
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/addressing/MAPBuilderFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/addressing/MAPBuilderFactory.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/addressing/MAPBuilderFactory.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -41,12 +41,12 @@
try
{
Class factoryClass = null;
- if (JBossDeployerUtil.getWSImpl().equals(JBossDeployerUtil.WSIMPL_NATIVE))
+ if (JBossDeployerUtil.isNativeImpl())
{
className = "org.jboss.internal.soa.esb.webservice.addressing.def.NativeMAPBuilderFactory";
factoryClass = loader.loadClass(className);
}
- else if (JBossDeployerUtil.getWSImpl().equals(JBossDeployerUtil.WSIMPL_CXF))
+ else if (JBossDeployerUtil.isCXFImpl())
{
className = "org.jboss.internal.soa.esb.webservice.addressing.cxf.CXFMAPBuilderFactory";
factoryClass = loader.loadClass(className);
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/rosetta/src/org/jboss/soa/esb/listeners/config/WebGatewayBuilder.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -107,6 +107,7 @@
// in a jboss-esb.xml file.
webModel.setAuthDomain(model.getAuthDomain());
webModel.setAuthMethod(model.getAuthMethod());
+ webModel.generateCXFXML(true);
// Add the EBWS components...
createWebserviceWars(webDeployment);
Modified: labs/jbossesb/branches/JBESB_4_11_CP2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/JBossWSFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/JBossWSFactory.java 2013-02-27 08:58:08 UTC (rev 38288)
+++ labs/jbossesb/branches/JBESB_4_11_CP2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/adapter/JBossWSFactory.java 2013-02-27 16:01:03 UTC (rev 38289)
@@ -123,7 +123,7 @@
{
JBossWSFactory factory = null ;
- if (JBossDeployerUtil.getWSImpl().equals(JBossDeployerUtil.WSIMPL_CXF))
+ if (JBossDeployerUtil.isCXFImpl())
{
try
{
More information about the jboss-svn-commits
mailing list