From: erik Date: Thu, 12 Nov 2009 21:12:47 +0000 (+0000) Subject: now linking required and provided interfaces only once. X-Git-Tag: wamblee-utils-0.2~1^2~56 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=1ef120c74982f1baf7a38360cb899a1f55753902;p=utils now linking required and provided interfaces only once. --- diff --git a/system/general/src/main/java/org/wamblee/system/container/Container.java b/system/general/src/main/java/org/wamblee/system/container/Container.java index d86ec1ce..3dfda5cf 100644 --- a/system/general/src/main/java/org/wamblee/system/container/Container.java +++ b/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/system/general/src/main/java/org/wamblee/system/core/Scope.java b/system/general/src/main/java/org/wamblee/system/core/Scope.java index 1b9f6615..fe83e857 100644 --- a/system/general/src/main/java/org/wamblee/system/core/Scope.java +++ b/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/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java b/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java index 008f0026..b41c41c8 100644 --- a/system/general/src/main/java/org/wamblee/system/graph/component/ComponentGraph.java +++ b/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; } /**