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
This commit is contained in:
parent
af30b44f36
commit
c66f84baf8
1 changed files with 16 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
@ -123,6 +134,8 @@ public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint {
|
|||
implementationBuilders.put(builder.getModelType(), builder);
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
|
||||
}
|
||||
|
||||
public void addBindingBuilder(BindingBuilder<?> bindingBuilder) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue