tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r674050 - in /tuscany/java/sca: itest/recursive-ws/src/test/java/bindingoverride/ modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/
Date Fri, 04 Jul 2008 13:28:49 GMT
Author: slaws
Date: Fri Jul  4 06:28:49 2008
New Revision: 674050

URL: http://svn.apache.org/viewvc?rev=674050&view=rev
Log:
TUSCANY-2352 - fix up bindings for promoted services. It turns out there is more to do so.
That will be a new JIRA but this change forms a basis for the new change

Modified:
    tuscany/java/sca/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java

Modified: tuscany/java/sca/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java?rev=674050&r1=674049&r2=674050&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java
(original)
+++ tuscany/java/sca/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java
Fri Jul  4 06:28:49 2008
@@ -50,7 +50,7 @@
     }
 
     @Test
-    @Ignore("TUSCANY-2352")
+    //@Ignore("TUSCANY-2352")
     public void test() throws Exception {
         Assert.assertEquals("Target: Hello Target: Hello Fred!!", targetClient.hello("Fred"));
     }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java?rev=674050&r1=674049&r2=674050&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
Fri Jul  4 06:28:49 2008
@@ -825,14 +825,27 @@
                 newComponentService.setName("$promoted$." + compositeService.getName());
                 promotedComponent.getServices().add(newComponentService);
                 newComponentService.setService(promotedService.getService());
-                 newComponentService.getBindings().addAll(compositeService.getBindings());
+                // set the bindings using the top level bindings to override the 
+                // lower level bindings
+                if (compositeService.getBindings().size() > 0){
+                    newComponentService.getBindings()
+                        .addAll(compositeService.getBindings());
+                } else {
+                    newComponentService.getBindings()
+                    .addAll(promotedService.getBindings());
+                }
                 newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
                 if (compositeService.getInterfaceContract() != null && compositeService
                     .getInterfaceContract().getCallbackInterface() != null) {
                     newComponentService.setCallback(assemblyFactory.createCallback());
-                    if (compositeService.getCallback() != null) {
-                        newComponentService.getCallback().getBindings().addAll(compositeService
-                            .getCallback().getBindings());
+                    if ((compositeService.getCallback() != null) &&
+                            (compositeService.getCallback().getBindings().size() > 0)){
+                        newComponentService.getCallback().getBindings()
+                            .addAll(compositeService.getCallback().getBindings());
+                    } else if ((promotedService.getCallback() != null) &&
+                            (promotedService.getCallback().getBindings().size() > 0)){
+                        newComponentService.getBindings()
+                            .addAll(promotedService.getBindings());
                     }
                 }
 
@@ -891,16 +904,39 @@
                             newComponentService.setName("$promoted$." + componentService.getName());
                             promotedComponent.getServices().add(newComponentService);
                             newComponentService.setService(promotedService.getService());
-                             newComponentService.getBindings()
-                                .addAll(componentService.getBindings());
+                            // set the bindings using the top level bindings to override
the 
+                            // lower level bindings
+                            if (componentService.getBindings().size() > 0){
+                                newComponentService.getBindings()
+                                    .addAll(componentService.getBindings());
+                            } else if (compositeService.getBindings().size() > 0){
+                                newComponentService.getBindings()
+                                    .addAll(compositeService.getBindings());
+                            } else {
+                                newComponentService.getBindings()
+                                .addAll(promotedService.getBindings());
+                            }
                             newComponentService.setInterfaceContract(componentService
                                 .getInterfaceContract());
-                            if (componentService.getInterfaceContract() != null &&
componentService
-                                .getInterfaceContract().getCallbackInterface() != null) {
+                            if (componentService.getInterfaceContract() != null &&

+                                componentService.getInterfaceContract().getCallbackInterface()
!= null) {
+                                
                                 newComponentService.setCallback(assemblyFactory.createCallback());
-                                if (componentService.getCallback() != null) {
+                                
+                                // set the bindings using the top level bindings to override
the 
+                                // lower level bindings
+                                if ((componentService.getCallback() != null) &&
+                                    (componentService.getCallback().getBindings().size()
> 0)){
                                     newComponentService.getCallback().getBindings()
                                         .addAll(componentService.getCallback().getBindings());
+                                } else if ((compositeService.getCallback() != null) &&
+                                           (compositeService.getCallback().getBindings().size()
> 0)){
+                                    newComponentService.getCallback().getBindings()
+                                        .addAll(compositeService.getCallback().getBindings());
+                                } else if ((promotedService.getCallback() != null) &&
+                                           (promotedService.getCallback().getBindings().size()
> 0)){
+                                    newComponentService.getBindings()
+                                        .addAll(promotedService.getBindings());
                                 }
                             }
 

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java?rev=674050&r1=674049&r2=674050&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
Fri Jul  4 06:28:49 2008
@@ -166,19 +166,29 @@
             ComponentService nonCallbackService = null;
             int nonCallbackServices = 0;
             for (ComponentService componentService : component.getServices()) {
-                
+                                  
                 // Index component services by component name / service name
                 String uri = component.getName() + '/' + componentService.getName();
                 componentServices.put(uri, componentService);
-                if (!componentService.isCallback()) {
+                
+                boolean promotedService = false;
+                if (componentService.getName() != null && componentService.getName().indexOf("$promoted$")
> -1) {
+                    promotedService = true;
+                }
+                
+                // count how many non-callback, non-promoted services there are
+                // if there is only one the component name also acts as the service name
+                if ((!componentService.isCallback()) && (!promotedService)) {   
                        
                     
-                    // Check how many non callback services we have
+                    // Check how many non callback non-promoted services we have
                     if (nonCallbackServices == 0) {
                         nonCallbackService = componentService;
                     }
                     nonCallbackServices++;
                 }
+
             }
+            
             if (nonCallbackServices == 1) {
                 // If we have a single non callback service, index it by
                 // component name as well

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?rev=674050&r1=674049&r2=674050&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
Fri Jul  4 06:28:49 2008
@@ -129,11 +129,11 @@
         // Build composite service binding-related information
         compositeServiceBindingBuilder.build(composite);
         
-        // Wire the components
-        componentWireBuilder.build(composite);
-
         // Configure composite services
         compositeServiceConfigurationBuilder.build(composite);
+        
+        // Wire the components
+        componentWireBuilder.build(composite);
 
         // Wire the composite references
         compositeReferenceWireBuilder.build(composite);



Mime
View raw message