summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-03-20 14:06:57 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-03-20 14:06:57 +0000
commit69f8529dfda40548650b580b94f05d0fac7b1b37 (patch)
treeb22d87ff09236a1065a19b104e99d979ed832114 /java/sca
parent0e89155325b1c03e04881bef30a933333e88ae83 (diff)
wait until endpoint references have been created before trying to set callback endpoint reference on the services
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@756470 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java17
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java16
2 files changed, 16 insertions, 17 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
index e773df2140..69e13a41fa 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
import org.apache.tuscany.sca.definitions.Definitions;
@@ -94,9 +95,23 @@ public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderI
// create endpoint references to represent the component reference
for (ComponentReference reference : component.getReferences()) {
+
createReferenceEndpointReferences(composite, component, reference, components, componentServices, monitor);
+
+ // fix up links between endpoints and endpoint references that represent callbacks
+ for (ComponentService service : component.getServices()){
+ if ((service.getInterfaceContract() != null) &&
+ (service.getInterfaceContract().getCallbackInterface() != null)){
+ if ( reference.getName().equals(service.getName())){
+ for ( Endpoint2 endpoint : service.getEndpoints()){
+ endpoint.getCallbackEndpointReferences().addAll(reference.getEndpointReferences());
+ }
+ break;
+ }
+ }
+ }
}
- }
+ }
}
private void createReferenceEndpointReferences(Composite composite,
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java
index 1dc7af226a..aaebfaf29e 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java
@@ -119,28 +119,12 @@ public class ComponentServiceEndpointBuilderImpl implements CompositeBuilder {
endpointComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
}
- // if this service has a callback get the callback endpoint references
- List<EndpointReference2> callbackEndpointReferences = null;
-
- if ((service.getInterfaceContract() != null) &&
- (service.getInterfaceContract().getCallbackInterface() != null)){
- // find the callback reference
- for ( Reference reference : component.getReferences()){
- if ( reference.getName().equals(service.getName())){
- callbackEndpointReferences = reference.getEndpointReferences();
- break;
- }
- }
- }
for (Binding binding : service.getBindings()){
Endpoint2 endpoint = assemblyFactory.createEndpoint();
endpoint.setComponent(endpointComponent);
endpoint.setService(endpointService);
endpoint.setBinding(binding);
- if (callbackEndpointReferences != null) {
- endpoint.getCallbackEndpointReferences().addAll(callbackEndpointReferences);
- }
endpoint.setUnresolved(false);
service.getEndpoints().add(endpoint);
}