diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-15 16:42:44 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-15 16:42:44 +0000 |
commit | c66f84baf8c62d073148a230e4da2c0e44cd7592 (patch) | |
tree | aaca9220e5101ed0aefb59285b2bb793484db9e4 /java/sca/modules | |
parent | af30b44f3608b044441c37731d36ceb1964edd9e (diff) |
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
Diffstat (limited to 'java/sca/modules')
-rw-r--r-- | java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java | 17 |
1 files changed, 16 insertions, 1 deletions
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<String, CompositeBuilder> builders = new HashMap<String, CompositeBuilder>(); @@ -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 <B extends Binding> BindingBuilder<B> getBindingBuilder(Class<B> bindingType) { + loadBuilders(); if (bindingType.isInterface()) { return (BindingBuilder<B>)bindingBuilders.get(bindingType); } @@ -148,6 +162,7 @@ public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint { } public <I extends Implementation> ImplementationBuilder<I> getImplementationBuilder(Class<I> implementationType) { + loadBuilders(); if (implementationType.isInterface()) { return (ImplementationBuilder<I>)implementationBuilders.get(implementationType); } |