Search in sources :

Example 41 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class BundlePluginDependenciesResolver method findDependencyPackageClosure.

private Set<String> findDependencyPackageClosure(Set<BundleDependency> pluginDependencies, List<ArtifactPluginDescriptor> resolvedPlugins) {
    Set<String> exportedPackages = new HashSet<>();
    for (BundleDependency pluginDependency : pluginDependencies) {
        final Optional<String> classifier = pluginDependency.getDescriptor().getClassifier();
        if (classifier.isPresent() && MULE_PLUGIN_CLASSIFIER.equals(classifier.get())) {
            ArtifactPluginDescriptor dependencyDescriptor = findArtifactPluginDescriptor(pluginDependency, resolvedPlugins);
            exportedPackages.addAll(dependencyDescriptor.getClassLoaderModel().getExportedPackages());
            exportedPackages.addAll(findDependencyPackageClosure(dependencyDescriptor.getClassLoaderModel().getDependencies(), resolvedPlugins));
        }
    }
    return exportedPackages;
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) BundleDependency(org.mule.runtime.module.artifact.api.descriptor.BundleDependency) HashSet(java.util.HashSet)

Example 42 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class BundlePluginDependenciesResolver method createResolutionErrorMessage.

protected static String createResolutionErrorMessage(List<ArtifactPluginDescriptor> unresolvedPlugins, List<ArtifactPluginDescriptor> resolvedPlugins) {
    StringBuilder builder = new StringBuilder("Unable to resolve plugin dependencies:");
    for (ArtifactPluginDescriptor unresolvedPlugin : unresolvedPlugins) {
        builder.append("\nPlugin: ").append(unresolvedPlugin.getName()).append(" missing dependencies:");
        List<BundleDependency> missingDependencies = new ArrayList<>();
        for (BundleDependency dependency : unresolvedPlugin.getClassLoaderModel().getDependencies()) {
            Optional<String> classifierOptional = dependency.getDescriptor().getClassifier();
            if (classifierOptional.isPresent() && MULE_PLUGIN_CLASSIFIER.equals(classifierOptional.get())) {
                final ArtifactPluginDescriptor dependencyDescriptor = findArtifactPluginDescriptor(dependency, resolvedPlugins);
                if (dependencyDescriptor == null) {
                    missingDependencies.add(dependency);
                }
            }
        }
        builder.append(missingDependencies);
    }
    return builder.toString();
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) BundleDependency(org.mule.runtime.module.artifact.api.descriptor.BundleDependency) ArrayList(java.util.ArrayList)

Aggregations

ArtifactPluginDescriptor (org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor)42 Test (org.junit.Test)24 ClassLoaderModelBuilder (org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder)15 ArtifactClassLoader (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoader)11 File (java.io.File)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 LookupStrategy (org.mule.runtime.module.artifact.api.classloader.LookupStrategy)6 BundleDependency (org.mule.runtime.module.artifact.api.descriptor.BundleDependency)6 ClassLoaderLookupPolicy (org.mule.runtime.module.artifact.api.classloader.ClassLoaderLookupPolicy)5 HashSet (java.util.HashSet)4 LinkedList (java.util.LinkedList)4 List (java.util.List)4 Optional (java.util.Optional)4 Domain (org.mule.runtime.deployment.model.api.domain.Domain)4 DomainDescriptor (org.mule.runtime.deployment.model.api.domain.DomainDescriptor)4 ArtifactPlugin (org.mule.runtime.deployment.model.api.plugin.ArtifactPlugin)4 ArtifactClassLoaderFilter (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoaderFilter)4 Map (java.util.Map)3 Set (java.util.Set)3