diff options
Diffstat (limited to 'java/sca')
3 files changed, 17 insertions, 28 deletions
diff --git a/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java b/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java index 6dacecb5ac..11e13ced11 100644 --- a/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java +++ b/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java @@ -34,9 +34,10 @@ import org.apache.tuscany.sca.extensibility.ServiceDiscovery; /**
* A Model Resolver for ClassReferences.
- *
+ * @deprecated Use ClassLoaderModelResolver instead
* @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
*/
+@Deprecated()
public class ClassReferenceModelResolver implements ModelResolver {
private Contribution contribution;
private WeakReference<ClassLoader> classLoader;
diff --git a/java/sca/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/java/sca/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver index c69eb40636..6bab6fa3c6 100644 --- a/java/sca/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver +++ b/java/sca/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver @@ -14,5 +14,4 @@ # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-org.apache.tuscany.sca.contribution.java.impl.ClassReferenceModelResolver;model=org.apache.tuscany.sca.contribution.resolver.ClassReference
+org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver;model=org.apache.tuscany.sca.contribution.resolver.ClassReference
diff --git a/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java b/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java index e81856df26..fd645132a1 100644 --- a/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java +++ b/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java @@ -38,15 +38,14 @@ import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProces import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver; import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; import org.apache.tuscany.sca.contribution.scanner.ContributionScanner; +import org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint; 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.monitor.Monitor; import org.apache.tuscany.sca.workspace.scanner.impl.DirectoryContributionScanner; import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner; @@ -63,20 +62,22 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri private FactoryExtensionPoint modelFactories; private URLArtifactProcessor<Object> artifactProcessor; private StAXArtifactProcessor<Object> extensionProcessor; - private UtilityExtensionPoint utilities; - private Monitor monitor = null; + // private UtilityExtensionPoint utilities; + private Monitor monitor; + private ContributionScannerExtensionPoint scanners; public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) { this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); this.modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - hackResolvers(modelResolvers); this.monitor = monitor; URLArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); this.artifactProcessor = new ExtensibleURLArtifactProcessor(artifactProcessors, this.monitor); this.extensionProcessor = extensionProcessor; this.contributionFactory = modelFactories.getFactory(ContributionFactory.class); + this.scanners = extensionPoints.getExtensionPoint(ContributionScannerExtensionPoint.class); } + /* public ContributionContentProcessor(FactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) { this.modelFactories = modelFactories; @@ -87,6 +88,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri this.contributionFactory = modelFactories.getFactory(ContributionFactory.class); this.monitor = monitor; } + */ public String getArtifactType() { return ".contribution/content"; @@ -107,11 +109,13 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri contribution.setUnresolved(true); // Create a contribution scanner - ContributionScanner scanner; - if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) { - scanner = new DirectoryContributionScanner(); - } else { - scanner = new JarContributionScanner(); + ContributionScanner scanner = scanners.getContributionScanner(contributionURL.getProtocol()); + if (scanner == null) { + if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) { + scanner = new DirectoryContributionScanner(); + } else { + scanner = new JarContributionScanner(); + } } // Scan the contribution and list the artifacts contained in it @@ -212,19 +216,4 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri } } - /** - * FIXME Temporary hack for testing the ClassLoaderModelResolver. - * - * @param modelResolvers - */ - private static void hackResolvers(ModelResolverExtensionPoint modelResolvers) { - Class<?> resolverClass = modelResolvers.getResolver(ClassReference.class); - if (resolverClass==null || !resolverClass.getName().equals("org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver")) { - try { - Class<?> loaderResolverClass = Class.forName("org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver", true, ContributionContentProcessor.class.getClassLoader()); - modelResolvers.addResolver(ClassReference.class, (Class<? extends ModelResolver>)loaderResolverClass); - } catch (ClassNotFoundException e) { - } - } - } } |