// Download and install the dependencies
try {
if (!configID.isResolved()) {
// See if something's running
for (int i = matches.length - 1; i >= 0; i--) {
Artifact match = matches[i];
if (configStore.containsConfiguration(match) && configManager.isRunning(match)) {
log.debug("Found required configuration=" + match + " and it is running.");
return; // its dependencies must be OK
} else {
log.debug("Either required configuration=" + match + " is not installed or it is not running.");
}
}
// Go with something that's installed
configID = matches[matches.length - 1];
}
ConfigurationData data = null;
if (configStore.containsConfiguration(configID)) {
if (configManager.isRunning(configID)) {
return; // its dependencies must be OK
}
log.debug("Loading configuration=" + configID);
data = configStore.loadConfiguration(configID);
}
// Download the dependencies
parentStack.push(configID);
if (instance == null) {
//no plugin metadata, guess with something else
Dependency[] dependencies = data == null ? getDependencies(writeableRepo, configID) : getDependencies(data);
for (Dependency dep : dependencies) {
Artifact artifact = dep.getArtifact();
log.debug("Attempting to download dependency=" + artifact + " for configuration=" + configID);
downloadArtifact(artifact, metadata, repos, username, password, monitor, soFar, parentStack, true, servers, loadOverride);
}
} else {
//rely on plugin metadata if present.
List<DependencyType> deps = instance.getDependency();
for (DependencyType dep : deps) {
Artifact artifact = toArtifact(dep);
log.debug("Attempting to download dependency=" + artifact + " for configuration=" + configID);
downloadArtifact(artifact, metadata, repos, username, password, monitor, soFar, parentStack, true, servers, loadOverride & dep.isStart());
}
}
parentStack.pop();