You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2010/02/23 10:06:18 UTC
svn commit: r915251 - in
/servicemix/components/bindings/servicemix-cxf-bc/trunk/src:
main/java/org/apache/servicemix/cxfbc/
test/resources/org/apache/servicemix/cxfbc/ws/security/
Author: ffang
Date: Tue Feb 23 09:06:17 2010
New Revision: 915251
URL: http://svn.apache.org/viewvc?rev=915251&view=rev
Log:
[SMXCOMP-712]CXF-BC Consumer / Provider can't accept generic properties in configurtion options.
Modified:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas.xml
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=915251&r1=915250&r2=915251&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Tue Feb 23 09:06:17 2010
@@ -181,6 +181,8 @@
private boolean schemaValidationEnabled;
private boolean delegateToJaas = true;
+
+ private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
/**
* @return the wsdl
@@ -515,6 +517,7 @@
ep.getOutInterceptors().add(new AttachmentOutInterceptor());
ep.getOutInterceptors().add(new StaxOutInterceptor());
ep.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
+ ep.putAll(this.getProperties());
cxfService.getInInterceptors().addAll(getBus().getInInterceptors());
cxfService.getInFaultInterceptors().addAll(
@@ -1173,4 +1176,19 @@
return delegateToJaas;
}
+ /**
+ * Sets arbitrary properties that are added to the CXF context at
+ * the Endpoint level.
+ *
+ * @param properties
+ * the properties to add
+ * @org.apache.xbean.Property description="Sets arbitrary properties that are added to the CXF context at the Endpoint level"
+ */
+ public void setProperties(Map<String, Object> properties) {
+ this.properties.putAll(properties);
+ }
+
+ public Map<String, Object> getProperties() {
+ return this.properties;
+ }
}
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=915251&r1=915250&r2=915251&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java Tue Feb 23 09:06:17 2010
@@ -17,16 +17,13 @@
package org.apache.servicemix.cxfbc;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.jbi.management.DeploymentException;
@@ -42,12 +39,8 @@
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Transformer;
import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -57,7 +50,6 @@
import com.ibm.wsdl.Constants;
import org.apache.cxf.Bus;
-import org.apache.cxf.binding.AbstractBindingFactory;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.SoapVersion;
@@ -160,6 +152,9 @@
private boolean schemaValidationEnabled;
private List<AbstractFeature> features = new CopyOnWriteArrayList<AbstractFeature>();
+
+ private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
+
public void processExchange(MessageExchange exchange) {
@@ -480,6 +475,7 @@
ep = new EndpointImpl(getBus(), cxfService, ei);
+ this.ep.putAll(this.getProperties());
// init transport
if (locationURI != null) {
@@ -746,4 +742,19 @@
return this.providedBus;
}
+ /**
+ * Sets arbitrary properties that are added to the CXF context at
+ * the Endpoint level.
+ *
+ * @param properties
+ * the properties to add
+ * @org.apache.xbean.Property description="Sets arbitrary properties that are added to the CXF context at the Endpoint level"
+ */
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, Object> getProperties() {
+ return this.properties;
+ }
}
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml?rev=915251&r1=915250&r2=915251&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml Tue Feb 23 09:06:17 2010
@@ -42,30 +42,7 @@
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
- <cxf:bus>
- <!-- We have to put these at the bus level because the CXF-BC Provider/Consumer
- configuration does not allow one to specify them at the client level. -->
- <cxf:properties>
- <entry value="org.apache.servicemix.cxfbc.ws.security.KeystorePasswordCallback">
- <key>
- <util:constant
- static-field="org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER"/>
- </key>
- </entry>
- <entry value="bob">
- <key>
- <util:constant
- static-field="org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME"/>
- </key>
- </entry>
- <entry value="org/apache/servicemix/cxfbc/ws/security/bob.properties">
- <key>
- <util:constant
- static-field="org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_PROPERTIES"/>
- </key>
- </entry>
- </cxf:properties>
- </cxf:bus>
+ <cxf:bus/>
<bean class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
<constructor-arg ref="cxf"/>
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas.xml?rev=915251&r1=915250&r2=915251&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-jaas.xml Tue Feb 23 09:06:17 2010
@@ -20,6 +20,7 @@
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
+ xmlns:util="http://www.springframework.org/schema/util"
xmlns:greeter="http://apache.org/hello_world_soap_http">
<sm:container id="jbi" embedded="true">
@@ -82,7 +83,8 @@
targetEndpoint="TimestampSignEncrypt"
targetService="greeter:SOAPServiceWSSecurity"
targetInterface="greeter:Greeter"
- busCfg="org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml">
+ busCfg="org/apache/servicemix/cxfbc/ws/security/xbean-jaas-policy-bus-context.xml"
+ properties="#properties">
<cxfbc:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</cxfbc:inInterceptors>
@@ -97,9 +99,29 @@
</cxfbc:outFaultInterceptors>
</cxfbc:consumer>
</sm:endpoints>
-
</sm:container>
+ <util:map id="properties">
+ <entry value="org.apache.servicemix.cxfbc.ws.security.KeystorePasswordCallback">
+ <key>
+ <util:constant
+ static-field="org.apache.cxf.ws.security.SecurityConstants.CALLBACK_HANDLER"/>
+ </key>
+ </entry>
+ <entry value="bob">
+ <key>
+ <util:constant
+ static-field="org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_USERNAME"/>
+ </key>
+ </entry>
+ <entry value="org/apache/servicemix/cxfbc/ws/security/bob.properties">
+ <key>
+ <util:constant
+ static-field="org.apache.cxf.ws.security.SecurityConstants.SIGNATURE_PROPERTIES"/>
+ </key>
+ </entry>
+ </util:map>
+
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" id="saajin"/>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" id="saajout"/>
<bean