You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/09/11 19:45:49 UTC

svn commit: r574648 [1/3] - in /incubator/tuscany/java/sca: itest/references/src/main/java/org/apache/tuscany/sca/itest/references/ itest/references/src/main/resources/ itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ modules/ass...

Author: rfeng
Date: Tue Sep 11 10:45:36 2007
New Revision: 574648

URL: http://svn.apache.org/viewvc?rev=574648&view=rev
Log:
Add the first-cut of the following changes:
1) Use wsa:To ReferenceParameters to carry callbackID, conversationID and callbackReference
2) Start the static references during component start
3) Some fix to the multiplicity support for CallableReference

Added:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java   (with props)
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java
      - copied, changed from r573086, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ReferenceParameterProcessor.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java   (with props)
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java   (with props)
Removed:
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ReferenceParameterProcessor.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ReferenceParameters.java
    incubator/tuscany/java/sca/samples/binding-notification-producer/src/test/resources/TrafficAdvisoryNotification.componentType
    incubator/tuscany/java/sca/samples/binding-notification-producer/src/test/resources/TrafficAdvisoryNotification.composite
    incubator/tuscany/java/sca/samples/binding-notification-producer/src/test/resources/wsdl/
Modified:
    incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java
    incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java
    incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java
    incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java
    incubator/tuscany/java/sca/itest/references/src/main/resources/AutoWiredReferencesTest.composite
    incubator/tuscany/java/sca/itest/references/src/main/resources/InnerReferencesTest.composite
    incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
    incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
    incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
    incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ConversationImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
    incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeManagerServiceImpl.java
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/NodeManagerInitService.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
    incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
    incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTargetInvoker.java
    incubator/tuscany/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite
    incubator/tuscany/java/sca/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java

Modified: incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java (original)
+++ incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java Tue Sep 11 10:45:36 2007
@@ -30,5 +30,11 @@
 
     String fooD2();
 
+    String fooMultipleD();
+
+    String fooMultipleDArray();
+
+    String fooMultipleDServiceRef();
+
     DComponent getDReference();
 }

Modified: incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java (original)
+++ incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java Tue Sep 11 10:45:36 2007
@@ -18,6 +18,10 @@
  */
 package org.apache.tuscany.sca.itest.references;
 
+import java.util.Collection;
+import java.util.List;
+
+import org.osoa.sca.ServiceReference;
 import org.osoa.sca.annotations.Reference;
 
 public class AComponentImpl implements AComponent {
@@ -31,6 +35,16 @@
     @Reference(required = false)
     protected DComponent dReference;
 
+    @Reference(name = "dReferences")
+    public Collection<DComponent> dReferences;
+    
+    @Reference(name = "dReferenceArray")
+    public DComponent[] dReferenceArray;
+
+
+    @Reference(name = "dServiceReferences")
+    public List<ServiceReference<DComponent>> dServiceReferences;
+
     private DComponent dReference1;
 
     private DComponent dReference2;
@@ -67,6 +81,42 @@
 
     public String fooD2() {
         return dReference2.dFoo();
+    }
+
+    public String fooMultipleDArray() {
+        StringBuffer str = new StringBuffer();
+        for (DComponent d : dReferenceArray) {
+            str.append(d.getComponentName());
+            str.append(',');
+        }
+        if (str.length() > 0) {
+            str.deleteCharAt(str.length() - 1);
+        }
+        return str.toString();
+    }    
+    
+    public String fooMultipleD() {
+        StringBuffer str = new StringBuffer();
+        for (DComponent d : dReferences) {
+            str.append(d.getComponentName());
+            str.append(',');
+        }
+        if (str.length() > 0) {
+            str.deleteCharAt(str.length() - 1);
+        }
+        return str.toString();
+    }
+    
+    public String fooMultipleDServiceRef() {
+        StringBuffer str = new StringBuffer();
+        for (ServiceReference<DComponent> d : dServiceReferences) {
+            str.append(d.getService().getComponentName());
+            str.append(',');
+        }
+        if (str.length() > 0) {
+            str.deleteCharAt(str.length() - 1);
+        }
+        return str.toString();
     }
 
     public DComponent getDReference() {

Modified: incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java (original)
+++ incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java Tue Sep 11 10:45:36 2007
@@ -21,4 +21,5 @@
 public interface DComponent {
 
     String dFoo();
+    String getComponentName();
 }

Modified: incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java (original)
+++ incubator/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java Tue Sep 11 10:45:36 2007
@@ -18,10 +18,18 @@
  */
 package org.apache.tuscany.sca.itest.references;
 
+import org.osoa.sca.annotations.ComponentName;
+
 public class DComponentImpl implements DComponent {
+    @ComponentName
+    public String name;
 
     public String dFoo() {
         return "DComponent";
+    }
+
+    public String getComponentName() {
+        return name;
     }
 
 }

Modified: incubator/tuscany/java/sca/itest/references/src/main/resources/AutoWiredReferencesTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/main/resources/AutoWiredReferencesTest.composite?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/main/resources/AutoWiredReferencesTest.composite (original)
+++ incubator/tuscany/java/sca/itest/references/src/main/resources/AutoWiredReferencesTest.composite Tue Sep 11 10:45:36 2007
@@ -29,9 +29,13 @@
         <reference name="cReference" autowire="true" />
         <reference name="dReference1" />
         <!-- 
-        <reference name="dReference1" target="DComponent" />
-         -->
+            <reference name="dReference1" target="DComponent" />
+        -->
         <reference name="DReference2" target="DComponent" />
+        <reference name="dReferences" autowire="true" />
+        <reference name="dReferenceArray" autowire="true" />
+        <reference name="dServiceReferences" target="DComponent DComponent1" />
+
     </component>
 
     <component name="BComponent">
@@ -43,6 +47,10 @@
     </component>
 
     <component name="DComponent">
+        <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+    </component>
+
+    <component name="DComponent1">
         <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
     </component>
 </composite>

Modified: incubator/tuscany/java/sca/itest/references/src/main/resources/InnerReferencesTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/main/resources/InnerReferencesTest.composite?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/main/resources/InnerReferencesTest.composite (original)
+++ incubator/tuscany/java/sca/itest/references/src/main/resources/InnerReferencesTest.composite Tue Sep 11 10:45:36 2007
@@ -29,6 +29,9 @@
         <reference name="cReference" target="CComponent" />
         <reference name="dReference1" target="DComponent" />
         <reference name="DReference2" target="DComponent" />
+        <reference name="dReferences" target="DComponent DComponent1" />
+        <reference name="dReferenceArray" target="DComponent1" />
+        <reference name="dServiceReferences" target="DComponent DComponent1" />
     </component>
 
     <component name="BComponent">
@@ -43,4 +46,9 @@
     <component name="DComponent">
         <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
     </component>
+    
+    <component name="DComponent1">
+        <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+    </component>
+        
 </composite>

Modified: incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java Tue Sep 11 10:45:36 2007
@@ -66,6 +66,19 @@
     public void testD2Reference() {
         assertEquals("DComponent", acomponent.fooD2());
     }
+    
+    @Test
+    public void testMultiDReferenceArray() {
+        String components = acomponent.fooMultipleDArray();
+        Assert.assertTrue(components.contains("DComponent1"));
+    }    
+    
+    @Test
+    public void testMultiDServiceReference() {
+        String components = acomponent.fooMultipleDServiceRef();
+        Assert.assertTrue(components.contains("DComponent"));
+        Assert.assertTrue(components.contains("DComponent1"));
+    }        
 
     @Test
     public void testRequiredFalseReference() {

Modified: incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java Tue Sep 11 10:45:36 2007
@@ -65,6 +65,26 @@
     public void testD2Reference() {
         assertEquals("DComponent", acomponent.fooD2());
     }
+    
+    @Test
+    public void testMultiDReference() {
+        String components = acomponent.fooMultipleD();
+        Assert.assertTrue(components.contains("DComponent"));
+        Assert.assertTrue(components.contains("DComponent1"));
+    }
+    
+    @Test
+    public void testMultiDReferenceArray() {
+        String components = acomponent.fooMultipleDArray();
+        Assert.assertTrue(components.equals("DComponent1"));
+    }    
+    
+    @Test
+    public void testMultiDServiceReference() {
+        String components = acomponent.fooMultipleDServiceRef();
+        Assert.assertTrue(components.contains("DComponent"));
+        Assert.assertTrue(components.contains("DComponent1"));
+    }    
 
     @Test
     public void testRequiredFalseReference() {

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java Tue Sep 11 10:45:36 2007
@@ -256,6 +256,9 @@
                         if (isSet(reader, AUTOWIRE)) {
                             component.setAutowire(getBoolean(reader, AUTOWIRE));
                         }
+                        if (isSet(reader, URI)) {
+                            component.setURI(getString(reader, URI));
+                        }
                         component.setConstrainingType(readConstrainingType(reader));
                         composite.getComponents().add(component);
                         policyProcessor.readPolicies(component, reader);

Modified: incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java (original)
+++ incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java Tue Sep 11 10:45:36 2007
@@ -33,35 +33,32 @@
 import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
 import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
 import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
 import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
 public class JMSBindingListener implements MessageListener {
 
-   
-    private JMSBinding              jmsBinding;
-    private JMSResourceFactory      jmsResourceFactory;
+    private JMSBinding jmsBinding;
+    private JMSResourceFactory jmsResourceFactory;
     private RuntimeComponentService service;
-    private JMSMessageProcessor     requestMessageProcessor;
-    private JMSMessageProcessor     responseMessageProcessor;
-    private String                  correlationScheme;
-    private MessageFactory          messageFactory;
+    private JMSMessageProcessor requestMessageProcessor;
+    private JMSMessageProcessor responseMessageProcessor;
+    private String correlationScheme;
+    private MessageFactory messageFactory;
+
     //private Method                  operationMethod;    
 
-    public JMSBindingListener(JMSBinding              jmsBinding,
-                              JMSResourceFactory      jmsResourceFactory,
-                              RuntimeComponentService service) 
-      throws NamingException {
-        this.jmsBinding          = jmsBinding;
-        this.jmsResourceFactory  = jmsResourceFactory;
-        this.service             = service;
-        requestMessageProcessor  = jmsBinding.getRequestMessageProcessor();
+    public JMSBindingListener(JMSBinding jmsBinding,
+                              JMSResourceFactory jmsResourceFactory,
+                              RuntimeComponentService service) throws NamingException {
+        this.jmsBinding = jmsBinding;
+        this.jmsResourceFactory = jmsResourceFactory;
+        this.service = service;
+        requestMessageProcessor = jmsBinding.getRequestMessageProcessor();
         responseMessageProcessor = jmsBinding.getResponseMessageProcessor();
-        correlationScheme        = jmsBinding.getCorrelationScheme();
-        messageFactory           = new MessageFactoryImpl();
+        correlationScheme = jmsBinding.getCorrelationScheme();
+        messageFactory = new MessageFactoryImpl();
     }
 
     public void onMessage(Message requestJMSMsg) {
@@ -82,58 +79,28 @@
      * @throws JMSException
      * @throws InvocationTargetException
      */
-    protected Object invokeService(Message requestJMSMsg) 
-      throws JMSException, InvocationTargetException {
+    protected Object invokeService(Message requestJMSMsg) throws JMSException, InvocationTargetException {
 
         String operationName = requestMessageProcessor.getOperationName(requestJMSMsg);
         Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(requestJMSMsg);
 
-        org.apache.tuscany.sca.invocation.Message requestMsg = messageFactory.createMessage();
+        List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
 
-        requestMsg.setBody(requestPayload);
+        Operation operation = null;
 
-        org.apache.tuscany.sca.invocation.Message workContext = ThreadMessageContext.getMessageContext();
-        ThreadMessageContext.setMessageContext(requestMsg);
-        
-        try {
-            /* TODO - work out how to do this bit 
-             
-            if (isConversational() && conversationID != null) {
-                    requestMsg.setConversationID(conversationID);
-            } else {
-                    requestMsg.setConversationID(null);
-            }
-            */
-            // get the operation object
-            List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
-            
-            Operation operation = null;
-            
-            for(Operation op : opList){
-                if ( op.getName().equals(operationName)) {
-                    operation = op;
-                    break;
-                }
-            }
-            
-            if ( operation != null ){
-            
-                // get the component invoker
-                Invoker invoker = service.getInvoker(jmsBinding, operation);
-    
-                org.apache.tuscany.sca.invocation.Message responseMsg = invoker.invoke(requestMsg);
-
-                if (responseMsg.isFault()) {
-                    throw new InvocationTargetException((Throwable)responseMsg.getBody());
-                }
-                return responseMsg.getBody();
-            } else {
-                throw new JMSBindingException("Can't find operation " + operationName );
+        for (Operation op : opList) {
+            if (op.getName().equals(operationName)) {
+                operation = op;
+                break;
             }
+        }
+
+        if (operation != null) {
+            return service.getRuntimeWire(jmsBinding).invoke(operation, (Object[])requestPayload);
+        } else {
+            throw new JMSBindingException("Can't find operation " + operationName);
+        }
 
-        } finally {
-            ThreadMessageContext.setMessageContext(workContext);
-        }   
     }
 
     protected void sendReply(Message requestJMSMsg, Object responsePayload) {
@@ -150,8 +117,7 @@
             replyJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
             replyJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
 
-            if (correlationScheme == null || 
-                JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
+            if (correlationScheme == null || JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
                 replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
             } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
                 replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());

Modified: incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java (original)
+++ incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java Tue Sep 11 10:45:36 2007
@@ -31,8 +31,6 @@
 import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.MethodProxy;
 
-import org.apache.tuscany.sca.core.invocation.MessageImpl;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
 import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
 import org.apache.tuscany.sca.host.rmi.RMIHost;
 import org.apache.tuscany.sca.host.rmi.RMIHostException;
@@ -40,17 +38,18 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
 import org.osoa.sca.ServiceRuntimeException;
 
 public class RMIService implements ComponentLifecycle {
 
-    RuntimeComponent component;
-    RuntimeComponentService service;
+    private RuntimeComponent component;
+    private RuntimeComponentService service;
     private RMIBinding binding;
-    RMIHost rmiHost;
+    private RMIHost rmiHost;
+    private RuntimeWire wire;
 
     public RMIService(RuntimeComponent rc, RuntimeComponentService rcs, RMIBinding binding, RMIHost rmiHost) {
         this.component = rc;
@@ -63,6 +62,7 @@
         // URI uri = URI.create(component.getURI() + "/" + binding.getName());
         // binding.setURI(uri.toString());
 
+        wire = service.getRuntimeWire(binding);
         Interface serviceInterface = service.getInterfaceContract().getInterface();
 
         Remote rmiProxy = createRmiService(serviceInterface);
@@ -107,19 +107,8 @@
     }
 
     protected Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
-
-        Message requestMsg = new MessageImpl();
-        ThreadMessageContext.setMessageContext(requestMsg);
-        requestMsg.setBody(args);
-
-        Message responseMsg = service.getInvoker(binding, op).invoke(requestMsg);
-
-        if (responseMsg.isFault()) {
-            throw new InvocationTargetException((Throwable)responseMsg.getBody());
-        }
-        return responseMsg.getBody();
+        return wire.invoke(op, args);
     }
-
 
     /**
      * if the interface of the component whose serviceBindings must be exposed as RMI Service, does not

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java Tue Sep 11 10:45:36 2007
@@ -18,8 +18,6 @@
  */
 package org.apache.tuscany.sca.binding.sca.axis2.impl;
 
-import java.net.URL;
-
 import org.apache.tuscany.sca.invocation.Interceptor;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
@@ -36,7 +34,7 @@
 
     private Invoker axis2Invoker;
     private Axis2SCAReferenceBindingProvider provider;
-    
+
     public Axis2SCABindingInvoker(Axis2SCAReferenceBindingProvider provider, Invoker axis2Invoker) {
         this.axis2Invoker = axis2Invoker;
         this.provider = provider;
@@ -61,45 +59,37 @@
         // make sure that the epr of the target service is set in the TO
         // field of the message
         EndpointReference ep = msg.getTo();
-      
+
         // check to see if we either don't have an endpoint set or if the uri 
         // is dynamic or the target service is marked as unresolved
-        if ((ep == null) || 
-            ((ep != null) && (ep.getURI().equals("/"))) ||
-            ((ep != null) && (ep.getContract() == null)) ||
-            ((ep != null) && (ep.getContract().isUnresolved()))){
-            
+        if ((ep == null) || (ep.getURI().equals("/") || (ep.getContract() == null) || (ep.getContract().isUnresolved()))) {
+
             EndpointReference serviceEPR = provider.getServiceEndpoint();
-            
-            if ( serviceEPR == null){
-                throw new ServiceUnavailableException("Endpoint for service: " +
-                                                      provider.getSCABinding().getURI() +
-                                                      " can't be found for component: " +
-                                                      provider.getComponent().getName() +
-                                                      " reference: " + 
-                                                      provider.getComponentReference().getName());
+
+            if (serviceEPR == null) {
+                throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI()
+                    + " can't be found for component: "
+                    + provider.getComponent().getName()
+                    + " reference: "
+                    + provider.getComponentReference().getName());
             }
             msg.setTo(serviceEPR);
         }
-        
+
         // make sure that the epr of the callback service (if there is one) is set
-        // in the FROM field of the message. 
-        ep  = msg.getFrom();
-        
-        if ((ep == null) || 
-            (ep != null) && (ep.getURI().equals("/")) ){
-            
+        // in the from/callback field of the message. 
+        ep = msg.getFrom();
+
+        if ((ep == null) || (ep.getURI().equals("/"))) {
+
             EndpointReference callbackEPR = provider.getCallbackEndpoint();
-            
-            if ( callbackEPR != null){
-                msg.setTo(callbackEPR);
+
+            if (callbackEPR != null) {
+                ep.setCallbackEndpoint(callbackEPR);
             }
         }
-        
-        
-        
+
         // do the axis2 stuff
         return axis2Invoker.invoke(msg);
     }
-
 }

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java Tue Sep 11 10:45:36 2007
@@ -30,15 +30,17 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
-import org.osoa.sca.Constants;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
 
 /**
  * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service
@@ -50,8 +52,13 @@
     private Options options;
     private SOAPFactory soapFactory;
 
-    public static final QName CALLBACK_ID_REFPARM_QN = new QName(Constants.SCA_NS, "CallbackID");
-    public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA_NS, "ConversationID");
+    public static final QName QNAME_WSA_FROM =
+        new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM);
+    public static final QName QNAME_WSA_TO =
+        new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_TO);
+
+    public static final QName CALLBACK_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackID");
+    public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "ConversationID");
 
     public Axis2BindingInvoker(ServiceClient serviceClient,
                                QName wsdlOperationName,
@@ -90,12 +97,12 @@
             MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
 
             OMElement response = responseMC.getEnvelope().getBody().getFirstElement();
-            
+
             // FIXME: [rfeng] We have to pay performance penality to build the complete OM as the operationClient.complete() will
             // release the underlying HTTP connection. 
             // Force the response to be populated, see https://issues.apache.org/jira/browse/TUSCANY-1541
             response.build();
-            
+
             operationClient.complete(requestMC);
 
             return response;
@@ -127,53 +134,63 @@
         OperationClient operationClient = serviceClient.createClient(wsdlOperationName);
         operationClient.setOptions(options);
 
+        ReferenceParameters parameters = msg.getTo().getReferenceParameters();
+
+        // if target endpoint was not specified when this invoker was created, 
+        // use dynamically specified target endpoint passed in on this call
+        EndpointReference toEPR = options.getTo();
+        if (toEPR == null) {
+            org.apache.tuscany.sca.runtime.EndpointReference ep = msg.getTo();
+            toEPR = new EndpointReference(ep.getURI());
+        }
+
         // set callback endpoint and callback ID for WS-Addressing header
-        EndpointReference fromEPR = null;
-        if (msg.getFrom() != null) {
-            fromEPR = new EndpointReference(msg.getFrom().getBinding().getURI());
+        if (parameters.getCallbackID() != null) {
             //FIXME: serialize callback ID to XML in case it is not a string
-            fromEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN,
-                                          (String)msg.getCallableReference().getCallbackID());
+            toEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, parameters.getCallbackID().toString());
         }
 
         // set conversation ID for WS-Addressing header
         //FIXME: get conversation ID from the message's callable reference
-        Object conversationId = msg.getConversationID();
+        Object conversationId = parameters.getConversationID();
         if (conversationId != null) {
-            if (fromEPR == null) {
-                fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
-            }
             //FIXME: serialize conversation ID to XML in case it is not a string
-            fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
+            toEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
+        }
+
+        EndpointReference fromEPR = null;
+        if (msg.getFrom().getCallbackEndpoint() != null) {
+            fromEPR = new EndpointReference(msg.getFrom().getCallbackEndpoint().getBinding().getURI());
         }
 
         // add WS-Addressing header
         //FIXME: is there any way to use the Axis2 addressing support for this?
-        if (fromEPR != null) {
+        if (toEPR != null || fromEPR != null) {
             SOAPEnvelope sev = requestMC.getEnvelope();
             SOAPHeader sh = sev.getHeader();
-            OMElement el =
-                fromEPR.toOM(AddressingConstants.Final.WSA_NAMESPACE,
-                             AddressingConstants.WSA_FROM,
-                             AddressingConstants.WSA_DEFAULT_PREFIX);
-            sh.addChild(el);
-            requestMC.setFrom(fromEPR);
-        }
-
-        // if target endpoint was not specified when this invoker was created, 
-        // use dynamically specified target endpoint passed in on this call
-        if (options.getTo() == null) {
-            org.apache.tuscany.sca.runtime.EndpointReference ep = msg.getTo();
-            if (ep != null) {
-                requestMC.setTo(new EndpointReference(ep.getURI()));
-            } else {
-                throw new RuntimeException("Unable to determine destination endpoint");
+            if (toEPR != null) {
+                OMElement epr =
+                    EndpointReferenceHelper.toOM(sev.getOMFactory(),
+                                                 toEPR,
+                                                 QNAME_WSA_TO,
+                                                 AddressingConstants.Final.WSA_NAMESPACE);
+                sh.addChild(epr);
+                requestMC.setTo(toEPR);
+            }
+            if (fromEPR != null) {
+                OMElement epr =
+                    EndpointReferenceHelper.toOM(sev.getOMFactory(),
+                                                 fromEPR,
+                                                 QNAME_WSA_FROM,
+                                                 AddressingConstants.Final.WSA_NAMESPACE);
+                sh.addChild(epr);
+                requestMC.setFrom(fromEPR);
             }
+
         }
 
         operationClient.addMessageContext(requestMC);
 
         return operationClient;
     }
-
 }

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java Tue Sep 11 10:45:36 2007
@@ -60,18 +60,18 @@
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy;
+import org.apache.tuscany.sca.runtime.EndpointReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 public class Axis2ServiceProvider {
 
@@ -82,11 +82,14 @@
     private ConfigurationContext configContext;
 
     public static final QName QNAME_WSA_ADDRESS =
-            new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS);
+        new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS);
     public static final QName QNAME_WSA_FROM =
-            new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM);
+        new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM);
+    public static final QName QNAME_WSA_TO =
+        new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_TO);
+
     public static final QName QNAME_WSA_REFERENCE_PARAMETERS =
-            new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS);
+        new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS);
 
     // TODO: what to do about the base URI?
     // This port number may be used to construct callback URIs.  The value 8085 is used
@@ -251,7 +254,7 @@
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
-        
+
         return axisService;
     }
 
@@ -320,12 +323,10 @@
         }
         return null;
     }
-                                            
+
     // methods for Axis2 message receivers
 
-    public Object invokeTarget(Operation op,
-                               Object[] args,
-                               MessageContext inMC) throws InvocationTargetException {
+    public Object invokeTarget(Operation op, Object[] args, MessageContext inMC) throws InvocationTargetException {
 
         String callbackAddress = null;
         String callbackID = null;
@@ -334,107 +335,69 @@
         //FIXME: can we use the Axis2 addressing support for this?
         SOAPHeader header = inMC.getEnvelope().getHeader();
         if (header != null) {
-            Iterator<?> i = header.getChildrenWithName(QNAME_WSA_FROM);
-            Object a = null;
-            for (; i.hasNext();) {
-                if (a != null) {
-                    throw new IllegalArgumentException("Duplicate wsa:From element");
-                }
-                a = i.next();
-                if (a instanceof OMElement) {
-                    OMElement ao = (OMElement)a;
-
-                    // process required Address element
-                    Iterator<?> adI = ao.getChildrenWithName(QNAME_WSA_ADDRESS);
-                    OMElement adE = null;
-                    for (; adI.hasNext();) {
-                        if (adE != null) {
-                            throw new IllegalArgumentException("Duplicate wsa:Address element");
+            OMElement to = header.getFirstChildWithName(QNAME_WSA_TO);
+            if (to != null) {
+                OMElement params = to.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
+                if (params != null) {
+                    OMElement convIDElement =
+                        params.getFirstChildWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN);
+                    if (convIDElement != null) {
+                        if (isConversational()) {
+                            conversationID = convIDElement.getText();
                         }
-                        adE = (OMElement)adI.next();
-                        if (contract.getInterfaceContract().getCallbackInterface() != null) {
-                            callbackAddress = adE.getText();
-                            if (callbackAddress.equals(AddressingConstants.Final.WSA_ANONYMOUS_URL)) {
-                                throw new IllegalArgumentException("Anonymous wsa:Address passed for callback");
-                            }
-                        }
-                    }
-                    if (adE == null) {
-                        throw new IllegalArgumentException("Missing wsa:Address element");
                     }
-
-                    // process optional ReferenceParameters element
-                    Iterator<?> rpI = ao.getChildrenWithName(QNAME_WSA_REFERENCE_PARAMETERS);
-                    OMElement rpE = null;
-                    for (; rpI.hasNext();) {
-                        if (rpE != null) {
-                            throw new IllegalArgumentException("Duplicate wsa:ReferenceParameters element");
-                        }
-                        rpE = (OMElement)rpI.next();
-                        Iterator<?> cidI = rpE.getChildrenWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN);
-                        OMElement cidE = null;
-                        for (; cidI.hasNext();) {
-                            if (cidE != null) {
-                                throw new IllegalArgumentException("Duplicate SCA conversation ID element");
-                            }
-                            cidE = (OMElement)cidI.next();
-                            if (isConversational()) {
-                                conversationID = cidE.getText();
-                            }
-                        }
-                        Iterator<?> cbidI = rpE.getChildrenWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
-                        OMElement cbidE = null;
-                        for (; cbidI.hasNext();) {
-                            if (cbidE != null) {
-                                throw new IllegalArgumentException("Duplicate SCA callback ID element");
-                            }
-                            cbidE = (OMElement)cbidI.next();
-                            if (contract.getInterfaceContract().getCallbackInterface() != null) {
-                                callbackID = cbidE.getText();
-                            }
+                    OMElement callbackIDElement =
+                        params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
+                    if (callbackIDElement != null) {
+                        if (contract.getInterfaceContract().getCallbackInterface() != null) {
+                            callbackID = callbackIDElement.getText();
                         }
                     }
+                }
+            }
 
+            OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
+            if (from != null) {
+                OMElement addrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
+                if (addrElement != null && contract.getInterfaceContract().getCallbackInterface() != null) {
+                    callbackAddress = addrElement.getText();
                 }
             }
         }
 
-        Message requestMsg = messageFactory.createMessage();
-        requestMsg.setBody(args);
-        requestMsg.setTo(((RuntimeComponentService)contract).getRuntimeWire(getBinding()).getTarget());
+        RuntimeWire wire = null;
+        try {
+            wire = (RuntimeWire)(((RuntimeComponentService)contract).getRuntimeWire(getBinding())).clone();
+        } catch (CloneNotSupportedException e) {
+            // Should not happen
+        }
+        EndpointReference source = wire.getSource();
         if (callbackAddress != null) {
-            requestMsg.setFrom(new EndpointReferenceImpl(callbackAddress));
+            source.setCallbackEndpoint(new EndpointReferenceImpl(callbackAddress));
         }
+
+        EndpointReference to = wire.getTarget();
         if (callbackID != null) {
-            requestMsg.setCorrelationID(callbackID);
+            to.getReferenceParameters().setCallbackID(callbackID);
         }
         if (conversationID != null) {
-            requestMsg.setConversationID(conversationID);
+            to.getReferenceParameters().setConversationID(conversationID);
         }
+        return wire.invoke(op, args);
 
-        Message workContext = ThreadMessageContext.setMessageContext(requestMsg);
-        try {
-            Message responseMsg = ((RuntimeComponentService)contract).getInvoker(getBinding(), op).invoke(requestMsg);
-            if (responseMsg.isFault()) {
-                throw new InvocationTargetException((Throwable)responseMsg.getBody());
-            }
-            return responseMsg.getBody();
-        } finally {
-            ThreadMessageContext.setMessageContext(workContext);
-        }
     }
 
     public boolean isConversational() {
         return wsBinding.getBindingInterfaceContract().getInterface().isConversational();
     }
-    
+
     /**
      * Return the binding for this provider as a primitive binding type
      * For use when looking up wires registered against the binding.
      * 
      * @return the binding
      */
-    protected Binding getBinding(){
+    protected Binding getBinding() {
         return wsBinding;
     }
     

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java Tue Sep 11 10:45:36 2007
@@ -80,6 +80,10 @@
         if (source == target) {
             return false;
         }
+        
+        if (source.isWrapperStyle() != target.isWrapperStyle()) {
+            return true;
+        }
 
         // Check output type
         DataType sourceOutputType = source.getOutputType();
@@ -95,6 +99,10 @@
         List<DataType> targetInputType = target.getInputType().getLogical();
 
         int size = sourceInputType.size();
+        if (size != targetInputType.size()) {
+            // TUSCANY-1682: The wrapper style may have different arguments
+            return true;
+        }
         for (int i = 0; i < size; i++) {
             if (isTransformationRequired(sourceInputType.get(i), targetInputType.get(i))) {
                 return true;
@@ -124,6 +132,9 @@
             targetContract = sourceContract;
         }
 
+        if (!sourceContract.getInterface().isRemotable()) {
+            return;
+        }
         List<InvocationChain> chains = wire.getInvocationChains();
         for (InvocationChain chain : chains) {
             Operation sourceOperation = chain.getSourceOperation();

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java Tue Sep 11 10:45:36 2007
@@ -18,10 +18,8 @@
  */
 package org.apache.tuscany.sca.invocation;
 
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.osoa.sca.CallableReference;
 
 /**
  * Represents a request, response, or exception flowing through a wire
@@ -43,15 +41,19 @@
     <T> void setBody(T body);
 
     /**
+     * @deprecated
      * Get the conversation id
      * @return The conversation ID
      */
+    @Deprecated
     Object getConversationID();
 
     /**
+     * @deprecated
      * Set the conversation id
      * @param conversationId The conversation ID
      */
+    @Deprecated
     void setConversationID(Object conversationId);
 
     /**
@@ -77,6 +79,9 @@
      * @param to The end point reference of the service that the message targets
      */
     void setTo(EndpointReference to);
+    
+    EndpointReference getReplyTo();
+    void setReplyTo(EndpointReference replyTo);
 
     /**
      * Returns the id of the message
@@ -95,12 +100,14 @@
      * for message routing.
      * @return The correlation Id
      */
+    @Deprecated
     Object getCorrelationID();
 
     /**
      * Sets the correlation id of the message. Correlation ids are used by transports for message routing.
      * @param correlationId The correlation Id
      */
+    @Deprecated
     void setCorrelationID(Object correlationId);
 
     /**
@@ -118,20 +125,6 @@
     <T> void setFaultBody(T fault);
 
     /**
-     * Returns the conversational sequence the message is associated with, NONE, START, CONTINUE, or END on TargetInvoker}
-     *
-     * @return The conversational sequence the message is associated with
-     */
-    ConversationSequence getConversationSequence();
-
-    /**
-     * Sets the conversational sequence the message is associated with, NONE, START, CONTINUE, or END
-     *
-     * @param sequence The conversational sequence
-     */
-    void setConversationSequence(ConversationSequence sequence);
-
-    /**
      * Returns the operation that created the message.
      *
      * @return The operation that created the message
@@ -144,23 +137,5 @@
      * @param op The operation that created the message
      */
     void setOperation(Operation op);
-
-    /**
-     * Get the associated callable reference
-     * @param <B>
-     * @return The callable reference
-     * @deprecated Seems to duplicate other fields of the Message
-     */
-    @Deprecated
-    <B> CallableReference<B> getCallableReference();
-    
-    /**
-     * Set the callable reference
-     * @param <B>
-     * @param callableReference
-     * @deprecated Seems to duplicate other fields of the Message
-     */
-    @Deprecated
-    <B> void setCallableReference(CallableReference<B> callableReference);
 
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java Tue Sep 11 10:45:36 2007
@@ -47,8 +47,6 @@
      */
     Binding getBinding();
 
-    //FIXME Why do we need this? isn't the interface contract already on the Contract?
-    
     /**
      * Get the interface contract for the endpoint
      * @return The interface contract
@@ -86,5 +84,8 @@
     void setCallbackEndpoint(EndpointReference callbackEndpoint);
 
     Object clone() throws CloneNotSupportedException;   
+    
+    void setReferenceParameters(ReferenceParameters parameters);
+    ReferenceParameters getReferenceParameters();
     
 }

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java?rev=574648&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java Tue Sep 11 10:45:36 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+/**
+ * Parameters for the EndPointReference
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceParameters extends Cloneable {
+    /**
+     * Get the callback ID
+     * @return the callbackID
+     */
+    Object getCallbackID();
+
+    /**
+     * Set the callback ID
+     * @param callbackID the callbackID to set
+     */
+    void setCallbackID(Object callbackID);
+
+    /**
+     * Get the conversation ID
+     * @return the conversationID
+     */
+    Object getConversationID();
+
+    /**
+     * Set the conversation ID
+     * @param conversationID the conversationID to set
+     */
+    void setConversationID(Object conversationID);
+
+    /**
+     * Get the ID for the non-ServiceReference callback object
+     * @return
+     */
+    Object getCallbackObjectID();
+
+    /**
+     * Set the ID for the non-ServiceReference callback object
+     * @param callbackObjectID
+     */
+    void setCallbackObjectID(Object callbackObjectID);
+
+    EndpointReference getCallbackReference();
+
+    void setCallbackReference(EndpointReference callback);
+
+    Object clone() throws CloneNotSupportedException;
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java Tue Sep 11 10:45:36 2007
@@ -23,6 +23,7 @@
 import java.io.Reader;
 import java.io.Writer;
 
+import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.ComponentService;
 import org.osoa.sca.CallableReference;
 import org.osoa.sca.ComponentContext;
@@ -36,8 +37,8 @@
      * Activate the reference (creating runtime wires)
      * @param reference
      */
-    void activate(RuntimeComponentReference reference);
-    
+    void start(RuntimeComponentReference reference);
+
     /**
      * Deserialize the component reference
      * @param reader
@@ -45,6 +46,7 @@
      * @throws IOException
      */
     RuntimeComponent read(Reader reader) throws IOException;
+
     /**
      * Serialize the component reference
      * @param reference
@@ -58,10 +60,14 @@
      * @param <B>
      * @param businessInterface The business interface
      * @param reference The reference to be wired
+     * @param binding The binding to be used, if it's null, either binding.sca or the 1st binding
+     * will be selected
      * @return A service reference representing the wire
      */
     <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
-                                                RuntimeComponentReference reference);    
+                                                RuntimeComponentReference reference,
+                                                Binding binding);
+
     /**
      * Bind the reference to a target component/componentService
      * @param <B>
@@ -75,7 +81,7 @@
                                                 RuntimeComponentReference reference,
                                                 RuntimeComponent component,
                                                 RuntimeComponentService service);
-    
+
     /**
      * Create a callable reference for the given component service
      * @param <B>
@@ -85,9 +91,9 @@
      * @return
      */
     <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
-                                                         RuntimeComponent component,
-                                                         RuntimeComponentService service);
-    
+                                                  RuntimeComponent component,
+                                                  RuntimeComponentService service);
+
     /**
      * @param <B>
      * @param businessInterface

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java Tue Sep 11 10:45:36 2007
@@ -77,6 +77,8 @@
      */
     Invoker getInvoker(Binding binding, Operation operation); 
     
+    /**Set the owning component
+     * @param component
+     */
     void setComponent(RuntimeComponent component);
-    
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java Tue Sep 11 10:45:36 2007
@@ -99,5 +99,4 @@
      * @return The runtime invocation chain
      */
     InvocationChain getInvocationChain(Binding binding, Operation operation);    
-    
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java Tue Sep 11 10:45:36 2007
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.runtime;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -51,6 +52,11 @@
      * @param target The target endpoint reference
      */
     void setTarget(EndpointReference target);
+    
+    /**
+     * Force the invocation chains to be rebuilt
+     */
+    void rebuild();
 
     /**
      * Returns the invocation chains for service operations associated with the
@@ -67,6 +73,15 @@
      * @return The invocation chain for the given operation
      */
     InvocationChain getInvocationChain(Operation operation);
+    
+    /**
+     * Invoke an operation with given arguments
+     * @param operation
+     * @param args The arguments
+     * @return The result
+     * @throws InvocationTargetException
+     */
+    Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
 
     /**
      * @return a clone of the runtime wire

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java Tue Sep 11 10:45:36 2007
@@ -45,6 +45,13 @@
      * @param component
      * @param ref
      */
+    void start(RuntimeComponent component, RuntimeComponentReference ref);
+    
+    /**
+     * Activate a component reference
+     * @param component
+     * @param ref
+     */
     void activate(RuntimeComponent component, RuntimeComponentReference ref);
 
     /**

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java Tue Sep 11 10:45:36 2007
@@ -19,6 +19,9 @@
 
 package org.apache.tuscany.sca.core.assembly;
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.Component;
@@ -41,6 +44,7 @@
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.provider.BindingProviderFactory;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
@@ -60,10 +64,11 @@
  * @version $Rev$ $Date$
  */
 public class CompositeActivatorImpl implements CompositeActivator {
-
+    private final static Logger logger = Logger.getLogger(CompositeActivatorImpl.class.getName());
     private final static String CALLBACK_PREFIX = "$callback$.";
 
     private final AssemblyFactory assemblyFactory;
+    private final MessageFactory messageFactory;
     private final InterfaceContractMapper interfaceContractMapper;
     private final ScopeRegistry scopeRegistry;
     private final WorkScheduler workScheduler;
@@ -86,6 +91,7 @@
      * @param wirePostProcessorRegistry
      */
     public CompositeActivatorImpl(AssemblyFactory assemblyFactory,
+                                  MessageFactory messageFactory,
                                   JavaInterfaceFactory javaInterfaceFactory,
                                   SCABindingFactory scaBindingFactory,
                                   InterfaceContractMapper interfaceContractMapper,
@@ -97,6 +103,7 @@
                                   ProviderFactoryExtensionPoint providerFactories,
                                   StAXArtifactProcessorExtensionPoint processors) {
         this.assemblyFactory = assemblyFactory;
+        this.messageFactory = messageFactory;
         this.interfaceContractMapper = interfaceContractMapper;
         this.scopeRegistry = scopeRegistry;
         this.workScheduler = workScheduler;
@@ -112,18 +119,35 @@
      * @see org.apache.tuscany.sca.core.assembly.CompositeActivator#activate(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference)
      */
     public void activate(RuntimeComponent component, RuntimeComponentReference ref) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Activating component reference: " + component.getURI() + "#" + ref.getName());
+        }
         resolveTargets(ref);
         for (Binding binding : ref.getBindings()) {
             addReferenceBindingProvider(component, ref, binding);
-            addReferenceWire(component, ref, binding);
-            ReferenceBindingProvider provider = ref.getBindingProvider(binding);
-            if (provider != null) {
-                provider.start();
+        }
+    }
+
+    public void start(RuntimeComponent component, RuntimeComponentReference ref) {
+        synchronized (ref) {
+            resolveTargets(ref);
+            for (Binding binding : ref.getBindings()) {
+                ReferenceBindingProvider provider = ref.getBindingProvider(binding);
+                if (provider == null) {
+                    provider = addReferenceBindingProvider(component, ref, binding);
+                }
+                if (provider != null) {
+                    provider.start();
+                }
+                addReferenceWire(component, ref, binding);
             }
         }
     }
 
     public void deactivate(RuntimeComponent component, RuntimeComponentReference ref) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Deactivating component reference: " + component.getURI() + "#" + ref.getName());
+        }
         removeReferenceWires(ref);
         for (Binding binding : ref.getBindings()) {
             removeReferenceBindingProvider(component, ref, binding);
@@ -136,9 +160,9 @@
      * @param reference
      * @param binding
      */
-    private void addReferenceBindingProvider(RuntimeComponent component,
-                                             RuntimeComponentReference reference,
-                                             Binding binding) {
+    private ReferenceBindingProvider addReferenceBindingProvider(RuntimeComponent component,
+                                                                 RuntimeComponentReference reference,
+                                                                 Binding binding) {
         BindingProviderFactory providerFactory =
             (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
         if (providerFactory != null) {
@@ -150,6 +174,7 @@
             if (bindingProvider != null) {
                 ((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
             }
+            return bindingProvider;
         } else {
             throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
         }
@@ -324,7 +349,8 @@
             new EndpointReferenceImpl((RuntimeComponent)serviceComponent, service, serviceBinding, bindingContract);
 
         RuntimeWire wire =
-            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor);
+            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
+                                messageFactory);
         runtimeRef.getRuntimeWires().add(wire);
 
         return wire;
@@ -355,7 +381,9 @@
      * @param service
      * @param binding
      */
-    private void addServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
+    private ServiceBindingProvider addServiceBindingProvider(RuntimeComponent component,
+                                                             RuntimeComponentService service,
+                                                             Binding binding) {
         BindingProviderFactory providerFactory =
             (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
         if (providerFactory != null) {
@@ -367,6 +395,7 @@
             if (bindingProvider != null) {
                 ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
             }
+            return bindingProvider;
         } else {
             throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
         }
@@ -385,37 +414,55 @@
     }
 
     public void start(Composite composite) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Starting composite: " + composite.getName());
+        }
         for (Component component : composite.getComponents()) {
             start(component);
         }
     }
 
     public void stop(Composite composite) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Stopping composite: " + composite.getName());
+        }
         for (Component component : composite.getComponents()) {
             stop(component);
-
         }
-
     }
 
     public void start(Component component) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Starting component: " + component.getURI());
+        }
         RuntimeComponent runtimeComponent = ((RuntimeComponent)component);
         configureComponentContext(runtimeComponent);
 
+        for (ComponentReference reference : component.getReferences()) {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
+            }
+            RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
+            runtimeRef.setComponent(runtimeComponent);
+            for (Binding binding : reference.getBindings()) {
+                ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
+                if (bindingProvider != null) {
+                    bindingProvider.start();
+                }
+            }
+        }
+        
         for (ComponentService service : component.getServices()) {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
+            }
+            RuntimeComponentService runtimeService = (RuntimeComponentService)service;
             for (Binding binding : service.getBindings()) {
-                ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding);
+                ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
                 if (bindingProvider != null) {
                     bindingProvider.start();
                 }
             }
-            //            for (RuntimeWire wire : ((RuntimeComponentService)service).getRuntimeWires()) {
-            //                wireProcessor.process(wire);
-            //            }
-        }
-
-        for (ComponentReference reference : component.getReferences()) {
-            ((RuntimeComponentReference)reference).setComponent(runtimeComponent);
         }
 
         Implementation implementation = component.getImplementation();
@@ -452,7 +499,13 @@
      * Stop a component
      */
     public void stop(Component component) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Stopping component: " + component.getURI());
+        }
         for (ComponentService service : component.getServices()) {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.fine("Stopping component service: " + component.getURI() + "#" + service.getName());
+            }
             for (Binding binding : service.getBindings()) {
                 ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding);
                 if (bindingProvider != null) {
@@ -461,9 +514,12 @@
             }
         }
         for (ComponentReference reference : component.getReferences()) {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
+            }
+            RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
             for (Binding binding : reference.getBindings()) {
-                ReferenceBindingProvider bindingProvider =
-                    ((RuntimeComponentReference)reference).getBindingProvider(binding);
+                ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
                 if (bindingProvider != null) {
                     bindingProvider.stop();
                 }
@@ -585,13 +641,26 @@
                                       serviceBinding, targetContract);
 
         RuntimeWire wire =
-            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor);
+            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
+                                messageFactory);
         runtimeService.getRuntimeWires().add(wire);
 
         return wire;
     }
 
     public void activate(RuntimeComponent component, RuntimeComponentService service) {
+        if (service.getService() == null) {
+            if (logger.isLoggable(Level.WARNING)) {
+                logger.warning("Skipping component service not defined in the component type: " + component.getURI()
+                    + "#"
+                    + service.getName());
+            }
+            return;
+        }
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Activating component service: " + component.getURI() + "#" + service.getName());
+        }
+
         for (Binding binding : service.getBindings()) {
             addServiceBindingProvider(component, service, binding);
             addServiceWire(component, service, binding);
@@ -599,6 +668,9 @@
     }
 
     public void deactivate(RuntimeComponent component, RuntimeComponentService service) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Deactivating component service: " + component.getURI() + "#" + service.getName());
+        }
         removeServiceWires(service);
         for (Binding binding : service.getBindings()) {
             removeServiceBindingProvider(component, service, binding);
@@ -623,7 +695,13 @@
 
     public void activate(Composite composite) throws ActivationException {
         try {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.fine("Activating composite: " + composite.getName());
+            }
             for (Component component : composite.getComponents()) {
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.fine("Activating component: " + component.getURI());
+                }
 
                 Implementation implementation = component.getImplementation();
                 if (implementation instanceof Composite) {
@@ -636,6 +714,10 @@
                 for (ComponentService service : component.getServices()) {
                     activate((RuntimeComponent)component, (RuntimeComponentService)service);
                 }
+
+                for (ComponentReference reference : component.getReferences()) {
+                    activate((RuntimeComponent)component, (RuntimeComponentReference)reference);
+                }
             }
         } catch (Exception e) {
             throw new ActivationException(e);
@@ -644,7 +726,13 @@
 
     public void deactivate(Composite composite) throws ActivationException {
         try {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.fine("Deactivating composite: " + composite.getName());
+            }
             for (Component component : composite.getComponents()) {
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.fine("Deactivating component: " + component.getURI());
+                }
                 for (ComponentService service : component.getServices()) {
                     deactivate((RuntimeComponent)component, (RuntimeComponentService)service);
                 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java?rev=574648&r1=574647&r2=574648&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java Tue Sep 11 10:45:36 2007
@@ -23,6 +23,7 @@
 import org.apache.tuscany.sca.assembly.Contract;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 
 /**
@@ -35,6 +36,7 @@
     private InterfaceContract interfaceContract;
     private String uri;
     private EndpointReference callbackEndpoint;
+    private ReferenceParameters parameters = new ReferenceParametersImpl();
 
     /**
      * @param component
@@ -121,18 +123,23 @@
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         final EndpointReferenceImpl other = (EndpointReferenceImpl)obj;
         if (uri == null) {
-            if (other.uri != null)
+            if (other.uri != null) {
                 return false;
-        } else if (!uri.equals(other.uri))
+            }
+        } else if (!uri.equals(other.uri)) {
             return false;
+        }
         return true;
     }
 
@@ -141,6 +148,27 @@
      */
     @Override
     public Object clone() throws CloneNotSupportedException {
-        return super.clone();
+        EndpointReferenceImpl copy = (EndpointReferenceImpl)super.clone();
+        if (callbackEndpoint != null) {
+            copy.callbackEndpoint = (EndpointReference)callbackEndpoint.clone();
+        }
+        if (parameters != null) {
+            copy.parameters = (ReferenceParameters)parameters.clone();
+        }
+        return copy;
+    }
+
+    /**
+     * @return the parameters
+     */
+    public ReferenceParameters getReferenceParameters() {
+        return parameters;
+    }
+
+    /**
+     * @param parameters the parameters to set
+     */
+    public void setReferenceParameters(ReferenceParameters parameters) {
+        this.parameters = parameters;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org