all connect calls are now validated.
[utils] / trunk / system / general / src / main / java / org / wamblee / system / container / Container.java
index e4466d4a3f5b972f6aab3d96c2e6bd510faf0013..d86ec1ceaa42ded130612eb9c4d8ae46ccbd8c99 100644 (file)
@@ -184,7 +184,26 @@ public class Container extends AbstractComponent<Scope> {
     
     public void connectExternalProvided(String aExternalProvided, String aComponent, String aProvidedInterface) {
         checkSealed();
-        // TODO validate
+        Component server = findComponent(aComponent);
+       
+      
+        if ( server == null ) { 
+               throw new SystemAssemblyException("No component '" + aComponent + "' in the container");
+        }
+        if ( aProvidedInterface != null ) { 
+               if ( findInterface(server.getProvidedInterfaces(), aProvidedInterface) == null) { 
+                       throw new SystemAssemblyException(
+                                       getQualifiedName() + ": Component '" + aComponent + "' does not have a provided interface named '" 
+                                       + aProvidedInterface + "'");
+               }
+        }
+        if ( aExternalProvided != null ) { 
+               if ( findInterface(getProvidedInterfaces(), aExternalProvided) == null) { 
+                       throw new SystemAssemblyException(
+                                       getQualifiedName() + ": Container does not have a provided interface named '" 
+                                       + aExternalProvided + "'");
+               }
+        }
         _edgeFilter.add(new ConnectExternalProvidedProvidedFilter(aExternalProvided, aComponent, aProvidedInterface));
     }