+
+ Component client = findComponent(aClientComponent);
+ Component server = findComponent(aServerComponent);
+
+ if (client == null) {
+ throw new SystemAssemblyException(getQualifiedName() +
+ ": No component '" + aClientComponent + "' in the container");
+ }
+
+ if (aRequiredInterface != null) {
+ if (findInterface(client.getRequiredInterfaces(),
+ aRequiredInterface) == null) {
+ throw new SystemAssemblyException(getQualifiedName() +
+ ": Component '" + aClientComponent +
+ "' does not have a required interface named '" +
+ aRequiredInterface + "'");
+ }
+ }
+
+ if (server == null) {
+ throw new SystemAssemblyException("No component '" +
+ aClientComponent + "' in the container");
+ }
+
+ if (aProvidedInterface != null) {
+ if (findInterface(server.getProvidedInterfaces(),
+ aProvidedInterface) == null) {
+ throw new SystemAssemblyException(getQualifiedName() +
+ ": Component '" + aServerComponent +
+ "' does not have a provided interface named '" +
+ aProvidedInterface + "'");
+ }
+ }
+
+ edgeFilter.add(new ConnectRequiredProvidedEdgeFilter(aClientComponent,
+ aRequiredInterface, aServerComponent, aProvidedInterface));
+ }
+
+ /**
+ * Explicitly connects a externally required interface to an internally
+ * required interface.
+ *
+ * @param aComponent
+ * Component requiring the interface (must be non-null).
+ * @param aRequiredInterface
+ * Required interface of the component (must be non-null).
+ * @param aExternalRequiredInterface
+ * Externally required interface (must be non-null).
+ *
+ */
+ public void connectExternalRequired(String aComponent,
+ String aRequiredInterface, String aExternalRequiredInterface) {
+ checkSealed();
+
+ 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();
+
+ 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));