use of com.serotonin.m2m2.IMangoLifecycle in project ma-core-public by infiniteautomation.
the class ModulesDwr method scheduleRestart.
@DwrPermission(admin = true)
public static ProcessResult scheduleRestart() {
ProcessResult result = new ProcessResult();
synchronized (SHUTDOWN_TASK_LOCK) {
if (SHUTDOWN_TASK == null) {
long timeout = Common.getMillis(Common.TimePeriods.SECONDS, 10);
IMangoLifecycle lifecycle = Providers.get(IMangoLifecycle.class);
SHUTDOWN_TASK = lifecycle.scheduleShutdown(timeout, true, Common.getHttpUser());
// Get the redirect page
result.addData("shutdownUri", "/shutdown.htm");
} else {
result.addData("message", Common.translate("modules.restartAlreadyScheduled"));
}
}
return result;
}
use of com.serotonin.m2m2.IMangoLifecycle in project ma-core-public by infiniteautomation.
the class CommonDataInterceptor method preHandle.
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
request.setAttribute("availableLanguages", Common.getLanguages());
request.setAttribute("lang", ControllerUtils.getLocale(request).getLanguage());
// If database isn't ready we can't do this
// TODO Maybe do this differently?
IMangoLifecycle lifecycle = Providers.get(IMangoLifecycle.class);
if (lifecycle.getStartupProgress() >= 100f) {
request.setAttribute("instanceDescription", SystemSettingsDao.getValue(SystemSettingsDao.INSTANCE_DESCRIPTION));
// Only output the site analytics if we are NOT on the system settings page
if (!request.getRequestURL().toString().endsWith(ModuleRegistry.SYSTEM_SETTINGS_URL)) {
request.setAttribute("siteAnalyticsHead", SystemSettingsDao.getValue(SystemSettingsDao.SITE_ANALYTICS_HEAD));
request.setAttribute("siteAnalyticsBody", SystemSettingsDao.getValue(SystemSettingsDao.SITE_ANALYTICS_BODY));
}
}
request.setAttribute("NEW_ID", Common.NEW_ID);
request.setAttribute("lastUpgrade", Common.lastUpgrade);
return true;
}
Aggregations