summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-03-08 12:00:38 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-03-08 12:00:38 +0000
commitfa12862cdde921c4893204a0dc28cf7d80e2cebf (patch)
tree5310fd403d54e2d277047e8980838c674dc05a9c /sca-java-2.x/trunk/modules/core/src
parentdf6bd28390b0cd99119934763a4a664b6aa5347d (diff)
Switch binder interface over to throwing exceptions rather than returning booleans. Allows the full details of a missmatch to be retrieved in the runtime case as well as the build time case. Update the matching test case to take advantage of the extra information.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@920287 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java5
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java22
2 files changed, 13 insertions, 14 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
index 2e68602713..9ef0d8e728 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
@@ -302,10 +302,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
private void resolveEndpointReference() {
resolve();
- boolean ok = eprBinder.bindRunTime(endpointRegistry, this);
- if (!ok) {
- throw new ServiceRuntimeException("Unable to bind " + this);
- }
+ eprBinder.bindRunTime(endpointRegistry, this);
// start the binding provider
final ReferenceBindingProvider bindingProvider = getBindingProvider();
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
index fe313e6472..e72a9f2e35 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
@@ -49,6 +49,7 @@ import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.Qualifier;
import org.apache.tuscany.sca.runtime.EndpointReferenceBinder;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.oasisopen.sca.ServiceRuntimeException;
/**
* A builder that takes endpoint references and resolves them. It either finds local
@@ -92,9 +93,9 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
* @param endpointRegistry
* @param endpointReference
*/
- public boolean bindBuildTime(EndpointRegistry endpointRegistry,
+ public void bindBuildTime(EndpointRegistry endpointRegistry,
EndpointReference endpointReference) {
- return bind(endpointRegistry, endpointReference, false);
+ bind(endpointRegistry, endpointReference, false);
}
/**
@@ -104,9 +105,9 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
* @param endpointRegistry
* @param endpointReference
*/
- public boolean bindRunTime(EndpointRegistry endpointRegistry,
+ public void bindRunTime(EndpointRegistry endpointRegistry,
EndpointReference endpointReference) {
- return bind(endpointRegistry, endpointReference, true);
+ bind(endpointRegistry, endpointReference, true);
}
/**
@@ -116,7 +117,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
* @param endpointReference
* @param runtime set true if called from the runtime
*/
- public boolean bind(EndpointRegistry endpointRegistry,
+ public void bind(EndpointRegistry endpointRegistry,
EndpointReference endpointReference,
boolean runtime){
@@ -183,7 +184,8 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
"endpoint-validation-messages",
"NoComponentReferenceTarget",
endpointReference.getReference().getName());
- return false;
+ throw new ServiceRuntimeException("Unable to bind " +
+ monitor.getLastProblem().toString());
}
}
@@ -242,7 +244,8 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
"endpoint-validation-messages",
"NoEndpointsFound",
endpointReference.toString());
- return false;
+ throw new ServiceRuntimeException("Unable to bind " +
+ monitor.getLastProblem().toString());
}
}
@@ -277,10 +280,9 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
endpointReference.toString());
}
- return false;
+ throw new ServiceRuntimeException("Unable to bind " +
+ monitor.getLastProblem().toString());
}
-
- return true;
}
/**