tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1228150 - in /tuscany/sca-java-2.x/trunk/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ assembly/src/main/java/org/apache/tuscany/sca/assembly/ assem...
Date Fri, 06 Jan 2012 12:35:02 GMT
Author: slaws
Date: Fri Jan  6 12:35:01 2012
New Revision: 1228150

URL: http://svn.apache.org/viewvc?rev=1228150&view=rev
Log:
TUSCANY-3932 - First part of this JIRA is to remove some inconsistencies in the way that callbacks
are handled now. See JIRA for more comments on this first change. 

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
Fri Jan  6 12:35:01 2012
@@ -51,6 +51,8 @@ import org.apache.tuscany.sca.policy.Pol
 public class SCABindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCABinding>
{
     private static final String NAME = "name";
     private static final String URI = "uri";
+    private static final String DELEGATE_BINDING_TYPE = "delegateBindingType";
+    private static final String DELEGATE_BINDING_URI = "delegateBindingURI";
 
     private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912";
     private static final String BINDING_SCA = "binding.sca";
@@ -100,6 +102,18 @@ public class SCABindingProcessor extends
         if (uri != null) {
             scaBinding.setURI(uri);
         }
+        
+        // Read delegate binding type
+        String delegateBindingType = getString(reader, DELEGATE_BINDING_TYPE);
+        if (delegateBindingType != null) {
+            scaBinding.setDelegateBindingType(delegateBindingType);
+        }
+        
+        // Read delegate binding URI
+        String delegateBindingURI = getURIString(reader, DELEGATE_BINDING_URI);
+        if (delegateBindingURI != null) {
+            scaBinding.setDelegateBindingURI(delegateBindingURI);
+        }
 
         // Read any sub-elements
         boolean endFound = false;
@@ -145,6 +159,16 @@ public class SCABindingProcessor extends
             writer.writeAttribute(URI, scaBinding.getURI());
         }
         
+        // Write delegate binding type
+        if (scaBinding.getDelegateBindingType() != null) {
+            writer.writeAttribute(DELEGATE_BINDING_TYPE, scaBinding.getDelegateBindingType());
+        }
+        
+        // Write delegate binding URI
+        if (scaBinding.getDelegateBindingURI() != null) {
+            writer.writeAttribute(DELEGATE_BINDING_URI, scaBinding.getDelegateBindingURI());
+        }        
+        
         // write wireFormat
         extensionProcessor.write(scaBinding.getRequestWireFormat(), writer, context);
 

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
Fri Jan  6 12:35:01 2012
@@ -159,4 +159,28 @@ public class TestSCABindingImpl implemen
     
     public void setOperationSelector(OperationSelector operationSelector) {
     }
+    
+    @Override
+    public String getDelegateBindingType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    @Override
+    public void setDelegateBindingType(String delegateBindingType) {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    @Override
+    public String getDelegateBindingURI() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    @Override
+    public void setDelegateBindingURI(String delegateBindingURI) {
+        // TODO Auto-generated method stub
+        
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
Fri Jan  6 12:35:01 2012
@@ -27,4 +27,36 @@ import javax.xml.namespace.QName;
  */
 public interface SCABinding extends Binding {
     QName TYPE = new QName(SCA11_NS, "binding.sca");
+    
+    /**
+     * Retrieve the type of the binding that this binding.sca
+     * delegates to
+     * 
+     * @return delegate binding type
+     */
+    String getDelegateBindingType();
+    
+    /**
+     * Set the type of the binding that this binding.sca
+     * delegates to
+     * 
+     * @param delegateBindingType
+     */
+    void setDelegateBindingType(String delegateBindingType);
+    
+    /**
+     * Get the URI for the binding that this binding.sca 
+     * delegates to
+     * 
+     * @return delegate binding URI
+     */
+    String getDelegateBindingURI();
+    
+    /**
+     * Set the URI for the binding that this binding.sca 
+     * delegates to
+     * 
+     * @param delegateBindingURI
+     */
+    void setDelegateBindingURI(String delegateBindingURI);
 }

Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
Fri Jan  6 12:35:01 2012
@@ -46,7 +46,9 @@ public class SCABindingImpl implements S
     private List<Intent> requiredIntents = new ArrayList<Intent>();
     private List<PolicySet> policySets = new ArrayList<PolicySet>();
     private ExtensionType extensionType;
-    private WireFormat wireFormat ;
+    private WireFormat wireFormat;
+    private String delegateBindingType;
+    private String delegateBindingURI;
 
     /**
      * Constructs a new SCA binding.
@@ -147,5 +149,21 @@ public class SCABindingImpl implements S
     }
     
     public void setOperationSelector(OperationSelector operationSelector) {
-    }    
+    } 
+    
+    public String getDelegateBindingType() {
+        return delegateBindingType;
+    }
+    
+    public void setDelegateBindingType(String delegateBindingType) {
+        this.delegateBindingType = delegateBindingType;
+    }
+    
+    public String getDelegateBindingURI() {
+        return delegateBindingURI;
+    }
+    
+    public void setDelegateBindingURI(String delegateBindingURI) {
+        this.delegateBindingURI = delegateBindingURI;
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
Fri Jan  6 12:35:01 2012
@@ -127,7 +127,7 @@ public class TransportServiceInterceptor
             from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
             msg.setFrom(from);
             Endpoint callbackEndpoint = assemblyFactory.createEndpoint();
-//            callbackEndpoint.setURI(callbackAddress); // TODO: is this needed? Seems to
work without it
+            // binding is set into the callback endpoint in the CallbackDesitnationInterceptor
          
             callbackEndpoint.setUnresolved(true);
             from.setCallbackEndpoint(callbackEndpoint);
 

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
Fri Jan  6 12:35:01 2012
@@ -106,16 +106,13 @@ public class CallbackDestinationIntercep
                             throw new RuntimeException(e);
                         }
                         callbackBinding.setDestinationName(callbackdestName);
-                        msg.getHeaders().put("CALLBACK_BINDING", callbackBinding);
+                        // the "from" EPR model is created in the TransportServiceInterceptor
+                        // not sure which this destination calculation is not performed
+                        // there as well
+                        msg.getFrom().getCallbackEndpoint().setBinding(callbackBinding);
+//                        msg.getHeaders().put("CALLBACK_BINDING", callbackBinding);
                     }
                 }
-//            	List<EndpointReference> refs = endpoint.getCallbackEndpointReferences();
-//            	for (EndpointReference ref : refs ) {
-//            		if  (ref.getBinding() instanceof JMSBinding ) {
-//            			JMSBinding callbackBinding = (JMSBinding) ref.getBinding();
-//            			callbackBinding.setDestinationName(callbackdestName);
-//            		} // end if
-//            	} // end for
             } // end if  
 
 // Callback ID not used at present            

Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
Fri Jan  6 12:35:01 2012
@@ -29,9 +29,11 @@ import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.assembly.Base;
 import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
 import org.apache.tuscany.sca.assembly.builder.BuilderContext;
 import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
+import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
 import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
 import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
@@ -61,6 +63,10 @@ public class DefaultSCABindingMapper imp
     protected QName defaultMappedBinding;
     protected QName defaultLocalBinding;
     protected boolean alwaysDistributed;
+    
+    // Test to look at supporting concurrent binding.sca delegations
+    protected QName [] activeDelegations = {new QName(Base.SCA11_TUSCANY_NS, "binding.local"),
+                                            new QName(Base.SCA11_NS, "binding.ws")};
 
     public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map<String, String>
attributes) {
         this.registry = registry;
@@ -196,7 +202,14 @@ public class DefaultSCABindingMapper imp
         try {
             Binding binding = createDelegatingBinding(newBindingType);
             binding.setName(scaBinding.getName());
-            binding.setURI(scaBinding.getURI());
+            if (((SCABinding)scaBinding).getDelegateBindingURI() != null){
+                // if this is an SCA binding that's been resolved via the registry then 
+                // the URI of the target service is delegate specific and is stored
+                // in this new slot in the binding model 
+                binding.setURI(((SCABinding)scaBinding).getDelegateBindingURI());
+            } else {
+                binding.setURI(scaBinding.getURI());
+            }
             binding.setOperationSelector(scaBinding.getOperationSelector());
             binding.setRequestWireFormat(scaBinding.getRequestWireFormat());
             binding.setResponseWireFormat(scaBinding.getResponseWireFormat());
@@ -285,5 +298,9 @@ public class DefaultSCABindingMapper imp
         
         return defaultLocalBinding;
     }
+    
+    public QName[] getActiveDelegations(){
+        return activeDelegations;
+    }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
Fri Jan  6 12:35:01 2012
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.binding.sca.provider;
 
+import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.invocation.InvokerAsyncResponse;
 import org.apache.tuscany.sca.provider.EndpointAsyncProvider;
@@ -94,7 +95,8 @@ public class DelegatingSCAServiceBinding
         } else {
             provider.start();
             // Set the resolved binding URI back to the binding.sca
-            endpoint.getBinding().setURI(delegateEndpoint.getBinding().getURI());
+            ((SCABinding)endpoint.getBinding()).setDelegateBindingType(delegateEndpoint.getBinding().getType().toString());
+            ((SCABinding)endpoint.getBinding()).setDelegateBindingURI(delegateEndpoint.getBinding().getURI());
             endpoint.setDeployedURI(delegateEndpoint.getDeployedURI());
             started = true;
         }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
Fri Jan  6 12:35:01 2012
@@ -53,6 +53,7 @@ import org.apache.axis2.context.MessageC
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
 import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
@@ -90,7 +91,7 @@ public class Axis2ReferenceBindingInvoke
     public static final QName QNAME_WSA_MESSAGEID =
         new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_MESSAGE_ID,
AddressingConstants.WSA_DEFAULT_PREFIX);
     
-    public static final QName QNAME_CALLACK_EP_URI = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA11_TUSCANY_NS,
"CALLBACK_EP_URI");
+    //public static final QName QNAME_CALLACK_EP_URI = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA11_TUSCANY_NS,
"CALLBACK_EP_URI");
 
     private RuntimeEndpointReference endpointReference;
     private ServiceClient serviceClient;
@@ -244,12 +245,19 @@ public class Axis2ReferenceBindingInvoke
         // Add WS-Addressing header for the invocation of a bidirectional service
         if (callbackEndpoint != null) {
             // Load the actual callback endpoint URI into an Axis EPR ready to form the content
of the wsa:From header
-            EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
+            // In Tuscany the ws binding is used as a remote delegate for the sca binding
+            // so we have to take care to pass the sca uri in the delegate case. 
+            EndpointReference fromEPR = null;
+            if (callbackEndpoint.getBinding().getType().equals(SCABinding.TYPE)){
+                fromEPR = new EndpointReference(callbackEndpoint.getURI());
+            } else {
+                fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
+            }
             
             // pass the callback structure URI as a reference parameter
             // this allows callback endpoints to be looked up via the registry when
             // the ws binding is being used as a delegate from the sca binding
-            fromEPR.addReferenceParameter(QNAME_CALLACK_EP_URI, callbackEndpoint.getURI());
+            //fromEPR.addReferenceParameter(QNAME_CALLACK_EP_URI, callbackEndpoint.getURI());
            
             addWSAFromHeader( sh, fromEPR );
             addWSAActionHeader( sh );

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
Fri Jan  6 12:35:01 2012
@@ -254,15 +254,14 @@ public class TuscanyServiceProvider {
                 OMElement refParms = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
                 if( refParms != null ) {
                     msg.getHeaders().put(WS_REF_PARMS, refParms);
-                    Iterator iter = refParms.getChildrenWithLocalName("CALLBACK_EP_URI");
-                    if (iter != null && iter.hasNext()){
-                        OMElement callbackEPURI = (OMElement)iter.next();
-                        if (callbackEPURI != null){
-                            msg.getHeaders().put("CALLBACK_EP_URI", callbackEPURI.getText());
-                        }
-                    }
-                }
-                
+//                    Iterator iter = refParms.getChildrenWithLocalName("CALLBACK_EP_URI");
+//                    if (iter != null && iter.hasNext()){
+//                        OMElement callbackEPURI = (OMElement)iter.next();
+//                        if (callbackEPURI != null){
+//                            msg.getHeaders().put("CALLBACK_EP_URI", callbackEPURI.getText());
+//                        }
+//                    }
+                } 
             }
         } // end if
     	

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
Fri Jan  6 12:35:01 2012
@@ -134,58 +134,27 @@ public class CallbackServiceReferenceImp
                 // TUSCANY-3932
                 // If it's the default binding then we're going to look the callback endpoint
                 // up in the registry. Most remote protocols, which may be used as delegates

-                // or binding.sca will deal in absolution callback address and send the 
-                // callback enbdpoint strutural URL separately. In this case flip the binding
-                // back to the structure URL. 
-                // TODO - all this creation of endpoints by the binding to represent callbacks
-                //        is confusing. Code here will change if we tidy it up. 
+                // for binding.sca, will expect to deal with absolute URLs so flip the 
+                // callback endpoint back to force the lookup to happen
                 if (epr.getBinding().getType().equals(SCABinding.TYPE)){
-                    // assume that we're going to look up the callback endpoint in the
-                    // registry
-                    Message msgContext = ThreadMessageContext.getMessageContext();
-                    if (msgContext != null){
-                        String callbackEPURI = (String)msgContext.getHeaders().get("CALLBACK_EP_URI");
-                        if (callbackEPURI != null){
-                            resolvedEndpoint.setURI(callbackEPURI);
-                        }
-                    }
-                }
-
-                // This is used by the JMS binding to enable setting the JMS callback destination
from the
-                // request, see CallbackDestinationInterceptor in the JMS binding module.
It gets the JMS
-                // compliance tests passing again but doesn't seem like the perfect fix,
when the changes
-                // mentioned below for TUSCANY-3932 happen it should fix this properly.
-                Message msgContext = ThreadMessageContext.getMessageContext();
-                if (msgContext != null){
-                    Binding b = (Binding)msgContext.getHeaders().get("CALLBACK_BINDING");
-                    if (b != null) {
-                        endpointReference.setBinding(b);
-                    }
-                }
-                
-                /*                
-                // TUSCANY-3932
-                // If the resolved endpoint has a binding with a absolute URI then assume
-                // that URL has been passed in in the forward message and really treat it
-                // as a resolved endpoint.
-                Binding callbackBinding = resolvedEndpoint.getBinding();
-                if ( callbackBinding != null){
-                    URI callbackBindingURI = null;
-                    try {
-                        callbackBindingURI = new URI(callbackBinding.getURI());
-                    } catch (Exception ex){
-                        // ignore it, we test for null next
-                    }
-                    if (callbackBindingURI != null &&
-                        callbackBindingURI.isAbsolute()){
+                    epr.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND);
+                } else {
+                    // just copy the callback binding from the callback endpoint to the
+                    // callback EPR as the EPR is effectively already resolved
+                    epr.setStatus(EndpointReference.Status.RESOLVED_BINDING);
+                    Binding callbackBinding = resolvedEndpoint.getBinding();
+                    if ( callbackBinding != null){
                         epr.setBinding(callbackBinding);
-                        // TODO - What else?
-                        build(epr);
-                        epr.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
-                        epr.setUnresolved(false);
+                        // make sure that the chains are recreated for
+                        // this new binding
+                        epr.setBindingProvider(null);
+                        epr.rebuild();
+                    } else {
+                        // do nothing and rely on whatever the user has configured 
+                        // in the SCDL
                     }
                 }
-*/
+            
                 return epr;
             } catch (CloneNotSupportedException e) {
                 // will not happen

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=1228150&r1=1228149&r2=1228150&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
Fri Jan  6 12:35:01 2012
@@ -222,7 +222,8 @@ public class EndpointReferenceBinderImpl
                     endpointReference.getStatus() == EndpointReference.Status.RESOLVED_BINDING
) {
             // The endpoint reference is already resolved to either
             // a service endpoint local to this composite or it has
-            // a remote binding
+            // a remote binding. Just make sure the binding is built
+            build(endpointReference);
             
             // still need to check that the callback endpoint is set correctly
             if (hasCallback(endpointReference) && 



Mime
View raw message