- // TODO validate
- _edgeFilter.add(new ConnectRequiredExternallyRequiredEdgeFilter(
- aComponent, aRequiredInterface, aExternalRequiredInterface));
+
+ 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));