You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2009/10/15 22:35:36 UTC
svn commit: r825640 -
/tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
Author: slaws
Date: Thu Oct 15 20:35:36 2009
New Revision: 825640
URL: http://svn.apache.org/viewvc?rev=825640&view=rev
Log:
Test that a component implementation has been found/resolved
Modified:
tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
Modified: tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java?rev=825640&r1=825639&r2=825640&view=diff
==============================================================================
--- tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java (original)
+++ tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java Thu Oct 15 20:35:36 2009
@@ -121,8 +121,13 @@
// 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 @@
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