From aabf9dd7f2cfecbe48b2d4658ca8bfde3ec50a72 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 12 Nov 2009 21:12:47 +0000 Subject: [PATCH] now linking required and provided interfaces only once. --- .../main/java/org/wamblee/system/container/Container.java | 5 +---- .../src/main/java/org/wamblee/system/core/Scope.java | 1 - .../wamblee/system/graph/component/ComponentGraph.java | 8 +++++++- 3 files changed, 8 insertions(+), 6 deletions(-) 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 d86ec1ce..3dfda5cf 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 @@ -273,7 +273,6 @@ public class Container extends AbstractComponent { @Override protected Scope doStart(Scope aExternalScope) { - checkSealed(); validate(); Scope scope = new DefaultScope(getProvidedInterfaces().toArray(new ProvidedInterface[0]), aExternalScope); ComponentGraph graph = doStartOptionalDryRun(scope, false); @@ -294,9 +293,7 @@ public class Container extends AbstractComponent { private ComponentGraph doStartOptionalDryRun(Scope aScope, boolean aDryRun) { ComponentGraph graph = createComponentGraph(); graph.validate(); - if (!aDryRun) { - graph.link(); - } + graph.link(); LOG.info("Starting '" + getQualifiedName() + "'"); diff --git a/trunk/system/general/src/main/java/org/wamblee/system/core/Scope.java b/trunk/system/general/src/main/java/org/wamblee/system/core/Scope.java index 1b9f6615..fe83e857 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/core/Scope.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/core/Scope.java @@ -55,7 +55,6 @@ public interface Scope { /** * Publishes an implementation of a provided interface. - * @param aComponent Component that provides the interface. * @param aInterface Interface that is provided. * @param aImplementation Implementation of the interface. */ diff --git a/trunk/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java b/trunk/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java index 008f0026..b41c41c8 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java @@ -36,12 +36,14 @@ import org.wamblee.system.graph.Node; */ public class ComponentGraph extends Graph { + private boolean _isLinked; private CompositeEdgeFilter _edgeFilter; /** * Constructs an empty component graph. */ public ComponentGraph() { + _isLinked = false; _edgeFilter = new CompositeEdgeFilter(); } @@ -82,8 +84,12 @@ public class ComponentGraph extends Graph { * Links provided and required interfaces together in the component * model based on the graph model. */ - public void link() { + public void link() { + if ( _isLinked ) { + return; + } accept(new LinkVisitor()); + _isLinked = true; } /** -- 2.31.1