Author: gnodet
Date: Wed Jul  2 12:45:41 2008
New Revision: 673475

URL: http://svn.apache.org/viewvc?rev=673475&view=rev
Log:
Reduce the number of dependencies of cxf-bc, make it osgi friendly (SM-1387)

Added:
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java
   (contents, props changed)
      - copied, changed from r673461, 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiConstants.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiFault.java
Removed:
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiConstants.java
Modified:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcComponent.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConfiguration.java
    
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/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiAddressingInterceptor.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiJAASInterceptor.java
    
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcAddressingTest.java

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml Wed Jul  2 
12:45:41 2008
@@ -52,6 +52,17 @@
     <spring-version>2.0.6</spring-version>
     <derby-version>10.2.2.0</derby-version>
     <surefire.fork.mode>pertest</surefire.fork.mode>
+
+    <servicemix.osgi.import>
+        org.apache.servicemix.common.osgi,
+        org.apache.xbean.spring.context.v2,
+        org.springframework.beans.factory.xml,
+        *
+    </servicemix.osgi.import>
+    <servicemix.osgi.export>
+        org.apache.servicemix*;version=${project.version},
+        
META-INF.services.org.apache.xbean.spring.http.servicemix.apache.org.cxfbc
+    </servicemix.osgi.export>
   </properties>
 
   <dependencies>
@@ -131,29 +142,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-transports-jbi</artifactId>
-      <version>${cxf-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.servicemix</groupId>
-          <artifactId>servicemix-jbi</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-bindings-jbi</artifactId>
-      <version>${cxf-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.servicemix</groupId>
-          <artifactId>servicemix-jbi</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    
-    <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <version>${jetty-version}</version>

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcComponent.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcComponent.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcComponent.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcComponent.java
 Wed Jul  2 12:45:41 2008
@@ -22,8 +22,6 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.servicemix.common.DefaultComponent;
-import org.apache.servicemix.jbi.security.auth.AuthenticationService;
-import org.apache.servicemix.jbi.security.auth.impl.JAASAuthenticationService;
 
 /**
  * 
@@ -77,9 +75,14 @@
             try {
                 String name = 
getConfiguration().getAuthenticationServiceName();
                 Object as = context.getNamingContext().lookup(name);
-                
getConfiguration().setAuthenticationService((AuthenticationService) as);
+                getConfiguration().setAuthenticationService(as);
             } catch (Throwable e) {
-                getConfiguration().setAuthenticationService(new 
JAASAuthenticationService());
+                try {
+                    Class cl = 
Class.forName("org.apache.servicemix.jbi.security.auth.impl.JAASAuthenticationService");
+                    
getConfiguration().setAuthenticationService(cl.newInstance());
+                } catch (Throwable t) {
+                    logger.warn("Unable to retrieve or create the 
authentication service");
+                }
             }
         }
         super.doInit();

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConfiguration.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConfiguration.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConfiguration.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConfiguration.java
 Wed Jul  2 12:45:41 2008
@@ -16,11 +16,9 @@
  */
 package org.apache.servicemix.cxfbc;
 
-import org.apache.servicemix.jbi.security.auth.AuthenticationService;
-
 public class CxfBcConfiguration {
 
-    private transient AuthenticationService authenticationService;
+    private transient Object authenticationService;
     
     /**
      * The JNDI name of the AuthenticationService object
@@ -31,14 +29,14 @@
     /**
      * @return the authenticationService
      */
-    public AuthenticationService getAuthenticationService() {
+    public Object getAuthenticationService() {
         return authenticationService;
     }
 
     /**
      * @param authenticationService the authenticationService to set
      */
-    public void setAuthenticationService(AuthenticationService 
authenticationService) {
+    public void setAuthenticationService(Object authenticationService) {
         this.authenticationService = authenticationService;
     }
 

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=673475&r1=673474&r2=673475&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
 Wed Jul  2 12:45:41 2008
@@ -48,7 +48,6 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.binding.AbstractBindingFactory;
-import org.apache.cxf.binding.jbi.JBIFault;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor;
@@ -91,12 +90,14 @@
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
 import org.apache.servicemix.common.endpoints.ConsumerEndpoint;
+import org.apache.servicemix.common.security.AuthenticationService;
 import org.apache.servicemix.cxfbc.interceptors.JbiInInterceptor;
 import org.apache.servicemix.cxfbc.interceptors.JbiInWsdl1Interceptor;
 import org.apache.servicemix.cxfbc.interceptors.JbiJAASInterceptor;
 import org.apache.servicemix.cxfbc.interceptors.JbiOperationInterceptor;
 import org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor;
 import org.apache.servicemix.cxfbc.interceptors.MtomCheckInterceptor;
+import org.apache.servicemix.cxfbc.interceptors.JbiFault;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.soap.util.DomUtil;
 import org.mortbay.jetty.Handler;
@@ -288,8 +289,9 @@
                     new JbiInWsdl1Interceptor(isUseJBIWrapper()));
             cxfService.getInInterceptors().add(new JbiInInterceptor());
             cxfService.getInInterceptors().add(new JbiJAASInterceptor(
-                    ((CxfBcComponent)this.getServiceUnit().getComponent()).
-                    getConfiguration().getAuthenticationService()));
+                    AuthenticationService.Proxy.create(
+                        ((CxfBcComponent)this.getServiceUnit().getComponent()).
+                            getConfiguration().getAuthenticationService())));
             cxfService.getInInterceptors().add(new JbiInvokerInterceptor());
             cxfService.getInInterceptors().add(new 
JbiPostInvokerInterceptor());
 
@@ -551,7 +553,7 @@
                 if (exchange.getFault() != null) {
                     Fault f = null;
                     if (isUseJBIWrapper()) {
-                        f = new JBIFault(
+                        f = new JbiFault(
                                 new org.apache.cxf.common.i18n.Message(
                                         "Fault occured", (ResourceBundle) 
null));
                         Element details = toElement(exchange.getFault()

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=673475&r1=673474&r2=673475&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
 Wed Jul  2 12:45:41 2008
@@ -18,6 +18,9 @@
 
 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;
@@ -35,8 +38,12 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
+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;
@@ -47,9 +54,6 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.AbstractBindingFactory;
 
-import org.apache.cxf.binding.jbi.JBIConstants;
-import org.apache.cxf.binding.jbi.JBIFault;
-
 import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
@@ -76,17 +80,18 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.ConduitInitiatorManager;
-import org.apache.cxf.transport.jbi.JBIMessageHelper;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.SchemaUtil;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
-import org.apache.servicemix.JbiConstants;
+import org.apache.servicemix.common.JbiConstants;
 import org.apache.servicemix.common.endpoints.ProviderEndpoint;
 import org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor;
 import org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor;
 import org.apache.servicemix.cxfbc.interceptors.MtomCheckInterceptor;
+import org.apache.servicemix.cxfbc.interceptors.JbiFault;
+import org.apache.servicemix.cxfbc.interceptors.CxfJbiConstants;
 import org.apache.servicemix.soap.util.DomUtil;
 import org.springframework.core.io.Resource;
 
@@ -98,6 +103,8 @@
 public class CxfBcProvider extends ProviderEndpoint implements
         CxfBcEndpointWithInterceptor {
 
+    private static final TransformerFactory TRANSFORMER_FACTORY = 
TransformerFactory.newInstance();
+
     List<Interceptor> in = new CopyOnWriteArrayList<Interceptor>();
 
     List<Interceptor> out = new CopyOnWriteArrayList<Interceptor>();
@@ -200,7 +207,7 @@
         outChain.add(getOutInterceptors());
         outChain.add(getOutFaultInterceptors());
         message.setInterceptorChain(outChain);
-        InputStream is = JBIMessageHelper.convertMessageToInputStream(nm
+        InputStream is = convertMessageToInputStream(nm
                 .getContent());
 
         StreamSource source = new StreamSource(is);
@@ -259,8 +266,8 @@
     private void handleJBIFault(Message message, String detail) {
         Document doc = DomUtil.createDocument();
         Element jbiFault = DomUtil.createElement(doc, new QName(
-                JBIConstants.NS_JBI_BINDING, JBIFault.JBI_FAULT_ROOT));
-        Node jbiFaultDetail = DomUtil.createElement(jbiFault, new QName("", 
JBIFault.JBI_FAULT_DETAIL));
+                CxfJbiConstants.WSDL11_WRAPPER_NAMESPACE, 
JbiFault.JBI_FAULT_ROOT));
+        Node jbiFaultDetail = DomUtil.createElement(jbiFault, new QName("", 
JbiFault.JBI_FAULT_DETAIL));
         jbiFaultDetail.setTextContent(detail);
         jbiFault.appendChild(jbiFaultDetail);
         message.setContent(Source.class, new DOMSource(doc));
@@ -468,4 +475,11 @@
         return useJBIWrapper;
     }
 
+    protected InputStream convertMessageToInputStream(Source src) throws 
IOException, TransformerException {
+        final Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        StreamResult result = new StreamResult(baos);
+        transformer.transform(src, result);
+        return new ByteArrayInputStream(baos.toByteArray());
+    }
 }

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
 Wed Jul  2 12:45:41 2008
@@ -44,7 +44,7 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.MessageObserver;
-import org.apache.servicemix.JbiConstants;
+import org.apache.servicemix.common.JbiConstants;
 import org.apache.servicemix.cxfbc.interceptors.JbiInWsdl1Interceptor;
 import org.apache.servicemix.cxfbc.interceptors.RetrievePayLoadInterceptor;
 

Copied: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java
 (from r673461, 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiConstants.java)
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java?p2=servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java&p1=servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiConstants.java&r1=673461&r2=673475&rev=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiConstants.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java
 Wed Jul  2 12:45:41 2008
@@ -23,7 +23,7 @@
 /**
  * @author <a href="mailto:gnodet [at] gmail.com">Guillaume Nodet</a>
  */
-public final class JbiConstants {
+public final class CxfJbiConstants {
 
     public static final String SOAP_FAULT_CODE = 
"org.apache.servicemix.soap.fault.code";
 
@@ -35,17 +35,13 @@
 
     public static final String SOAP_FAULT_ROLE = 
"org.apache.servicemix.soap.fault.role";
 
-    public static final URI IN_ONLY = URI
-            .create("http://www.w3.org/2004/08/wsdl/in-only";);
+    public static final URI IN_ONLY = 
URI.create("http://www.w3.org/2004/08/wsdl/in-only";);
 
-    public static final URI IN_OUT = URI
-            .create("http://www.w3.org/2004/08/wsdl/in-out";);
+    public static final URI IN_OUT = 
URI.create("http://www.w3.org/2004/08/wsdl/in-out";);
 
-    public static final URI IN_OPTIONAL_OUT = URI
-            .create("http://www.w3.org/2004/08/wsdl/in-opt-out";);
+    public static final URI IN_OPTIONAL_OUT = 
URI.create("http://www.w3.org/2004/08/wsdl/in-opt-out";);
 
-    public static final URI ROBUST_IN_ONLY = URI
-            .create("http://www.w3.org/2004/08/wsdl/robust-in-only";);
+    public static final URI ROBUST_IN_ONLY = 
URI.create("http://www.w3.org/2004/08/wsdl/robust-in-only";);
 
     public static final String PROTOCOL_HEADERS = 
"javax.jbi.messaging.protocol.headers";
 
@@ -80,7 +76,7 @@
     public static final QName WSDL11_WRAPPER_PART = new QName(
             WSDL11_WRAPPER_NAMESPACE, WSDL11_WRAPPER_PART_LOCALNAME,
             WSDL11_WRAPPER_PREFIX);
-    private JbiConstants() {
+    private CxfJbiConstants() {
         //Added to keep checkstyle 4.3 happy.
     }
 

Propchange: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/CxfJbiConstants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiAddressingInterceptor.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiAddressingInterceptor.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiAddressingInterceptor.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiAddressingInterceptor.java
 Wed Jul  2 12:45:41 2008
@@ -28,7 +28,7 @@
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.ContextUtils;
 import org.apache.servicemix.cxfbc.CxfBcConsumer;
-import org.apache.servicemix.jbi.resolver.URIResolver;
+import org.apache.servicemix.common.util.URIResolver;
 
 
 public class JbiAddressingInterceptor extends 
AbstractPhaseInterceptor<Message> {
@@ -50,8 +50,8 @@
         if (action != null) {
             String value = action.getValue();
             
-            if (value != null && value.endsWith(JbiConstants.JBI_SUFFIX)) {
-                value = value.substring(0, 
value.indexOf(JbiConstants.JBI_SUFFIX) - 1);
+            if (value != null && value.endsWith(CxfJbiConstants.JBI_SUFFIX)) {
+                value = value.substring(0, 
value.indexOf(CxfJbiConstants.JBI_SUFFIX) - 1);
                 String[] parts = URIResolver.split3(value);
                 MessageExchange exchange = 
message.getContent(MessageExchange.class);
                 exchange.setOperation(new QName(parts[0], parts[2]));
@@ -62,8 +62,8 @@
         AttributedURIType to = maps.getTo();
         if (to != null) {
             String toAddress = to.getValue();
-            if (toAddress != null && 
toAddress.endsWith(JbiConstants.JBI_SUFFIX)) {
-                toAddress = toAddress.substring(0, 
toAddress.indexOf(JbiConstants.JBI_SUFFIX) - 1);
+            if (toAddress != null && 
toAddress.endsWith(CxfJbiConstants.JBI_SUFFIX)) {
+                toAddress = toAddress.substring(0, 
toAddress.indexOf(CxfJbiConstants.JBI_SUFFIX) - 1);
                 String[] parts = URIResolver.split3(toAddress);
                 MessageExchange exchange = 
message.getContent(MessageExchange.class);
                 exchange.setService(new QName(parts[0], parts[1]));

Added: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiFault.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiFault.java?rev=673475&view=auto
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiFault.java
 (added)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiFault.java
 Wed Jul  2 12:45:41 2008
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.cxfbc.interceptors;
+
+import java.util.ResourceBundle;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.interceptor.Fault;
+
+public class JbiFault extends Fault {
+
+    public static final String JBI_FAULT_PREFIX = "jfns";
+
+    public static final String JBI_FAULT_ROOT = "JBIFault";
+    public static final String JBI_FAULT_STRING = "faultstring";
+
+    public static final String JBI_FAULT_DETAIL = "detail";
+
+    public static final String JBI_FAULT_CODE_SERVER = "SERVER";
+
+    public static final String JBI_FAULT_CODE_CLIENT = "CLIENT";
+
+
+    static final long serialVersionUID = 100000;
+
+    public JbiFault(Message message, Throwable throwable) {
+        super(message, throwable);
+    }
+
+    public JbiFault(Message message) {
+        super(message);
+    }
+
+    public JbiFault(String message) {
+        super(new Message(message, (ResourceBundle) null));
+    }
+
+    public static JbiFault createFault(Fault f) {
+        if (f instanceof JbiFault) {
+            return (JbiFault) f;
+        }
+        Throwable th = f.getCause();
+        JbiFault jbiFault = new JbiFault(new Message(f.getMessage(), 
(ResourceBundle) null), th);
+        jbiFault.setDetail(f.getDetail());
+        return jbiFault;
+    }
+
+}

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
 Wed Jul  2 12:45:41 2008
@@ -40,7 +40,6 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.servicemix.cxfbc.WSAUtils;
-import org.apache.servicemix.jbi.messaging.MessageExchangeSupport;
 import org.apache.servicemix.soap.util.QNameUtil;
 
 /**
@@ -107,12 +106,12 @@
         if (operation != null) {
             if (operation.getOutput() == null) {
                 if (operation.getFaults().size() == 0) {
-                    mep = MessageExchangeSupport.IN_ONLY;
+                    mep = CxfJbiConstants.IN_ONLY;
                 } else {
-                    mep = MessageExchangeSupport.ROBUST_IN_ONLY;
+                    mep = CxfJbiConstants.ROBUST_IN_ONLY;
                 }
             } else {
-                mep = MessageExchangeSupport.IN_OUT;
+                mep = CxfJbiConstants.IN_OUT;
             }
         } else {
             mep = (URI) message.get(OPERATION_MEP);
@@ -171,11 +170,10 @@
         }
         Map<String, Object> headers = new HashMap<String, Object>();
         for (Header header : message.getHeaders()) {
-            headers.put(QNameUtil.toString(header.getName()), header
-                    .getObject());
+            headers.put(QNameUtil.toString(header.getName()), 
header.getObject());
         }
 
-        normalizedMessage.setProperty(JbiConstants.PROTOCOL_HEADERS, headers);
+        normalizedMessage.setProperty(CxfJbiConstants.PROTOCOL_HEADERS, 
headers);
 
     }
 

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
 Wed Jul  2 12:45:41 2008
@@ -31,8 +31,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import org.apache.cxf.binding.jbi.JBIConstants;
-import org.apache.cxf.binding.jbi.JBIFault;
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -102,7 +100,7 @@
 
             document = DomUtil.createDocument();
             Element root = DomUtil.createElement(document,
-                    JbiConstants.WSDL11_WRAPPER_MESSAGE);
+                    CxfJbiConstants.WSDL11_WRAPPER_MESSAGE);
             String typeNamespace = wsdlMessage.getMessageInfo().getName()
                     .getNamespaceURI();
             if (typeNamespace == null || typeNamespace.length() == 0) {
@@ -110,15 +108,15 @@
                         "messageType namespace is null or empty");
             }
             root.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":"
-                            + JbiConstants.WSDL11_WRAPPER_MESSAGE_PREFIX,
+                            + CxfJbiConstants.WSDL11_WRAPPER_MESSAGE_PREFIX,
                             typeNamespace);
             
             root.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":"
-                    + JbiConstants.WSDL11_WRAPPER_XSD_PREFIX,
+                    + CxfJbiConstants.WSDL11_WRAPPER_XSD_PREFIX,
                     XMLConstants.W3C_XML_SCHEMA_NS_URI);
 
             root.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":"
-                    + JbiConstants.WSDL11_WRAPPER_XSI_PREFIX,
+                    + CxfJbiConstants.WSDL11_WRAPPER_XSI_PREFIX,
                     XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
             
             String typeLocalName = wsdlMessage.getMessageInfo().getName()
@@ -127,13 +125,13 @@
                 throw new IllegalArgumentException(
                         "messageType local name is null or empty");
             }
-            root.setAttribute(JbiConstants.WSDL11_WRAPPER_TYPE,
-                    JbiConstants.WSDL11_WRAPPER_MESSAGE_PREFIX + ":"
+            root.setAttribute(CxfJbiConstants.WSDL11_WRAPPER_TYPE,
+                    CxfJbiConstants.WSDL11_WRAPPER_MESSAGE_PREFIX + ":"
                             + typeLocalName);
             String messageName = wsdlMessage.getMessageInfo().getName()
                     .getLocalPart();
-            root.setAttribute(JbiConstants.WSDL11_WRAPPER_NAME, messageName);
-            root.setAttribute(JbiConstants.WSDL11_WRAPPER_VERSION, "1.0");
+            root.setAttribute(CxfJbiConstants.WSDL11_WRAPPER_NAME, 
messageName);
+            root.setAttribute(CxfJbiConstants.WSDL11_WRAPPER_VERSION, "1.0");
 
             SoapBindingInfo binding = (SoapBindingInfo) message.getExchange()
                     .get(Endpoint.class).getEndpointInfo().getBinding();
@@ -224,7 +222,7 @@
     private void handleJBIFault(SoapMessage message, Element soapFault) {
         Document doc = DomUtil.createDocument();
         Element jbiFault = DomUtil.createElement(doc, new QName(
-                JBIConstants.NS_JBI_BINDING, JBIFault.JBI_FAULT_ROOT));
+                CxfJbiConstants.WSDL11_WRAPPER_NAMESPACE, 
JbiFault.JBI_FAULT_ROOT));
         Node jbiFaultDetail = null;
         if (message.getVersion() instanceof Soap11) {
             jbiFaultDetail = doc.importNode(soapFault.getElementsByTagName(
@@ -331,7 +329,7 @@
      */
     private static void addPart(Element parent, Node partValue) {
         Element element = DomUtil.createElement(parent,
-                JbiConstants.WSDL11_WRAPPER_PART);
+                CxfJbiConstants.WSDL11_WRAPPER_PART);
         element.appendChild(element.getOwnerDocument().importNode(partValue,
                 true));
     }
@@ -341,7 +339,7 @@
      */
     private static void addPart(Element parent, NodeList nodes) {
         Element element = DomUtil.createElement(parent,
-                JbiConstants.WSDL11_WRAPPER_PART);
+                CxfJbiConstants.WSDL11_WRAPPER_PART);
         for (int i = 0; i < nodes.getLength(); i++) {
             Node node = nodes.item(i);
             element.appendChild(element.getOwnerDocument().importNode(node,
@@ -379,4 +377,5 @@
     protected boolean isRequestor(Message message) {
         return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
     }
+
 }

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiJAASInterceptor.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiJAASInterceptor.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiJAASInterceptor.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiJAASInterceptor.java
 Wed Jul  2 12:45:41 2008
@@ -28,7 +28,7 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.ws.security.wss4j.AbstractWSS4JInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
-import org.apache.servicemix.jbi.security.auth.AuthenticationService;
+import org.apache.servicemix.common.security.AuthenticationService;
 import org.apache.ws.security.WSSecurityEngineResult;
 import org.apache.ws.security.WSUsernameTokenPrincipal;
 import org.apache.ws.security.handler.WSHandlerConstants;

Modified: 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcAddressingTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcAddressingTest.java?rev=673475&r1=673474&r2=673475&view=diff
==============================================================================
--- 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcAddressingTest.java
 (original)
+++ 
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcAddressingTest.java
 Wed Jul  2 12:45:41 2008
@@ -45,7 +45,7 @@
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
 import org.apache.hello_world_soap_http.SOAPService;
-import org.apache.servicemix.cxfbc.interceptors.JbiConstants;
+import org.apache.servicemix.cxfbc.interceptors.CxfJbiConstants;
 import org.apache.servicemix.jbi.container.SpringJBIContainer;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.tck.SpringTestSupport;
@@ -194,7 +194,7 @@
         String serviceName = "SOAPServiceWSSecurity";
         String endpointName = "TimestampSignEncrypt";
         
-        to.setValue(ns + delimiter + serviceName + delimiter + endpointName + 
delimiter + JbiConstants.JBI_SUFFIX);
+        to.setValue(ns + delimiter + serviceName + delimiter + endpointName + 
delimiter + CxfJbiConstants.JBI_SUFFIX);
         EndpointReferenceType toRef = new EndpointReferenceType();
         toRef.setAddress(to);
         maps.setTo(toRef);
@@ -219,7 +219,7 @@
             String ns = "http://apache.org/hello_world_soap_http";;
             String interfaceName = "Greeter";
             String operationName = "greetMeSometime";
-            action.setValue(ns + delimiter + interfaceName + delimiter + 
operationName + delimiter + JbiConstants.JBI_SUFFIX);
+            action.setValue(ns + delimiter + interfaceName + delimiter + 
operationName + delimiter + CxfJbiConstants.JBI_SUFFIX);
             maps.setAction(action);
             //associate MAPs with request context
             Map<String, Object> requestContext =
@@ -231,7 +231,7 @@
             checkVerification();
             operationName = "sayHi";
             action.setValue(ns + delimiter + interfaceName + delimiter + 
operationName 
-                    + delimiter + JbiConstants.JBI_SUFFIX);
+                    + delimiter + CxfJbiConstants.JBI_SUFFIX);
             greeting = greeter.greetMe("explicitly set to invoke sayHi");
             assertEquals(greeting, "sayHi:Bonjour");
             checkVerification();


Reply via email to