Author: objectiser
Date: 2010-05-25 14:58:21 -0400 (Tue, 25 May 2010)
New Revision: 668
Added:
branches/gbrown/distribution/src/main/release/db/wsstack/
branches/gbrown/distribution/src/main/release/db/wsstack/cxf.properties
branches/gbrown/distribution/src/main/release/db/wsstack/native.properties
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/CXFJAXWSInitializer.java
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/JAXWSInitializer.java
Modified:
branches/gbrown/distribution/src/main/release/db/bpel.properties
branches/gbrown/distribution/src/main/release/install/build.xml
branches/gbrown/pom.xml
branches/gbrown/runtime/engine/pom.xml
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceClient.java
Log:
Support for CXF configuration of web service client endpoint, for use in ws-security.
Modified: branches/gbrown/distribution/src/main/release/db/bpel.properties
===================================================================
--- branches/gbrown/distribution/src/main/release/db/bpel.properties 2010-05-25 17:50:59
UTC (rev 667)
+++ branches/gbrown/distribution/src/main/release/db/bpel.properties 2010-05-25 18:58:21
UTC (rev 668)
@@ -105,6 +105,8 @@
# name of the clerk
bpel.uddi.clerk=BPELClerk
+bpel.jaxws.client.initializer.impl=(a)jaxws.client.initializer.impl@
+
hibernate.dialect=@dialect@
hibernate.hbm2ddl.auto=update
hibernate.current_session_context_class=jta
Added: branches/gbrown/distribution/src/main/release/db/wsstack/cxf.properties
===================================================================
--- branches/gbrown/distribution/src/main/release/db/wsstack/cxf.properties
(rev 0)
+++ branches/gbrown/distribution/src/main/release/db/wsstack/cxf.properties 2010-05-25
18:58:21 UTC (rev 668)
@@ -0,0 +1 @@
+jaxws.client.initializer.impl=org.jboss.soa.bpel.runtime.ws.CXFJAXWSInitializer
Added: branches/gbrown/distribution/src/main/release/db/wsstack/native.properties
===================================================================
--- branches/gbrown/distribution/src/main/release/db/wsstack/native.properties
(rev 0)
+++ branches/gbrown/distribution/src/main/release/db/wsstack/native.properties 2010-05-25
18:58:21 UTC (rev 668)
@@ -0,0 +1 @@
+jaxws.client.initializer.impl=
Modified: branches/gbrown/distribution/src/main/release/install/build.xml
===================================================================
--- branches/gbrown/distribution/src/main/release/install/build.xml 2010-05-25 17:50:59
UTC (rev 667)
+++ branches/gbrown/distribution/src/main/release/install/build.xml 2010-05-25 18:58:21
UTC (rev 668)
@@ -81,6 +81,7 @@
toFile="${deploy.dir}/${bpel-runtime}/bpel.properties"
overwrite="true">
<filterset filtersfile="../db/jdbc/${database}.properties" />
+ <filterset filtersfile="../db/wsstack/${ws.stack}.properties" />
</copy>
<copy file="../db/datasource/bpel-${database}-ds.xml"
Modified: branches/gbrown/pom.xml
===================================================================
--- branches/gbrown/pom.xml 2010-05-25 17:50:59 UTC (rev 667)
+++ branches/gbrown/pom.xml 2010-05-25 18:58:21 UTC (rev 668)
@@ -82,6 +82,7 @@
<commons.codec.version>1.3</commons.codec.version>
<xerces.version>2.9.0</xerces.version>
<commons.httpclient.version>3.1</commons.httpclient.version>
+ <cxf.version>2.2.8</cxf.version>
</properties>
<dependencyManagement>
Modified: branches/gbrown/runtime/engine/pom.xml
===================================================================
--- branches/gbrown/runtime/engine/pom.xml 2010-05-25 17:50:59 UTC (rev 667)
+++ branches/gbrown/runtime/engine/pom.xml 2010-05-25 18:58:21 UTC (rev 668)
@@ -118,6 +118,18 @@
<artifactId>riftsaw-bpel-compiler</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-core</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
<!-- for H2Database -->
<dependency>
Modified:
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
===================================================================
---
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2010-05-25
17:50:59 UTC (rev 667)
+++
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2010-05-25
18:58:21 UTC (rev 668)
@@ -226,10 +226,12 @@
initialPartnerEndpoint.serviceName, initialPartnerEndpoint.portName,
processId, endpointId
);
+
+ ProcessConf pconf=engine._store.getProcessConfiguration(processId);
try
{
- PartnerChannel channel = endpointManager.createClient(endpointMD, wsdlDefinition,
wsdlUrl);
+ PartnerChannel channel = endpointManager.createClient(endpointMD, wsdlDefinition,
wsdlUrl, pconf);
return new PartnerRoleChannelImpl(channel);
}
Added:
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/CXFJAXWSInitializer.java
===================================================================
---
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/CXFJAXWSInitializer.java
(rev 0)
+++
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/CXFJAXWSInitializer.java 2010-05-25
18:58:21 UTC (rev 668)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.ws;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+
+/**
+ * This class implements the JAXWSInitializer interface to
+ * provide Apache CXF specific initialization.
+ *
+ * @author gbrown
+ *
+ */
+public class CXFJAXWSInitializer implements JAXWSInitializer {
+
+ protected final Log log = LogFactory.getLog(getClass());
+
+ /**
+ * This method initializes the web service stack in preparation for
+ * calling the service and port supplied as parameters.
+ *
+ * @param serviceName The service name
+ * @param portName The port name
+ * @param baseURI The base URI of the deployment
+ */
+ public void initializeStack(QName serviceName, QName portName, java.net.URI baseURI) {
+ try {
+ SpringBusFactory bf = new SpringBusFactory();
+
+ URLClassLoader urlcl=new URLClassLoader(new URL[]{baseURI.toURL()});
+
+ String filename="jbossws-cxf-"+portName.getLocalPart()+".xml";
+
+ URL busFile = urlcl.getResource(filename);
+
+ log.debug("Web Stack initialization file: name="+filename+"
file="+busFile);
+
+ if (busFile != null) {
+ Bus bus = bf.createBus(busFile.toString());
+ bf.setThreadDefaultBus(bus);
+
+ log.debug("Set thread default bus="+bus);
+ }
+
+ } catch(Exception e) {
+ log.error("Failed to initialize WS-Security in stack", e);
+ }
+ }
+}
Modified:
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
---
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-05-25
17:50:59 UTC (rev 667)
+++
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-05-25
18:58:21 UTC (rev 668)
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.ProcessConf;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.Deployment;
@@ -301,13 +302,13 @@
}
public WebServiceClient createClient(
- EndpointMetaData metaData,Definition wsdlDefinition, URL wsdlUrl)
+ EndpointMetaData metaData,Definition wsdlDefinition, URL wsdlUrl, ProcessConf
pconf)
throws EndpointManagementException
{
try
{
WebServiceClient client =
- new WebServiceClient(metaData, wsdlDefinition, wsdlUrl, executionEnvironment);
+ new WebServiceClient(metaData, wsdlDefinition, wsdlUrl, executionEnvironment,
pconf);
return client;
Added:
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/JAXWSInitializer.java
===================================================================
---
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/JAXWSInitializer.java
(rev 0)
+++
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/JAXWSInitializer.java 2010-05-25
18:58:21 UTC (rev 668)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.ws;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface defines the component responsible for initializing the
+ * JAX-WS compliant web service stack. Although JAX-WS provides a standard
+ * API for communicating with external web services, it does not provide
+ * standardisation for the initialization of high layers of the web
+ * stack, e.g. related to WS-Security. Therefore, specific initialization
+ * is required on a per stack basis.
+ *
+ * @author gbrown
+ *
+ */
+public interface JAXWSInitializer {
+
+ /**
+ * This method initializes the web service stack in preparation for
+ * calling the service and port supplied as parameters.
+ *
+ * @param serviceName The service name
+ * @param portName The port name
+ * @param baseURI The base URI of the deployment
+ */
+ public void initializeStack(QName serviceName, QName portName, java.net.URI baseURI);
+
+}
Modified:
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceClient.java
===================================================================
---
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceClient.java 2010-05-25
17:50:59 UTC (rev 667)
+++
branches/gbrown/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceClient.java 2010-05-25
18:58:21 UTC (rev 668)
@@ -42,6 +42,7 @@
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
+import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.utils.DOMUtils;
import org.jboss.soa.bpel.runtime.engine.EndpointReference;
@@ -58,6 +59,8 @@
*/
public class WebServiceClient implements PartnerChannel
{
+ private static final String JAXWS_CLIENT_INITIALIZER =
"jaxws.client.initializer.impl";
+
protected final Log log = LogFactory.getLog(getClass());
private URL wsdlUrl;
@@ -74,8 +77,10 @@
private SOAPMessageAdapter messageAdapter;
private ExecutionEnvironment executionEnvironment;
-
- public WebServiceClient(EndpointMetaData metaData, Definition wsdlDefintion, URL
wsdlUrl , ExecutionEnvironment env)
+ private java.net.URI baseURI;
+
+ public WebServiceClient(EndpointMetaData metaData, Definition wsdlDefintion, URL
wsdlUrl , ExecutionEnvironment env,
+ ProcessConf pconf)
{
this.executionEnvironment = env;
this.metaData = metaData;
@@ -87,7 +92,11 @@
this.port = new QName(serviceName.getNamespaceURI(), metaData.getPortName());
this.messageAdapter = new SOAPMessageAdapter(this.wsdlDefintion, serviceName,
port.getLocalPart());
- }
+
+ this.baseURI = pconf.getBaseURI();
+
+ log.debug("Web Service Client: Base URI="+pconf.getBaseURI());
+ }
public EndpointReference getEndpointReference()
{
@@ -292,6 +301,8 @@
if(null==dispatcher)
{
log.debug("Creating Dispatcher ("+this.id+") on " + wsdlUrl +
": "+serviceName);
+
+ initializeStack(portName);
Service service = Service.create(this.wsdlUrl, serviceName);
dispatcher = service.createDispatch(
@@ -303,7 +314,30 @@
return dispatcher;
}
+
+ private synchronized void initializeStack(QName portName) {
+ String
impl=this.executionEnvironment.getOdeConfig().getProperty(JAXWS_CLIENT_INITIALIZER);
+ if (impl != null && impl.trim().length() > 0) {
+ JAXWSInitializer initializer=null;
+
+ try {
+ Class<?> cls=Class.forName(impl);
+
+ initializer = (JAXWSInitializer)cls.newInstance();
+
+ } catch(Exception e) {
+ log.error("Unable to obtain JAXWS Initializer class
'"+impl+"'", e);
+ }
+
+ if (initializer != null) {
+ initializer.initializeStack(this.serviceName, portName, this.baseURI);
+ }
+ } else {
+ log.debug("JAXWS Client Initializer not defined");
+ }
+ }
+
public String toString()
{
return "WebServiceClient
{service="+serviceName+",port="+port+"}";