From c66f84baf8c62d073148a230e4da2c0e44cd7592 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 15 Sep 2009 16:42:44 +0000 Subject: Fix the on-demand loading and add stop() to clean up git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@815388 13f79535-47bb-0310-9956-ffa450edef68 --- .../assembly/builder/DefaultBuilderExtensionPoint.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'java/sca/modules') diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java index 82ac909d74..b0fea72f24 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java @@ -34,6 +34,7 @@ import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.core.LifeCycleListener; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; @@ -46,7 +47,7 @@ import org.apache.tuscany.sca.monitor.Monitor; * * @version $Rev$ $Date$ */ -public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint { +public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint, LifeCycleListener { private ExtensionPointRegistry registry; private final Map builders = new HashMap(); @@ -59,6 +60,16 @@ public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint { this.registry = registry; } + public void start() { + } + + public void stop() { + builders.clear(); + bindingBuilders.clear(); + implementationBuilders.clear(); + loaded = false; + } + public void addCompositeBuilder(CompositeBuilder builder) { builders.put(builder.getID(), builder); } @@ -122,6 +133,8 @@ public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint { ImplementationBuilder builder = new LazyImplementationBuilder(builderDeclaration); implementationBuilders.put(builder.getModelType(), builder); } + + loaded = true; } @@ -134,6 +147,7 @@ public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint { } public BindingBuilder getBindingBuilder(Class bindingType) { + loadBuilders(); if (bindingType.isInterface()) { return (BindingBuilder)bindingBuilders.get(bindingType); } @@ -148,6 +162,7 @@ public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint { } public ImplementationBuilder getImplementationBuilder(Class implementationType) { + loadBuilders(); if (implementationType.isInterface()) { return (ImplementationBuilder)implementationBuilders.get(implementationType); } -- cgit v1.2.3