Search in sources :

Example 21 with ClassLoaderModel

use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel in project mule by mulesoft.

the class LibFolderClassLoaderModelLoader method load.

@Override
public ClassLoaderModel load(File artifactFile, Map<String, Object> attributes, ArtifactType artifactType) throws InvalidDescriptorLoaderException {
    if (artifactFile == null || !artifactFile.exists()) {
        throw new IllegalArgumentException("Service folder does not exists: " + (artifactFile != null ? artifactFile.getName() : null));
    }
    ClassLoaderModel.ClassLoaderModelBuilder classLoaderModelBuilder = new ClassLoaderModel.ClassLoaderModelBuilder();
    classLoaderModelBuilder.containing(getUrl(artifactFile));
    for (URL url : getServiceUrls(artifactFile)) {
        classLoaderModelBuilder.containing(url);
    }
    return classLoaderModelBuilder.build();
}
Also used : ClassLoaderModel(org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel) URL(java.net.URL)

Aggregations

ClassLoaderModel (org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel)21 Test (org.junit.Test)15 File (java.io.File)7 BundleDependency (org.mule.runtime.module.artifact.api.descriptor.BundleDependency)5 URL (java.net.URL)3 Paths (java.nio.file.Paths)3 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 LocalRepositorySupplierFactory (org.mule.maven.client.api.LocalRepositorySupplierFactory)3 MavenClient (org.mule.maven.client.api.MavenClient)3 Files.createTempDir (com.google.common.io.Files.createTempDir)2 Boolean.getBoolean (java.lang.Boolean.getBoolean)2 Boolean.valueOf (java.lang.Boolean.valueOf)2 String.format (java.lang.String.format)2 MalformedURLException (java.net.MalformedURLException)2 Optional (java.util.Optional)2 Optional.of (java.util.Optional.of)2