boolean contributionMetadata = false;
for (String artifactURI: scanner.getArtifacts(contributionURL)) {
URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);
// Add the deployed artifact model to the contribution
Artifact artifact = this.contributionFactory.createArtifact();
artifact.setURI(artifactURI);
artifact.setLocation(artifactURL.toString());
artifacts.add(artifact);
modelResolver.addModel(artifact);
// Read each artifact
Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
if (model != null) {
artifact.setModel(model);
// Add the loaded model to the model resolver
modelResolver.addModel(model);
// Merge contribution metadata into the contribution model
if (model instanceof Contribution) {
contributionMetadata = true;
Contribution c = (Contribution)model;
contribution.getImports().addAll(c.getImports());
contribution.getExports().addAll(c.getExports());
contribution.getDeployables().addAll(c.getDeployables());
}
}
}
// If no sca-contribution.xml file was provided then just consider
// all composites in the contribution as deployables
if (!contributionMetadata) {
for (Artifact artifact: artifacts) {
if (artifact.getModel() instanceof Composite) {
contribution.getDeployables().add((Composite)artifact.getModel());
}
}
}
return contribution;