diff options
Diffstat (limited to 'java/sca/modules/contribution/src/main')
9 files changed, 25 insertions, 12 deletions
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java index 906a5e1542..df313f3635 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java @@ -37,6 +37,7 @@ import org.apache.tuscany.sca.contribution.resolver.DefaultDelegatingModelResolv import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; +import org.apache.tuscany.sca.monitor.Monitor; /** * A Model Resolver for ClassReferences. @@ -66,7 +67,7 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes return urls.toArray(new URL[urls.size()]); } - public ClassLoaderModelResolver(final Contribution contribution, FactoryExtensionPoint modelFactories) throws IOException { + public ClassLoaderModelResolver(final Contribution contribution, FactoryExtensionPoint modelFactories, Monitor monitor) throws IOException { super(getContributionURLs(contribution), parentClassLoader(contribution)); this.contribution = contribution; diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java index 811c5b7010..c023b3dc5b 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java @@ -31,6 +31,7 @@ import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; +import org.apache.tuscany.sca.monitor.Monitor; /** * A Model Resolver for ClassReferences. @@ -45,7 +46,7 @@ public class ClassReferenceModelResolver implements ModelResolver { private ModelResolver osgiResolver; - public ClassReferenceModelResolver(final Contribution contribution, FactoryExtensionPoint modelFactories) { + public ClassReferenceModelResolver(final Contribution contribution, FactoryExtensionPoint modelFactories, Monitor monitor) { this.contribution = contribution; if (this.contribution != null) { // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy. diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java index 8d5412f6d7..c1e3f13b77 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.contribution.java.impl; import org.apache.tuscany.sca.contribution.java.JavaExport; import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.monitor.Monitor; /** * A model resolver for Java exports. @@ -33,7 +34,7 @@ public class JavaExportModelResolver implements ModelResolver { private JavaExport export; private ModelResolver resolver; - public JavaExportModelResolver(JavaExport export, ModelResolver resolver) { + public JavaExportModelResolver(JavaExport export, ModelResolver resolver, Monitor monitor) { this.export = export; this.resolver = resolver; } diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java index 6decc004a6..73fbea31a0 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java @@ -143,6 +143,6 @@ public class JavaExportProcessor implements StAXArtifactProcessor<JavaExport> { if (javaExport.getPackage() != null) // Initialize the export resolver - javaExport.setModelResolver(new JavaExportModelResolver(javaExport, resolver)); + javaExport.setModelResolver(new JavaExportModelResolver(javaExport, resolver, monitor)); } } diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java index d651393e78..707d8c05c8 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java @@ -122,7 +122,7 @@ public class ContributionContentProcessor implements ExtendedURLArtifactProcesso Contribution contribution = contributionFactory.createContribution(); contribution.setURI(contributionURI.toString()); contribution.setLocation(contributionURL.toString()); - ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories); + ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, monitor); contribution.setModelResolver(modelResolver); contribution.setUnresolved(true); diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionInfoProcessor.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionInfoProcessor.java index ef435d6aed..eb1946c4b8 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionInfoProcessor.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionInfoProcessor.java @@ -66,8 +66,10 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut private URLArtifactProcessorExtensionPoint artifactProcessors; private URLArtifactProcessor<Object> artifactProcessor; private StAXArtifactProcessor<Object> extensionProcessor; + private Monitor monitor; public ContributionInfoProcessor(ExtensionPointRegistry extensionPoints, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) { + this.monitor = monitor; this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); this.modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); hackResolvers(modelResolvers); @@ -100,7 +102,7 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut Contribution contribution = contributionFactory.createContribution(); contribution.setURI(contributionURI.toString()); contribution.setLocation(contributionURL.toString()); - ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories); + ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, monitor); contribution.setModelResolver(modelResolver); contribution.setUnresolved(true); diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java index 1803315e2e..12e5543672 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java @@ -26,6 +26,7 @@ import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.DefaultImport; import org.apache.tuscany.sca.contribution.Import; import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; /** * A default implementation of a model resolver based on a map. @@ -40,7 +41,7 @@ public class DefaultModelResolver implements ModelResolver { public DefaultModelResolver() { } - public DefaultModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) { + public DefaultModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories, Monitor monitor) { this.contribution = contribution; } diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java index b48742bcae..1e6c0f7a18 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; /** * An implementation of an extensible model resolver which delegates to the @@ -41,6 +42,7 @@ public class ExtensibleModelResolver implements ModelResolver { private final Map<Class<?>, ModelResolver> resolversByImplementationClass = new HashMap<Class<?>, ModelResolver>(); private Map<Object, Object> map = new HashMap<Object, Object>(); private Object lastUnresolved; + private Monitor monitor; /** * Constructs an extensible model resolver @@ -54,7 +56,8 @@ public class ExtensibleModelResolver implements ModelResolver { public ExtensibleModelResolver(Contribution contribution, ModelResolverExtensionPoint resolverExtensions, FactoryExtensionPoint modelFactories, - ModelResolver defaultResolver) { + ModelResolver defaultResolver, + Monitor monitor) { this.contribution = contribution; this.resolverExtensions = resolverExtensions; this.modelFactories = modelFactories; @@ -62,6 +65,7 @@ public class ExtensibleModelResolver implements ModelResolver { // but they should be handled by the contribution import/export mechanism instead of this // defaultResolver hack. this.defaultResolver = defaultResolver; + this.monitor = monitor; } /** @@ -73,10 +77,12 @@ public class ExtensibleModelResolver implements ModelResolver { */ public ExtensibleModelResolver(Contribution contribution, ModelResolverExtensionPoint resolverExtensions, - FactoryExtensionPoint modelFactories) { + FactoryExtensionPoint modelFactories, + Monitor monitor) { this.contribution = contribution; this.resolverExtensions = resolverExtensions; this.modelFactories = modelFactories; + this.monitor = monitor; } /** @@ -117,10 +123,10 @@ public class ExtensibleModelResolver implements ModelResolver { try { Constructor<? extends ModelResolver> constructor = resolverClass - .getConstructor(new Class[] {Contribution.class, FactoryExtensionPoint.class}); + .getConstructor(new Class[] {Contribution.class, FactoryExtensionPoint.class, Monitor.class}); if (constructor != null) { - resolverInstance = constructor.newInstance(contribution, modelFactories); + resolverInstance = constructor.newInstance(contribution, modelFactories, monitor); resolversByImplementationClass.put(resolverClass, resolverInstance); resolversByModelType.put(c, resolverInstance); return resolverInstance; diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java index ddc768b61c..91e74edf47 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; /** * A Model Resolver for Contribution models. @@ -35,7 +36,7 @@ public class ContributionModelResolver implements ModelResolver { private Map<String, Contribution> map = new HashMap<String, Contribution>(); - public ContributionModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) { + public ContributionModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories, Monitor monitor) { } public void addModel(Object resolved) { |