use of org.mifos.application.admin.system.ShutdownManager in project head by mifos.
the class ShutdownServiceFacadeWebTier method scheduleShutdown.
@Override
public void scheduleShutdown(HttpServletRequest request, long timeout) {
ShutdownManager shutdownManager = (ShutdownManager) ServletUtils.getGlobal(request, ShutdownManager.class.getName());
shutdownManager.scheduleShutdown(timeout);
}
use of org.mifos.application.admin.system.ShutdownManager in project head by mifos.
the class MifosMockStrutsTestCase method beforeStrutsTest.
@Before
public void beforeStrutsTest() throws Exception {
mockStruts.setUp();
if (!strutsConfigSet) {
setStrutsConfig();
strutsConfigSet = true;
}
getActionServlet().getServletContext().setAttribute(ShutdownManager.class.getName(), new ShutdownManager());
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUserBuilder().build();
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
}
use of org.mifos.application.admin.system.ShutdownManager in project head by mifos.
the class RolesPermissionsAction method getLoggedUsers.
private List<String> getLoggedUsers(HttpServletRequest request) {
List<String> loggedUsers = new ArrayList<String>();
ShutdownManager shutdownManager = (ShutdownManager) ServletUtils.getGlobal(request, ShutdownManager.class.getName());
Collection<HttpSession> sessions = shutdownManager.getActiveSessions();
PersonnelBusinessService personnelBusinessService = new PersonnelBusinessService();
for (HttpSession session : sessions) {
UserContext userContextFromSession = (UserContext) session.getAttribute(LoginConstants.USERCONTEXT);
if (userContextFromSession == null) {
continue;
}
PersonnelBO personnel;
try {
personnel = personnelBusinessService.getPersonnel(userContextFromSession.getId());
} catch (ServiceException e) {
continue;
}
loggedUsers.add(personnel.getUserName());
}
return loggedUsers;
}
use of org.mifos.application.admin.system.ShutdownManager in project head by mifos.
the class BaseAction method execute.
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
configureDaoBeans();
configureServiceFacadeBeans();
configureLegacyDaoBeans();
checkLocaleContext(request);
if (MifosBatchJob.isBatchJobRunningThatRequiresExclusiveAccess()) {
return logout(mapping, request);
}
ShutdownManager shutdownManager = (ShutdownManager) ServletUtils.getGlobal(request, ShutdownManager.class.getName());
if (shutdownManager.isShutdownDone()) {
return shutdown(mapping, request);
}
if (shutdownManager.isInShutdownCountdownNotificationThreshold()) {
request.setAttribute("shutdownIsImminent", true);
}
if (null != request.getSession().getAttribute("currentPageUrl")) {
SessionUtils.setAttribute("backPageUrl", UrlHelper.constructCurrentPageUrl(request), request);
}
boolean flag = AccountingRules.getSimpleAccountingStatus();
request.getSession().setAttribute("accountingActivationStatus", flag);
TransactionDemarcate annotation = getTransaction(form, request);
preExecute(form, request, annotation);
ActionForward forward = super.execute(mapping, form, request, response);
try {
request.getSession().setAttribute("previousPageUrl", UrlHelper.constructCurrentPageUrl(request));
} catch (Exception e) {
request.setAttribute("previousPageUrl", "");
}
// TODO: passing 'true' to postExecute guarantees that the session will
// be closed still working through resolving issues related to enforcing
// this postExecute(request, annotation, true);
postExecute(request, annotation, isCloseSessionAnnotationPresent(form, request));
return forward;
}
use of org.mifos.application.admin.system.ShutdownManager in project head by mifos.
the class ApplicationInitializer method setAttributesOnContext.
public void setAttributesOnContext(ServletContext servletContext) throws TaskSystemException {
// FIXME: replace with Spring-managed beans
final MifosScheduler mifosScheduler = new MifosScheduler();
final ShutdownManager shutdownManager = new ShutdownManager();
Configuration.getInstance();
configureAuditLogValues(Localization.getInstance().getConfiguredLocale());
LocaleSetting configLocale = new LocaleSetting();
@SuppressWarnings("deprecation") final UserLocale userLocale = new UserLocale(ApplicationContextProvider.getBean(PersonnelServiceFacade.class));
if (servletContext != null) {
mifosScheduler.initialize();
servletContext.setAttribute(MifosScheduler.class.getName(), mifosScheduler);
servletContext.setAttribute(ShutdownManager.class.getName(), shutdownManager);
servletContext.setAttribute(LocaleSetting.class.getSimpleName(), configLocale);
servletContext.setAttribute(UserLocale.class.getSimpleName(), userLocale);
}
}
Aggregations