summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-06-09 10:01:17 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-06-09 10:01:17 +0000
commitf87589c1e644ea5b8539ac4b100e30837e3fafeb (patch)
tree6b386cfd48d8fed03bebe367aa13b3ed0895ec79 /sca-java-2.x/trunk/modules/builder/src/main/java/org/apache
parent9e744e0ad3d2c889c7fc8780571edd8d9546bdba (diff)
Tidy the processing that creates the links between enpointreferences and endpoints to represent callbacks.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@952936 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/builder/src/main/java/org/apache')
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java96
1 files changed, 60 insertions, 36 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
index 9938a054c5..307def5817 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
@@ -128,24 +128,17 @@ public class EndpointReferenceBuilderImpl {
}
for (ComponentReference reference : component.getReferences()) {
+ // create the endpoint references for this component reference
processComponentReference(composite,
- component,
- reference,
- context);
+ component,
+ reference,
+ context);
- // 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 (Endpoint endpoint : service.getEndpoints()) {
- endpoint.getCallbackEndpointReferences().addAll(reference
- .getEndpointReferences());
- }
- break;
- } // end if
- } // end if
- } // end for
+ // we assume that endpoints have already been created so we can now
+ // create the links between enpoint references and endpoints that
+ // represent callbacks
+ fixUpCallbackLinks(component,
+ reference);
// push down endpoint references into the leaf component references
// in the case where this component reference promotes a reference from
@@ -315,12 +308,6 @@ public class EndpointReferenceBuilderImpl {
endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING);
}
-// if (reference.getCallbackService() != null) {
-// Endpoint callbackEndpoint =
-// createEndpoint(component, reference.getCallbackService(), false);
-// endpointRef.setCallbackEndpoint(callbackEndpoint);
-// }
-
reference.getEndpointReferences().add(endpointRef);
continue;
} // end if
@@ -352,11 +339,6 @@ public class EndpointReferenceBuilderImpl {
}
endpointRef.setTargetEndpoint(endpoint);
-// if (reference.getCallbackService() != null) {
-// Endpoint callbackEndpoint =
-// createEndpoint(component, reference.getCallbackService(), false);
-// endpointRef.setCallbackEndpoint(callbackEndpoint);
-// }
reference.getEndpointReferences().add(endpointRef);
}
}
@@ -659,15 +641,6 @@ public class EndpointReferenceBuilderImpl {
endpointRef.setComponent(component);
endpointRef.setReference(reference);
endpointRef.setUnresolved(unresolved);
-
- // [rfeng] Populate the callback endpoints
- if (reference.getCallbackService() != null) {
- List<Endpoint> callbackEndpoints = reference.getCallbackService().getEndpoints();
- if (!callbackEndpoints.isEmpty()) {
- // [rfeng] FIXME: how to select the callback endpoints?
- endpointRef.setCallbackEndpoint(callbackEndpoints.get(0));
- }
- }
return endpointRef;
} // end method createEndpointRef
@@ -787,6 +760,57 @@ public class EndpointReferenceBuilderImpl {
}
}
+ /**
+ * The SCA callback model causes services and references to be automatically created
+ * to present the callback services and references. These are identifiable as their names
+ * will match the name of the forward reference or service to which they relate. In the general
+ * endpoint reference and endpoint processing we will have created endpoints and endpoint references
+ * for these callback services and references. We now need to related forward enspoint references with
+ * callback endpoints and forward endpoints with callback endpoint references. Here's the model...
+ *
+ * Client Component Target Component
+ * Reference (with callback iface) Service (with callback iface)
+ * EndpointReference ----------------------------------> Endpoint
+ * | |
+ * | |
+ * Service \/ (for the callback) Reference \/ (for the callback)
+ * Endpoint <--------------------------------------------EndpointReference
+ *
+ * TODO - there are issues here with callback binding multiplicities and which callback
+ * endpoint is associated with which endpointreference
+ *
+ * @param reference
+ * @param component
+ */
+ private void fixUpCallbackLinks (Component component, ComponentReference reference){
+
+ // fix up the links between endpoint references and endpoints that represent callbacks
+ // [rfeng] Populate the callback endpoints
+ if (reference.getCallbackService() != null) {
+ List<Endpoint> callbackEndpoints = reference.getCallbackService().getEndpoints();
+ if (!callbackEndpoints.isEmpty()) {
+ for (EndpointReference endpointReference : reference.getEndpointReferences()){
+ // [rfeng] FIXME: how to select the callback endpoints?
+ endpointReference.setCallbackEndpoint(callbackEndpoints.get(0));
+ }
+ }
+ }
+
+ // 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 (Endpoint endpoint : service.getEndpoints()) {
+ endpoint.getCallbackEndpointReferences().addAll(reference
+ .getEndpointReferences());
+ }
+ break;
+ }
+ }
+ }
+ }
+
//=========================================================================
// methods below related to build time matching which is currently disabled
/*