}
public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
// Resolve the contribution model itself
ModelResolver contributionResolver = contribution.getModelResolver();
contribution.setUnresolved(false);
contributionResolver.addModel(contribution);
// Resolve imports and exports
for (Export export: contribution.getExports()) {
if (export instanceof DefaultExport) {
// Initialize the default export's resolver
export.setModelResolver(contributionResolver);
} else {
extensionProcessor.resolve(export, contributionResolver);
}
}
for (Import import_: contribution.getImports()) {
extensionProcessor.resolve(import_, contributionResolver);
}
// Resolve all artifact models
for (Artifact artifact : contribution.getArtifacts()) {
Object model = artifact.getModel();
if (model != null) {
try {
artifactProcessor.resolve(model, contributionResolver);
} catch (Exception e) {
//FIXME this shouldn't happen
}
}
}
// Resolve deployable composites
List<Composite> deployables = contribution.getDeployables();
for (int i = 0, n = deployables.size(); i < n; i++) {
Composite deployable = deployables.get(i);
Composite resolved = (Composite)contributionResolver.resolveModel(Composite.class, deployable);
if (resolved != deployable) {
deployables.set(i, resolved);
}
}
}