summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-23 18:10:49 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-23 18:10:49 +0000
commit4c6f7de0905e280220dc4467b0bafff7e3635b85 (patch)
tree397bcd6c4cc22dafe43fcd473f164a37219d21e2 /sca-java-2.x/trunk/modules/core/src/main
parent432c594cdbce69a4867817f63aa00174cf39008e (diff)
Get the interface from the endpoint when it is null
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@883440 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
index 3a4ff89357..6839bc241b 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
@@ -32,7 +32,6 @@ import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.context.CompositeContext;
@@ -301,12 +300,11 @@ public class ComponentContextImpl implements RuntimeComponentContext {
public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
RuntimeEndpointReference endpointReference) {
try {
- RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
- InterfaceContract interfaceContract = ref.getInterfaceContract();
- Reference componentTypeReference = ref.getReference();
- if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
- interfaceContract = componentTypeReference.getInterfaceContract();
+ InterfaceContract interfaceContract = endpointReference.getComponentTypeReferenceInterfaceContract();
+ if (businessInterface == null) {
+ businessInterface = (Class<B>)((JavaInterface)interfaceContract.getInterface()).getJavaClass();
}
+ RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
if (refInterfaceContract != interfaceContract) {
ref = (RuntimeComponentReference)ref.clone();
@@ -405,6 +403,9 @@ public class ComponentContextImpl implements RuntimeComponentContext {
*/
private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
throws CloneNotSupportedException, InvalidInterfaceException {
+ if (businessInterface == null) {
+ return interfaceContract;
+ }
boolean compatible = false;
if (interfaceContract != null && interfaceContract.getInterface() != null) {
Interface interfaze = interfaceContract.getInterface();