}
protected void stopModule() throws Exception {
assert modules != null;
DeploymentManager manager = getDeploymentManager();
Target[] targets = manager.getTargets();
TargetModuleID[] targetIds = manager.getRunningModules(null, targets);
for (int i=0; i<modules.length; i++) {
String moduleId = getModuleId(modules[i]);
if (!isModuleStarted(moduleId)) {
log.info("Module is already stopped: " + moduleId);
continue;
//throw new MojoExecutionException("Module is not started: " + moduleId);
}
TargetModuleID[] found = findModules(moduleId, targetIds);
if (found.length == 0) {
throw new MojoExecutionException("Module not deployed: " + moduleId);
}
log.info("Stopping module: " + moduleId);
ProgressObject progress = manager.stop(found);
DeploymentStatus status = waitFor(progress);
if (status.isFailed()) {
throw new MojoExecutionException("Failed to stop module: " + moduleId);
}