X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=trunk%2Fsystem%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcontainer%2FContainer.java;h=d86ec1ceaa42ded130612eb9c4d8ae46ccbd8c99;hb=57ee5a967d3c442d402158cb9b2ac825f8c31edf;hp=9ef2ae18d817a0e35f8fda0c20c525a29d08775e;hpb=e6b6fb93462537cb3a1573d01178a5a026edb98f;p=utils diff --git a/trunk/system/general/src/main/java/org/wamblee/system/container/Container.java b/trunk/system/general/src/main/java/org/wamblee/system/container/Container.java index 9ef2ae18..d86ec1ce 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/container/Container.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/container/Container.java @@ -160,14 +160,50 @@ public class Container extends AbstractComponent { public void connectExternalRequired(String aComponent, String aRequiredInterface, String aExternalRequiredInterface) { checkSealed(); - // TODO validate + Component client = findComponent(aComponent); + if ( client == null ) { + throw new SystemAssemblyException(getQualifiedName() + ": No component '" + aComponent + "' in the container"); + } + if ( aRequiredInterface != null ) { + if ( findInterface(client.getRequiredInterfaces(), aRequiredInterface) == null ) { + throw new SystemAssemblyException( + getQualifiedName() + ": Component '" + aComponent + "' does not have a required interface named '" + + aRequiredInterface + "'"); + } + } + if ( aExternalRequiredInterface != null) { + if ( findInterface(getRequiredInterfaces(), aExternalRequiredInterface) == null ) { + throw new SystemAssemblyException( + getQualifiedName() + ": container does not have a required interface named '" + + aExternalRequiredInterface + "'"); + } + } _edgeFilter.add(new ConnectRequiredExternallyRequiredEdgeFilter( aComponent, aRequiredInterface, aExternalRequiredInterface)); } 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)); }