| 174 | | for (Module mod : getLoadedModules()) { |
|---|
| 175 | | String key = mod.getModuleId() + ".started"; |
|---|
| 176 | | String prop = as.getGlobalProperty(key, null); |
|---|
| 177 | | |
|---|
| 178 | | // if a 'moduleid.started' property doesn't exist, start the module anyway |
|---|
| 179 | | // as this is probably the first time they are loading it |
|---|
| 180 | | if (prop == null || prop.equals("true")) { |
|---|
| 181 | | if (requiredModulesStarted(mod)) |
|---|
| 182 | | try { |
|---|
| | 171 | |
|---|
| | 172 | try { |
|---|
| | 173 | Context.addProxyPrivilege(""); |
|---|
| | 174 | AdministrationService as = Context.getAdministrationService(); |
|---|
| | 175 | // try and start the modules that should be started |
|---|
| | 176 | for (Module mod : getLoadedModules()) { |
|---|
| | 177 | String key = mod.getModuleId() + ".started"; |
|---|
| | 178 | String prop = as.getGlobalProperty(key, null); |
|---|
| | 179 | |
|---|
| | 180 | // if a 'moduleid.started' property doesn't exist, start the module anyway |
|---|
| | 181 | // as this is probably the first time they are loading it |
|---|
| | 182 | if (prop == null || prop.equals("true")) { |
|---|
| | 183 | if (requiredModulesStarted(mod)) |
|---|
| | 184 | try { |
|---|
| | 185 | if (log.isDebugEnabled()) |
|---|
| | 186 | log.debug("starting module: " + mod.getModuleId()); |
|---|
| | 187 | |
|---|
| | 188 | startModule(mod); |
|---|
| | 189 | } catch (Exception e) { |
|---|
| | 190 | log.error("Error while starting module: " |
|---|
| | 191 | + mod.getName(), e); |
|---|
| | 192 | mod.setStartupErrorMessage("Error while starting module: " + e.getMessage()); |
|---|
| | 193 | } |
|---|
| | 194 | else { |
|---|
| | 195 | // if not all the modules required by this mod are loaded, save it for later |
|---|
| | 196 | leftoverModules.add(mod); |
|---|
| 438 | | // this method must check and run queries against the database. |
|---|
| 439 | | // to do this, it must be "authenticated". Give the current |
|---|
| 440 | | // "user" the proxy privilege so this can be done. ("user" might |
|---|
| 441 | | // be nobody because this is being run at startup) |
|---|
| 442 | | Context.addProxyPrivilege(""); |
|---|
| | 443 | try { |
|---|
| | 444 | // this method must check and run queries against the database. |
|---|
| | 445 | // to do this, it must be "authenticated". Give the current |
|---|
| | 446 | // "user" the proxy privilege so this can be done. ("user" might |
|---|
| | 447 | // be nobody because this is being run at startup) |
|---|
| | 448 | Context.addProxyPrivilege(""); |
|---|
| 459 | | // save the state of this module for future restarts |
|---|
| 460 | | Context.addProxyPrivilege(""); |
|---|
| 461 | | AdministrationService as = Context.getAdministrationService(); |
|---|
| 462 | | GlobalProperty gp = new GlobalProperty(module.getModuleId() |
|---|
| 463 | | + ".started", "true", |
|---|
| 464 | | getGlobalPropertyStartedDescription(module |
|---|
| 465 | | .getModuleId())); |
|---|
| 466 | | as.setGlobalProperty(gp); |
|---|
| 467 | | Context.removeProxyPrivilege(""); |
|---|
| | 464 | try { |
|---|
| | 465 | // save the state of this module for future restarts |
|---|
| | 466 | Context.addProxyPrivilege(""); |
|---|
| | 467 | AdministrationService as = Context.getAdministrationService(); |
|---|
| | 468 | GlobalProperty gp = new GlobalProperty(module.getModuleId() |
|---|
| | 469 | + ".started", "true", |
|---|
| | 470 | getGlobalPropertyStartedDescription(module |
|---|
| | 471 | .getModuleId())); |
|---|
| | 472 | as.setGlobalProperty(gp); |
|---|
| | 473 | } |
|---|
| | 474 | finally { |
|---|
| | 475 | Context.removeProxyPrivilege(""); |
|---|
| | 476 | } |
|---|
| 652 | | Context.addProxyPrivilege(""); |
|---|
| 653 | | AdministrationService as = Context.getAdministrationService(); |
|---|
| 654 | | GlobalProperty gp = new GlobalProperty(moduleId + ".started", |
|---|
| 655 | | "false", getGlobalPropertyStartedDescription(moduleId)); |
|---|
| 656 | | as.saveGlobalProperty(gp); |
|---|
| 657 | | Context.removeProxyPrivilege(""); |
|---|
| | 661 | try { |
|---|
| | 662 | Context.addProxyPrivilege(""); |
|---|
| | 663 | AdministrationService as = Context.getAdministrationService(); |
|---|
| | 664 | GlobalProperty gp = new GlobalProperty(moduleId + ".started", |
|---|
| | 665 | "false", getGlobalPropertyStartedDescription(moduleId)); |
|---|
| | 666 | as.saveGlobalProperty(gp); |
|---|
| | 667 | } |
|---|
| | 668 | finally { |
|---|
| | 669 | Context.removeProxyPrivilege(""); |
|---|
| | 670 | } |
|---|