summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/builder/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 20:35:36 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 20:35:36 +0000
commit06437a98ad81639862c09fe7013f4517033b1d59 (patch)
treeded746f46dd974995a3861d9560250d6b7674575 /java/sca/modules/builder/src/main
parentb9d09efdc4021ab2aaf96b096dcf645a3e0fbbae (diff)
Test that a component implementation has been found/resolved
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825640 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/builder/src/main')
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
index 9c4a1c9282..6b96f9b21e 100644
--- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
+++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
@@ -121,8 +121,13 @@ public class ComponentBuilderImpl {
// do any work we need to do before we calculate the component type
// for this component. Anything that needs to be pushed down the promotion
// hierarchy must be done before we calculate the component type
+
+ // check that the implementation is present
+ if (!isComponentImplementationPresent(component)){
+ return;
+ }
- // first carry out any implementation specific builder processing
+ // carry out any implementation specific builder processing
Implementation impl = component.getImplementation();
if (impl != null) {
ImplementationBuilder builder = builders.getImplementationBuilder(impl.getType());
@@ -151,6 +156,38 @@ public class ComponentBuilderImpl {
monitor.popContext();
}
}
+
+ /**
+ * Checks that a component implementation is present and resolved
+ * before doing anything else
+ *
+ * @param component
+ * @return true if the implementation is present and resolved
+ */
+ private boolean isComponentImplementationPresent(Component component){
+ Implementation implementation = component.getImplementation();
+ if (implementation == null) {
+ // A component must have an implementation
+ Monitor.error(monitor,
+ this,
+ Messages.ASSEMBLY_VALIDATION,
+ "NoComponentImplementation",
+ component.getName());
+ return false;
+ } else if (implementation.isUnresolved()) {
+ // The implementation must be fully resolved
+ Monitor.error(monitor,
+ this,
+ Messages.ASSEMBLY_VALIDATION,
+ "UnresolvedComponentImplementation",
+ component,
+ component.getName(),
+ implementation.getURI());
+ return false;
+ }
+
+ return true;
+ }
/**
* Use the component type builder to build the component type for