Package com.adito.tasks

Examples of com.adito.tasks.Task


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

        // Get the task and add some progress bars
        Task task = (Task) request.getAttribute(TaskHttpServletRequest.ATTR_TASK);
        TaskProgressBar overallProgress = new TaskProgressBar("overall", 0, 10, 0);
        task.addProgressBar(overallProgress);
        overallProgress.setNote(new BundleActionMessage("install", "taskProgress.install.overall.note"));
        TaskProgressBar atomicProgress = new TaskProgressBar("atomic", 0, 100, 0);
        task.addProgressBar(atomicProgress);

        // Do the install
        List<WizardActionStatus> actionStatus = new ArrayList<WizardActionStatus>();
        ((InstallForm) form).setActionStatus(actionStatus);
        AbstractWizardSequence seq = getWizardSequence(request);


        overallProgress.setMaxValue(6);
        task.configured();

        /*
         * Do common stuff and get where to go next. This must be a redirect so
         * the task monitor works properly
         */
 
View Full Code Here


          }
        }
      }

            // This action may be wrapped in a task progress monitor
            Task task = (Task)request.getAttribute(TaskHttpServletRequest.ATTR_TASK);
            if(task != null && request.getAttribute(TaskHttpServletRequest.ATTR_TASK_PROGRESS_HANDLED_EXTERNALLY) == null) {
                TaskProgressBar bar = new TaskProgressBar("installExtension", 0, (int)contentLength, 0); // TODO should accept longs
                task.clearProgressBars();
                task.addProgressBar(bar);
                in = new TaskInputStream(bar, in);
                ((TaskInputStream)in).getProgressBar().setNote(new BundleActionMessage("extensions", "taskProgress.downloadExtension.note", id));
                if(!task.isConfigured())
                    task.configured();
            }         

      return installExtension(id, in);
    } catch (IOException jde) {
      throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "Failed to load descriptor.");
View Full Code Here

//      throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "No downloadable applications.");
//    }


        // This action may be wrapped in a task progress monitor
        Task task = (Task)request.getAttribute(TaskHttpServletRequest.ATTR_TASK);
        if(task != null && request.getAttribute(TaskHttpServletRequest.ATTR_TASK_PROGRESS_HANDLED_EXTERNALLY) == null) {
            TaskProgressBar bar = new TaskProgressBar("updateExtension", 0, (int)contentLength, 0);
            task.addProgressBar(bar);
            in = new TaskInputStream(bar, in);
            ((TaskInputStream)in).getProgressBar().setNote(new BundleActionMessage("extensions", "taskProgress.downloadExtension.note", id));
            task.configured();
        }           

    ExtensionBundle currentBundle = getExtensionBundle(id);
    if (currentBundle == null) {
      throw new ExtensionException(ExtensionException.INVALID_EXTENSION, id);
View Full Code Here

    public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        if(response instanceof GZIPResponseWrapper) {
            ((GZIPResponseWrapper)response).setCompress(false);
        }
        Task task = TaskManager.getInstance().getTask(Integer.parseInt(request.getParameter("id")));
        if(task == null) {
            log.warn("Unknown task ID requested.");
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            return null;
        }
        if(request.getSession().isNew()) {
            log.warn("Update request must not be a new session.");
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            return null;
        }
        if(ContextHolder.getContext().isSetupMode()) {
            // No need to check session
        }
        else {
            SessionInfo sessionInfo =
                LogonControllerFactory.getInstance().getSessionInfo(request);
            if(sessionInfo != task.getSession()) {
                log.warn("Not task owner.");
                response.sendError(HttpServletResponse.SC_BAD_REQUEST);
                return null;
            }
        }
        task.waitForConfiguration();
        String xml = buildXML(request, task);
        response.setContentType("text/xml");
        byte[] arr = xml.getBytes(request.getCharacterEncoding() == null ? "utf-8" : request.getCharacterEncoding());
        response.setContentLength(arr.length);
        Util.noCache(response);
        response.getOutputStream().write(arr);
       
        // Only remove the task when client knows it has completed
        if(task.isComplete()) {
            TaskManager.getInstance().remove(task);
        }
        return null;
    }
View Full Code Here

        String name = request.getParameter("name");
        if(name == null) {
            throw new Exception("No name parameter");
        }
       
        Task t = new WrappedServletTask(bundle, name, request, response);
        ((TaskProgressForm)form).setTask(t);
        TaskManager.getInstance().startTask(t, getSessionInfo(request));
        t.waitForConfiguration();
        Util.noCache(response);
        return mapping.findForward("display");
    }
View Full Code Here

TOP

Related Classes of com.adito.tasks.Task

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.