diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-06 08:32:38 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-06 08:32:38 +0000 |
commit | 9fb2fb275d3f69a287ac4f1c7d55190fb7a7bb3b (patch) | |
tree | 40a3b6e43c677e8e9321921b95668eba4c75163a /branches/sca-equinox/modules/contribution | |
parent | 4f6fd64d654fec9afb231dd41af9c7d6e41d382f (diff) |
Work in progress. Started to clean up cross-bundle dependencies on ContributionService implementation class, the various CompositeBuilder implementation classes and the ContributionDependencyBuilder implementation class. Added extension points for ContributionBuilders and CompositeBuilders to have them discovered and loaded by the Equinox ServiceDiscovery like other extension points. Moved injection of monitors and SCA definitions to the build methods instead of the constructors to remove references to these implementation constructors. Simplified NodeImpl a bit to remove references to other runtime implementation classes.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@702000 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/modules/contribution')
10 files changed, 47 insertions, 239 deletions
diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java index 743c2356d7..80dece4496 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java @@ -92,6 +92,13 @@ public interface Contribution extends Artifact { void setModelResolver(ModelResolver modelResolver); /** + * Returns the list of contributions that this contribution depends on. + * + * @return + */ + List<Contribution> getDependencies(); + + /** * Returns the ClassLoader used to load classes and resources from * this contribution * diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java deleted file mode 100644 index bf8d75dba9..0000000000 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution; - -import java.lang.reflect.Constructor; -import java.util.HashMap; - -import org.apache.tuscany.sca.extensibility.ServiceDeclaration; -import org.apache.tuscany.sca.extensibility.ServiceDiscovery; - - -/** - * Default implementation of a model factory extension point. - * - * @version $Rev$ $Date$ - */ -public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint { - - private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>(); - - /** - * Constructs a new DefaultModelFactoryExtensionPoint. - */ - public DefaultModelFactoryExtensionPoint() { - } - - /** - * Add a model factory extension. - * - * @param factory The factory to add - */ - public void addFactory(Object factory) { - Class<?>[] interfaces = factory.getClass().getInterfaces(); - if (interfaces.length == 0) { - Class<?> sc = factory.getClass().getSuperclass(); - if (sc != Object.class) { - factories.put(sc, factory); - } - } else { - for (int i = 0; i<interfaces.length; i++) { - factories.put(interfaces[i], factory); - } - } - } - - /** - * Remove a model factory. - * - * @param factory The factory to remove - */ - public void removeFactory(Object factory) { - Class<?>[] interfaces = factory.getClass().getInterfaces(); - if (interfaces.length == 0) { - Class<?> sc = factory.getClass().getSuperclass(); - if (sc != Object.class) { - factories.remove(sc); - } - } else { - for (int i = 0; i<interfaces.length; i++) { - factories.remove(interfaces[i]); - } - } - } - - /** - * Get a factory implementing the given interface. - * @param factoryInterface The lookup key (factory interface) - * @return The factory - */ - public <T> T getFactory(Class<T> factoryInterface) { - Object factory = factories.get(factoryInterface); - if (factory == null) { - - if (factoryInterface.isInterface()) { - - // Dynamically load a factory class declared under META-INF/services - try { - ServiceDeclaration factoryDeclaration = ServiceDiscovery.getInstance().getFirstServiceDeclaration(factoryInterface.getName()); - if (factoryDeclaration != null) { - Class<?> factoryClass = factoryDeclaration.loadClass(); - - try { - // Default empty constructor - Constructor<?> constructor = factoryClass.getConstructor(); - factory = constructor.newInstance(); - } catch (NoSuchMethodException e) { - - // Constructor taking the model factory extension point - Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class); - factory = constructor.newInstance(this); - } - - // Cache the loaded factory - addFactory(factory); - } - } catch (Exception e) { - throw new IllegalArgumentException(e); - } - } else { - - // Call the newInstance static method on the factory abstract class - try { - factory = ServiceDiscovery.getInstance().newFactoryClassInstance(factoryInterface.getName()); - } catch (Exception e) { - throw new IllegalArgumentException(e); - } - - // Cache the factory - addFactory(factory); - } - } - return factoryInterface.cast(factory); - } - -} diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java deleted file mode 100644 index 0ada4ebec3..0000000000 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution; - -/** - * An extension point for model factories. Model factories are provided to - * abstract the classes that represent artifacts in the assembly model away - * from their creation mechanism. When the runtime needs to extend the model - * as it reads in contributed artifacts it looks up the factory for the - * artifact required in this registry - * - * @version $Rev$ $Date$ - */ -public interface ModelFactoryExtensionPoint { - - /** - * Add a model factory extension. - * - * @param factory The factory to add - */ - void addFactory(Object factory); - - /** - * Remove a model factory extension. - * - * @param factory The factory to remove - */ - void removeFactory(Object factory); - - /** - * Get a factory implementing the given interface. - * @param factoryInterface the lookup key (factory interface) - * @return The factory - */ - <T> T getFactory(Class<T> factoryInterface); - -} diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java index fc9ae607e7..0b41016caa 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java @@ -44,6 +44,7 @@ class ContributionImpl implements Contribution { private List<Import> imports = new ArrayList<Import>(); private List<Composite> deployables = new ArrayList<Composite>(); private List<Artifact> artifacts = new ArrayList<Artifact>(); + private List<Contribution> dependencies = new ArrayList<Contribution>(); private ModelResolver modelResolver; // FIXME remove this dependency on Java ClassLoaders @@ -111,6 +112,10 @@ class ContributionImpl implements Contribution { this.modelResolver = modelResolver; } + public List<Contribution> getDependencies() { + return dependencies; + } + public List<Export> getExports() { return exports; } diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java index 1fb2ecd017..e2995b3868 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java @@ -31,12 +31,12 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; @@ -56,7 +56,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor> implements StAXArtifactProcessorExtensionPoint { private ExtensionPointRegistry extensionPoints; - private ModelFactoryExtensionPoint modelFactories; + private FactoryExtensionPoint modelFactories; private MonitorFactory monitorFactory; private boolean loaded; private StAXArtifactProcessor<Object> extensibleStAXProcessor; @@ -68,7 +68,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends */ public DefaultStAXArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) { this.extensionPoints = extensionPoints; - this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); @@ -215,7 +215,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends String factoryName, ServiceDeclaration processorDeclaration, ExtensionPointRegistry extensionPoints, - ModelFactoryExtensionPoint modelFactories, + FactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor, StAXAttributeProcessor<Object> extensionAttributeProcessor, Monitor monitor) { @@ -249,7 +249,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends .equals("org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor")) { // Specific initialization for the DefaultBeanModelProcessor - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class); try { @@ -282,7 +282,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends throw ie; } } else { - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); // Load and instantiate the processor class try { @@ -290,7 +290,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends (Class<StAXArtifactProcessor>)processorDeclaration.loadClass(); try { Constructor<StAXArtifactProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, Monitor.class); processor = constructor.newInstance(modelFactories, monitor); } catch (NoSuchMethodException e) { try { @@ -300,12 +300,12 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends } catch (NoSuchMethodException e1) { try { Constructor<StAXArtifactProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class); processor = constructor.newInstance(modelFactories, extensionProcessor, monitor); } catch (NoSuchMethodException e2) { try { Constructor<StAXArtifactProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, StAXAttributeProcessor.class, Monitor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, StAXArtifactProcessor.class, StAXAttributeProcessor.class, Monitor.class); processor = constructor.newInstance(modelFactories, extensionProcessor, extensionAttributeProcessor, monitor); } catch (NoSuchMethodException e2a) { try { @@ -321,7 +321,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends try { Constructor<StAXArtifactProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class); + processorClass.getConstructor(FactoryExtensionPoint.class); processor = constructor.newInstance(modelFactories); } catch (NoSuchMethodException e4) { try { @@ -331,7 +331,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends } catch (NoSuchMethodException e4a) { try { Constructor<StAXArtifactProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, StAXArtifactProcessor.class); processor = constructor.newInstance(modelFactories, extensionProcessor); } catch (NoSuchMethodException e5) { Constructor<StAXArtifactProcessor> constructor = diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java index 293b455810..5fbe2b3a52 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java @@ -30,12 +30,12 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; @@ -54,7 +54,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends DefaultArtifactProcessorExtensionPoint<StAXAttributeProcessor> implements StAXAttributeProcessorExtensionPoint { private ExtensionPointRegistry extensionPoints; - private ModelFactoryExtensionPoint modelFactories; + private FactoryExtensionPoint modelFactories; private StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor; private boolean loaded; private Monitor monitor = null; @@ -64,7 +64,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends */ public DefaultStAXAttributeProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) { this.extensionPoints = extensionPoints; - this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); @@ -208,7 +208,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends String factoryName, ServiceDeclaration processorDeclaration, ExtensionPointRegistry extensionPoints, - ModelFactoryExtensionPoint modelFactories, + FactoryExtensionPoint modelFactories, StAXAttributeProcessor<Object> extensionProcessor, Monitor monitor) { @@ -235,7 +235,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends @SuppressWarnings("unchecked") private StAXAttributeProcessor getProcessor() { if (processor == null) { - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); // Load and instantiate the processor class try { @@ -243,7 +243,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends (Class<StAXAttributeProcessor>)processorDeclaration.loadClass(); try { Constructor<StAXAttributeProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, Monitor.class); processor = constructor.newInstance(modelFactories, monitor); } catch (NoSuchMethodException e) { try { @@ -253,7 +253,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends } catch (NoSuchMethodException e1) { try { Constructor<StAXAttributeProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class); processor = constructor.newInstance(modelFactories, extensionProcessor, monitor); } catch (NoSuchMethodException e2) { try { @@ -263,7 +263,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends } catch (NoSuchMethodException e3) { try { Constructor<StAXAttributeProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class); + processorClass.getConstructor(FactoryExtensionPoint.class); processor = constructor.newInstance(modelFactories); } catch (NoSuchMethodException e4) { try { @@ -273,7 +273,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends } catch (NoSuchMethodException e4a) { try { Constructor<StAXAttributeProcessor> constructor = - processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class); + processorClass.getConstructor(FactoryExtensionPoint.class, StAXArtifactProcessor.class); processor = constructor.newInstance(modelFactories, extensionProcessor); } catch (NoSuchMethodException e5) { Constructor<StAXAttributeProcessor> constructor = diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java index 1c7dbef5ec..e4c6152bc4 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java @@ -28,11 +28,11 @@ import java.util.Set; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; @@ -62,7 +62,7 @@ public class DefaultURLArtifactProcessorExtensionPoint */ public DefaultURLArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) { this.extensionPoints = extensionPoints; - ModelFactoryExtensionPoint modelFactories = this.extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = this.extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); @@ -193,14 +193,14 @@ public class DefaultURLArtifactProcessorExtensionPoint private URLArtifactProcessor getProcessor() { if (processor == null) { try { - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); Class<URLArtifactProcessor> processorClass = (Class<URLArtifactProcessor>)processorDeclaration.loadClass(); try { - Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class); + Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(FactoryExtensionPoint.class, Monitor.class); processor = constructor.newInstance(modelFactories, monitor); } catch (NoSuchMethodException e) { try { - Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class); + Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(FactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class); processor = constructor.newInstance(modelFactories, staxProcessor, monitor); } catch (NoSuchMethodException e2) { Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, Monitor.class); diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java index de54d54f94..d20737103b 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java @@ -25,7 +25,7 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.Base; import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; /** * An implementation of an extensible model resolver which delegates to the @@ -35,7 +35,7 @@ import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; */ public class ExtensibleModelResolver implements ModelResolver { private final ModelResolverExtensionPoint resolverExtensions; - private final ModelFactoryExtensionPoint modelFactories; + private final FactoryExtensionPoint modelFactories; private final Contribution contribution; private ModelResolver defaultResolver; private final Map<Class<?>, ModelResolver> resolversByModelType = new HashMap<Class<?>, ModelResolver>(); @@ -54,7 +54,7 @@ public class ExtensibleModelResolver implements ModelResolver { @Deprecated public ExtensibleModelResolver(Contribution contribution, ModelResolverExtensionPoint resolverExtensions, - ModelFactoryExtensionPoint modelFactories, + FactoryExtensionPoint modelFactories, ModelResolver defaultResolver) { this.contribution = contribution; this.resolverExtensions = resolverExtensions; @@ -74,7 +74,7 @@ public class ExtensibleModelResolver implements ModelResolver { */ public ExtensibleModelResolver(Contribution contribution, ModelResolverExtensionPoint resolverExtensions, - ModelFactoryExtensionPoint modelFactories) { + FactoryExtensionPoint modelFactories) { this.contribution = contribution; this.resolverExtensions = resolverExtensions; this.modelFactories = modelFactories; @@ -118,7 +118,7 @@ public class ExtensibleModelResolver implements ModelResolver { try { Constructor<? extends ModelResolver> constructor = resolverClass - .getConstructor(new Class[] {Contribution.class, ModelFactoryExtensionPoint.class}); + .getConstructor(new Class[] {Contribution.class, FactoryExtensionPoint.class}); if (constructor != null) { resolverInstance = constructor.newInstance(contribution, modelFactories); diff --git a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java index f36595d64f..202fea0e34 100644 --- a/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java +++ b/branches/sca-equinox/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; @@ -40,13 +40,13 @@ public class DefaultContributionListenerExtensionPoint implements ContributionLi private List<ContributionListener> listeners = new CopyOnWriteArrayList<ContributionListener>(); private boolean loadedListeners; - private ModelFactoryExtensionPoint modelFactories; + private FactoryExtensionPoint modelFactories; /** * Constructs a new DefaultContributionListenerExtensionPoint. * */ - public DefaultContributionListenerExtensionPoint(ModelFactoryExtensionPoint modelFactories) { + public DefaultContributionListenerExtensionPoint(FactoryExtensionPoint modelFactories) { this.modelFactories = modelFactories; } @@ -55,7 +55,7 @@ public class DefaultContributionListenerExtensionPoint implements ContributionLi * */ public DefaultContributionListenerExtensionPoint(ExtensionPointRegistry extensionPoints) { - this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); } public void addContributionListener(ContributionListener listener) { @@ -93,7 +93,7 @@ public class DefaultContributionListenerExtensionPoint implements ContributionLi try { Class<ContributionListener> listenerClass = (Class<ContributionListener>)listenerDeclaration.loadClass(); try { - Constructor<ContributionListener> constructor = listenerClass.getConstructor(ModelFactoryExtensionPoint.class); + Constructor<ContributionListener> constructor = listenerClass.getConstructor(FactoryExtensionPoint.class); try { listener = constructor.newInstance(modelFactories); } catch (InvocationTargetException e) { diff --git a/branches/sca-equinox/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint b/branches/sca-equinox/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint deleted file mode 100644 index 6b4d2ebdeb..0000000000 --- a/branches/sca-equinox/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint
|