}
ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
try {
for (int i = 0; i < modules.length; i++) {
TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i];
Artifact artifact = Artifact.create(module.getModuleID());
if(configID != null && configID.isResolved()) {
if(configID.getGroupId().equals(artifact.getGroupId()) &&
configID.getArtifactId().equals(artifact.getArtifactId()) &&
configID.getVersion().equals(artifact.getVersion())) {
redeploySameConfiguration(configurationManager, artifact, module.getTarget());
} else {
redeployUpdatedConfiguration(configurationManager, artifact, module.getTarget());
}
} else {
redeployUpdatedConfiguration(configurationManager, artifact, module.getTarget());
}
}
} finally {
ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
}