use of org.mule.runtime.module.artifact.builder.AbstractDependencyFileBuilder in project mule by mulesoft.
the class DeployableFileBuilder method createClassLoaderModelJsonFile.
private File createClassLoaderModelJsonFile(AbstractDependencyFileBuilder dependencyFileBuilder) {
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(dependencyFileBuilder.getGroupId(), dependencyFileBuilder.getArtifactId(), dependencyFileBuilder.getVersion(), dependencyFileBuilder.getType(), dependencyFileBuilder.getClassifier());
ClassLoaderModel classLoaderModel = new ClassLoaderModel("1.0", artifactCoordinates);
List<Artifact> artifactDependencies = new LinkedList<>();
List<AbstractDependencyFileBuilder> dependencies = dependencyFileBuilder.getDependencies();
for (AbstractDependencyFileBuilder fileBuilderDependency : dependencies) {
artifactDependencies.add(getArtifact(fileBuilderDependency));
}
classLoaderModel.setDependencies(artifactDependencies);
Path repository = Paths.get(getTempFolder(), REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFileRepositoryFolderPath());
if (repository.toFile().exists()) {
repository.toFile().delete();
} else {
if (!repository.toFile().mkdirs()) {
throw new IllegalStateException("Cannot create artifact folder inside repository");
}
}
return serializeToFile(classLoaderModel, repository.toFile());
}
use of org.mule.runtime.module.artifact.builder.AbstractDependencyFileBuilder in project mule by mulesoft.
the class DeployableFileBuilder method getClassLoaderModelFile.
private File getClassLoaderModelFile() {
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(getGroupId(), getArtifactId(), getVersion());
ClassLoaderModel classLoaderModel = new ClassLoaderModel("1.0", artifactCoordinates);
List<Artifact> artifactDependencies = new LinkedList<>();
for (AbstractDependencyFileBuilder fileBuilderDependency : getDependencies()) {
artifactDependencies.add(getArtifact(fileBuilderDependency));
}
classLoaderModel.setDependencies(artifactDependencies);
File destinationFolder = Paths.get(getTempFolder()).resolve(META_INF).resolve(MULE_ARTIFACT).toFile();
if (!destinationFolder.exists()) {
assertThat(destinationFolder.mkdirs(), is(true));
}
return serializeToFile(classLoaderModel, destinationFolder);
}
use of org.mule.runtime.module.artifact.builder.AbstractDependencyFileBuilder in project mule by mulesoft.
the class DeployableFileBuilder method getCustomResources.
@Override
protected final List<ZipUtils.ZipResource> getCustomResources() {
final List<ZipUtils.ZipResource> customResources = new LinkedList<>();
if (useHeavyPackage) {
for (AbstractDependencyFileBuilder dependencyFileBuilder : getAllCompileDependencies()) {
if (MULE_DOMAIN_CLASSIFIER.equals(dependencyFileBuilder.getClassifier())) {
continue;
}
customResources.add(new ZipUtils.ZipResource(dependencyFileBuilder.getArtifactFile().getAbsolutePath(), Paths.get(REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFileRepositoryPath()).toString()));
if (MULE_PLUGIN_CLASSIFIER.equals(dependencyFileBuilder.getClassifier())) {
File pluginClassLoaderModel = createClassLoaderModelJsonFile(dependencyFileBuilder);
customResources.add(new ZipUtils.ZipResource(pluginClassLoaderModel.getAbsolutePath(), Paths.get(REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFileRepositoryFolderPath(), CLASSLOADER_MODEL_JSON_DESCRIPTOR).toString()));
} else {
customResources.add(new ZipUtils.ZipResource(dependencyFileBuilder.getArtifactPomFile().getAbsolutePath(), Paths.get(REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFilePomRepositoryPath()).toString()));
}
}
customResources.add(new ZipUtils.ZipResource(getClassLoaderModelFile().getAbsolutePath(), CLASSLOADER_MODEL_JSON_DESCRIPTOR_LOCATION));
}
customResources.addAll(doGetCustomResources());
return customResources;
}
use of org.mule.runtime.module.artifact.builder.AbstractDependencyFileBuilder in project mule by mulesoft.
the class ServiceFileBuilder method getCustomResources.
@Override
protected final List<ZipUtils.ZipResource> getCustomResources() {
final List<ZipUtils.ZipResource> customResources = new LinkedList<>();
for (AbstractDependencyFileBuilder dependencyFileBuilder : getAllCompileDependencies()) {
customResources.add(new ZipUtils.ZipResource(dependencyFileBuilder.getArtifactFile().getAbsolutePath(), Paths.get(REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFileRepositoryPath()).toString()));
customResources.add(new ZipUtils.ZipResource(dependencyFileBuilder.getArtifactPomFile().getAbsolutePath(), Paths.get(REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFilePomRepositoryPath()).toString()));
}
File serviceDescriptor = createServiceJsonDescriptorFile();
customResources.add(new ZipUtils.ZipResource(serviceDescriptor.getAbsolutePath(), MULE_ARTIFACT_JSON_DESCRIPTOR_LOCATION));
return customResources;
}
Aggregations