Search in sources :

Example 6 with ArtifactPlugin

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

the class DefaultPolicyTemplateFactory method createArtifact.

@Override
public PolicyTemplate createArtifact(Application application, PolicyTemplateDescriptor descriptor) {
    MuleDeployableArtifactClassLoader policyClassLoader;
    List<ArtifactPluginDescriptor> resolvedPolicyPluginsDescriptors = resolvePolicyPluginDescriptors(application, descriptor);
    try {
        policyClassLoader = policyTemplateClassLoaderBuilderFactory.createArtifactClassLoaderBuilder().addArtifactPluginDescriptors(resolvedPolicyPluginsDescriptors.toArray(new ArtifactPluginDescriptor[resolvedPolicyPluginsDescriptors.size()])).setParentClassLoader(application.getRegionClassLoader()).setArtifactDescriptor(descriptor).build();
    } catch (IOException e) {
        throw new PolicyTemplateCreationException(createPolicyTemplateCreationErrorMessage(descriptor.getName()), e);
    }
    application.getRegionClassLoader().addClassLoader(policyClassLoader, NULL_CLASSLOADER_FILTER);
    List<ArtifactPlugin> artifactPlugins = createArtifactPluginList(policyClassLoader, resolvedPolicyPluginsDescriptors);
    validateArtifactLicense(policyClassLoader.getClassLoader(), artifactPlugins, licenseValidator);
    DefaultPolicyTemplate policy = new DefaultPolicyTemplate(policyClassLoader.getArtifactId(), descriptor, policyClassLoader, artifactPlugins);
    return policy;
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) MuleDeployableArtifactClassLoader(org.mule.runtime.module.artifact.api.classloader.MuleDeployableArtifactClassLoader) IOException(java.io.IOException) ArtifactPlugin(org.mule.runtime.deployment.model.api.plugin.ArtifactPlugin) DefaultArtifactPlugin(org.mule.runtime.module.deployment.impl.internal.plugin.DefaultArtifactPlugin)

Aggregations

ArtifactPlugin (org.mule.runtime.deployment.model.api.plugin.ArtifactPlugin)6 ArtifactPluginDescriptor (org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor)4 Domain (org.mule.runtime.deployment.model.api.domain.Domain)3 MuleDeployableArtifactClassLoader (org.mule.runtime.module.artifact.api.classloader.MuleDeployableArtifactClassLoader)3 DefaultArtifactPlugin (org.mule.runtime.module.deployment.impl.internal.plugin.DefaultArtifactPlugin)3 IOException (java.io.IOException)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 ApplicationClassLoaderBuilder (org.mule.runtime.deployment.model.internal.application.ApplicationClassLoaderBuilder)2 ArtifactClassLoader (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoader)2 File (java.io.File)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 Set (java.util.Set)1 Test (org.junit.Test)1 BootstrapService (org.mule.runtime.core.api.config.bootstrap.BootstrapService)1 PropertiesBootstrapService (org.mule.runtime.core.api.config.bootstrap.PropertiesBootstrapService)1 PropertiesBootstrapServiceDiscoverer (org.mule.runtime.core.api.config.bootstrap.PropertiesBootstrapServiceDiscoverer)1