Package com.adito.setup.forms

Examples of com.adito.setup.forms.ShutdownForm


        return CoreUtil.addParameterToForward(mapping.findForward("message"), "users", "*");
    }

    public ActionForward installShutdown(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                         HttpServletResponse response) throws Exception {
        ShutdownForm shutdownForm = (ShutdownForm) form;
        performShutdown(request, shutdownForm);
        return mapping.findForward("installShutdown");
    }
View Full Code Here


        return mapping.findForward("installShutdown");
    }

    public ActionForward confirmed(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ShutdownForm shutdownForm = (ShutdownForm) form;
        performShutdown(request, shutdownForm);
        // return to the home as there is a delay before the shutdown.
        return mapping.findForward("refresh");
    }
View Full Code Here

        return mapping.findForward("refresh");
    }

    public ActionForward shutdown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ShutdownForm shutdownForm = (ShutdownForm) form;
        PolicyUtil.checkPermission(PolicyConstants.SERVICE_CONTROL_RESOURCE_TYPE, shutdownForm.getShutdownOperation()
            .equals(ShutdownForm.SHUTDOWN) ? PolicyConstants.PERM_SHUTDOWN : PolicyConstants.PERM_RESTART, request);
        if (shutdownForm.getAlreadyPerforming()) {
            shutdownForm.setReferer(CoreUtil.getReferer(request));
            StoppableTimer timer = (StoppableTimer) CoreServlet.getServlet().getServletContext().getAttribute(StoppableTimer.NAME);
            timer.cancelTimerTask(ShutdownTimerTask.NAME);
            GlobalWarningManager.getInstance().removeGlobalWarning((HttpSession) null, "shutdown.global.warning.message");
            shutdownForm.setAlreadyPerforming(false);
            return mapping.findForward("refresh");
        } else {
            if (shutdownForm.isImmediate()) {
                // for an imediate shut down.
                return mapping.findForward("confirmImmediate");
            } else {
                ActionForward fwd = mapping.findForward("confirmTimed");
                return new ActionForward(CoreUtil.addParameterToPath(fwd.getPath(),
                    "arg0",
                    new SimpleDateFormat("HH:mm").format(new Date(System.currentTimeMillis()
                        + (Integer.parseInt(shutdownForm.getShutdownDelay()) * 60 * 1000)))), fwd.getRedirect());
            }
        }
    }
View Full Code Here

    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                     HttpServletResponse response) throws Exception {

        CoreUtil.clearFlow(request);

        ShutdownForm shutdownForm = (ShutdownForm) form;

        PolicyDatabase policyDatabase = PolicyDatabaseFactory.getInstance();
        if (shutdownForm.getAlreadyPerforming()) {
            shutdownForm.setShutdownType(ShutdownForm.SHUTTING_DOWN);
        } else if (policyDatabase.isPermitted(resourceType, new Permission[] { PolicyConstants.PERM_SHUTDOWN,
            PolicyConstants.PERM_RESTART }, getSessionInfo(request).getUser(), true&& ContextHolder.getContext().isRestartAvailableMode()) {
            // Both
            shutdownForm.setShutdownType(ShutdownForm.BOTH);
            shutdownForm.setShutdownOperation(ShutdownForm.RESTART);
        } else if (policyDatabase.isPermitted(resourceType,
            new Permission[] { PolicyConstants.PERM_SHUTDOWN },
            getSessionInfo(request).getUser(),
            true)) {
            // Shutdown
            shutdownForm.setShutdownType(ShutdownForm.SHUTDOWN);
            shutdownForm.setShutdownOperation(ShutdownForm.SHUTDOWN);
        } else if (policyDatabase.isPermitted(resourceType,
            new Permission[] { PolicyConstants.PERM_RESTART },
            getSessionInfo(request).getUser(),
            true) && ContextHolder.getContext().isRestartAvailableMode()) {
            // Restart
            shutdownForm.setShutdownOperation(ShutdownForm.RESTART);
            shutdownForm.setShutdownType(ShutdownForm.RESTART);
        } else {
            throw new NoPermissionException("Cannot shutdown or restart.");
        }

        /*
         * Hack to prevent getting in a loop if sending and message then
         * cancelling
         */
        String referer = CoreUtil.getReferer(request);
        if (referer != null && referer.indexOf("/sendMessage.do") == -1) {
            shutdownForm.setReferer(referer);
        }

        int users = LogonControllerFactory.getInstance().getActiveSessions().size();
        if (users > 1) {
            ActionMessages msgs = new ActionMessages();
View Full Code Here

TOP

Related Classes of com.adito.setup.forms.ShutdownForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.