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;
}
Aggregations