try {
for (int i = 0; i < modules.length; i++) {
TargetModuleID module = modules[i];
// Check to see whether the module is already started
Artifact moduleID = Artifact.create(module.getModuleID());
if (configurationManager.isRunning(moduleID)) {
updateStatus("Module " + moduleID + " is already running");
Thread.sleep(100);
continue;
}
// Load
if(!configurationManager.isLoaded(moduleID)) {
configurationManager.loadConfiguration(moduleID);
}
// Start
org.apache.geronimo.kernel.config.LifecycleResults lcresult = configurationManager.startConfiguration(moduleID);
// Determine the child modules of the configuration
//TODO might be a hack
List kids = loadChildren(kernel, moduleID.toString());
// Build a response obect containg the started configuration and a list of it's contained modules
TargetModuleIDImpl id = new TargetModuleIDImpl(modules[i].getTarget(), module.getModuleID(),
(String[]) kids.toArray(new String[kids.size()]));
if (isWebApp(kernel, moduleID.toString())) {
id.setType(ModuleType.WAR);
}
if (id.getChildTargetModuleID() != null) {
for (int k = 0; k < id.getChildTargetModuleID().length; k++) {
TargetModuleIDImpl child = (TargetModuleIDImpl) id.getChildTargetModuleID()[k];
if (isWebApp(kernel, child.getModuleID())) {
child.setType(ModuleType.WAR);
}
}
}
addModule(id);
java.util.Iterator iterator = lcresult.getStarted().iterator();
while (iterator.hasNext()) {
Artifact config = (Artifact)iterator.next();
if (!config.toString().equals(id.getModuleID())) {
//TODO might be a hack
List kidsChild = loadChildren(kernel, config.toString());
// Build a response obect containg the started configuration and a list of it's contained modules
TargetModuleIDImpl idChild = new TargetModuleIDImpl(null, config.toString(),
(String[]) kidsChild.toArray(new String[kidsChild.size()]));
if (isWebApp(kernel, config.toString())) {
idChild.setType(ModuleType.WAR);
}
if (idChild.getChildTargetModuleID() != null) {
for (int k = 0; k < idChild.getChildTargetModuleID().length; k++) {
TargetModuleIDImpl child = (TargetModuleIDImpl) idChild.getChildTargetModuleID()[k];