You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2006/11/13 11:46:58 UTC

svn commit: r474242 - in /incubator/cxf/trunk: distribution/src/main/release/samples/integration/JBI/external_provider_external_consumer/service-unit/ distribution/src/main/release/samples/integration/JBI/external_provider_internal_consumer/service-uni...

Author: ffang
Date: Mon Nov 13 02:46:57 2006
New Revision: 474242

URL: http://svn.apache.org/viewvc?view=rev&rev=474242
Log:
[CXF-38] JBI Integration - adding multiple endpoints support
                           minor change for jbi demo build.xml
                        

Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_external_consumer/service-unit/build.xml
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_internal_consumer/service-unit/build.xml
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-engine/etc/jbi.xml
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-unit/build.xml
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_external_consumer/service-unit/build.xml
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_internal_consumer/service-unit/build.xml
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduitOutputStream.java
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_external_consumer/service-unit/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_external_consumer/service-unit/build.xml?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_external_consumer/service-unit/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_external_consumer/service-unit/build.xml Mon Nov 13 02:46:57 2006
@@ -26,7 +26,7 @@
   <property name="wsdl.dir" location="./wsdl"/>
 
   <property file="../build.properties"/>
-
+  <property file="../../../../../etc/version.properties"/>
   <!-- reuse the macros defined in cxf samples -->
   <import file="${cxf.home}/samples/common_build.xml"/>        
 
@@ -35,7 +35,7 @@
     <pathelement location="${jbi.sdk.jar}"/>
     <fileset dir="${cxf.home}/lib">
       <include name="cxf-incubator.jar"/>
-      <include name="cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar"/>
+      <include name="cxf-integration-jbi-${cxf.version}.jar"/>    
     </fileset>
   </path>
   

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_internal_consumer/service-unit/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_internal_consumer/service-unit/build.xml?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_internal_consumer/service-unit/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/external_provider_internal_consumer/service-unit/build.xml Mon Nov 13 02:46:57 2006
@@ -29,6 +29,7 @@
   <property name="wsdl.dir" location="./wsdl"/>
 
   <property file="../build.properties"/>
+  <property file="../../../../../etc/version.properties"/>
 
   <!-- reuse the macros defined in cxf samples -->
   <import file="${cxf.home}/samples/common_build.xml"/>        
@@ -38,7 +39,7 @@
     <pathelement location="${jbi.sdk.jar}"/>
     <fileset dir="${cxf.home}/lib">
       <include name="cxf-incubator.jar"/>
-      <include name="cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar"/>
+      <include name="cxf-integration-jbi-${cxf.version}.jar"/>
     </fileset>
   </path>
   

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-engine/etc/jbi.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-engine/etc/jbi.xml?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-engine/etc/jbi.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-engine/etc/jbi.xml Mon Nov 13 02:46:57 2006
@@ -27,10 +27,12 @@
     </identification> 
     <component-class-name description="description">org.apache.cxf.jbi.se.CXFServiceEngine</component-class-name> 
     <component-class-path> 
+      <path-element>cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar</path-element>
       <path-element>cxf-incubator.jar</path-element> 
     </component-class-path> 
     <bootstrap-class-name>org.apache.cxf.jbi.se.CXFBootstrap</bootstrap-class-name> 
     <bootstrap-class-path> 
+      <path-element>cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar</path-element>
       <path-element>cxf-incubator.jar</path-element> 
     </bootstrap-class-path> 
   </component> 

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-unit/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-unit/build.xml?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-unit/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/handlers/service-unit/build.xml Mon Nov 13 02:46:57 2006
@@ -35,6 +35,7 @@
     <pathelement location="${jbi.sdk.jar}"/>
     <fileset dir="${cxf.home}/lib">
       <include name="cxf-incubator.jar"/>
+      <include name="cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar"/>
     </fileset>
   </path>
   

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_external_consumer/service-unit/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_external_consumer/service-unit/build.xml?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_external_consumer/service-unit/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_external_consumer/service-unit/build.xml Mon Nov 13 02:46:57 2006
@@ -28,6 +28,7 @@
   <property name="wsdl.dir" location="./wsdl"/>
 
   <property file="../build.properties"/>
+  <property file="../../../../../etc/version.properties"/>
 
   <!-- reuse the macros defined in CXF samples -->
   <import file="${cxf.home}/samples/common_build.xml"/>        
@@ -37,7 +38,7 @@
     <pathelement location="${jbi.sdk.jar}"/>
     <fileset dir="${cxf.home}/lib">
       <include name="cxf-incubator.jar"/>
-      <include name="cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar"/>
+      <include name="cxf-integration-jbi-${cxf.version}.jar"/>
     </fileset>
   </path>
   

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_internal_consumer/service-unit/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_internal_consumer/service-unit/build.xml?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_internal_consumer/service-unit/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/JBI/internal_provider_internal_consumer/service-unit/build.xml Mon Nov 13 02:46:57 2006
@@ -27,6 +27,7 @@
   <property name="wsdl.dir" location="./wsdl"/>
 
   <property file="../build.properties"/>
+  <property file="../../../../../etc/version.properties"/>
 
   <!-- reuse the macros defined in CXF samples -->
   <import file="${cxf.home}/samples/common_build.xml"/>        
@@ -36,7 +37,7 @@
     <pathelement location="${jbi.sdk.jar}"/>
     <fileset dir="${cxf.home}/lib">
       <include name="cxf-incubator.jar"/>
-      <include name="cxf-integration-jbi-2.0-incubator-M1-SNAPSHOT.jar"/>
+      <include name="cxf-integration-jbi-${cxf.version}.jar"/>
     </fileset>
   </path>
   

Modified: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduitOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduitOutputStream.java?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduitOutputStream.java (original)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduitOutputStream.java Mon Nov 13 02:46:57 2006
@@ -34,6 +34,7 @@
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
+//import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
@@ -42,6 +43,7 @@
 import org.apache.cxf.io.AbstractCachedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+//import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
@@ -135,6 +137,12 @@
 
                     channel.sendSync(xchng);
                     NormalizedMessage outMsg = ((InOut)xchng).getOutMessage();
+                    
+                    //revisit later
+                    /*Source content = outMsg.getContent();
+                    XMLStreamReader reader = StaxUtils.createXMLStreamReader(content);
+                    message.setContent(XMLStreamReader.class, reader);*/
+                    
                     ins = JBIMessageHelper.convertMessageToInputStream(outMsg.getContent());
                     if (ins == null) {
                         throw new IOException(new org.apache.cxf.common.i18n.Message(

Modified: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java (original)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java Mon Nov 13 02:46:57 2006
@@ -127,6 +127,10 @@
         incomingObserver = observer;
 
     }
+    
+    public MessageObserver getMessageObserver() {
+        return incomingObserver;
+    }
 
     private void deactivate() throws IOException {
         running = false;
@@ -211,13 +215,15 @@
                 running = true;
                 LOG.info(new org.apache.cxf.common.i18n.Message(
                     "RECEIVE.THREAD.START", LOG).toString());
-                do { 
-                    MessageExchange exchange = channel.accept(); 
+                do {
+                    MessageExchange exchange = null;
+                    synchronized (channel) {
+                        exchange = channel.accept();
+                    }
+                                         
                     if (exchange != null) { 
-                        // REVISIT: serialized message handling not such a
-                        // good idea.
-                        // REVISIT: can there be more than one ep?
                         ServiceEndpoint ep = exchange.getEndpoint();
+                        
                         CXFServiceUnit csu = suManager.getServiceUnitForEndpoint(ep);
                         ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
                         
@@ -258,9 +264,15 @@
             inMessage.put(JBIConstants.MESSAGE_EXCHANGE_PROPERTY, exchange);
             inMessage.setContent(InputStream.class, in);
                                            
-            inMessage.setDestination(this);            
-            //handle the incoming message
-            incomingObserver.onMessage(inMessage);
+            //dispatch to correct destination in case of multiple endpoint
+            inMessage.setDestination(((JBITransportFactory)conduitInitiator).
+                                     getDestination(exchange.getService().toString()
+                                     + exchange.getInterfaceName().toString()));
+            ((JBITransportFactory)conduitInitiator).
+            getDestination(exchange.getService().toString()
+                           + exchange.getInterfaceName().toString()).
+                getMessageObserver().onMessage(inMessage);
+            
         } catch (Exception ex) {
             LOG.log(Level.SEVERE, new org.apache.cxf.common.i18n.Message(
                 "ERROR.PREPARE.MESSAGE", LOG).toString(), ex);

Modified: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java?view=diff&rev=474242&r1=474241&r2=474242
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java (original)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBITransportFactory.java Mon Nov 13 02:46:57 2006
@@ -22,10 +22,13 @@
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
+import javax.jbi.JBIException;
 import javax.jbi.messaging.DeliveryChannel;
 
 import org.apache.cxf.Bus;
@@ -50,6 +53,8 @@
     private static CXFServiceUnitManager suManager; 
     private static DeliveryChannel deliveryChannel;
     private Bus bus;
+    private final Map<String, JBIDestination> destinationMap = 
+        new HashMap<String, JBIDestination>();
     
 
     private Collection<String> activationNamespaces;
@@ -131,7 +136,25 @@
         if (null != configurer) {
             configurer.configureBean(destination);
         }
+        try {
+            putDestination(ei.getService().getName().toString() 
+                           + ei.getInterface().getName().toString(), destination);
+        } catch (JBIException e) {
+            throw new IOException(e.getMessage());
+        }
         return destination;
     }
+    
+    public void putDestination(String epName, JBIDestination destination) throws JBIException {
+        if (destinationMap.containsKey(epName)) {
+            throw new JBIException("JBIDestination for Endpoint " 
+                                   + epName + " already be created");
+        } else {
+            destinationMap.put(epName, destination);
+        }
+    }
 
+    public JBIDestination getDestination(String epName) {
+        return destinationMap.get(epName);
+    }
 }