Examples of ITaskService


Examples of org.eclipse.orion.server.core.tasks.ITaskService

      handleException(resp, "Invalid request paramethers, try {" + TaskStatus.ABORT.toString() + ":true}", e1, HttpServletResponse.SC_BAD_REQUEST);
    }

    boolean isKeep = "id".equals(path.segment(0));
    String taskId = path.segment(1);
    ITaskService taskService = taskTracker.getService();
    try {
      taskService.cancelTask(TaskJobHandler.getUserId(req), taskId, isKeep);
    } catch (TaskDoesNotExistException e) {
      handleException(resp, "Could not cancel task that does not exist: " + e.getTaskId(), e, HttpServletResponse.SC_NOT_FOUND);
      return;
    } catch (TaskOperationException e) {
      handleException(resp, e.getMessage(), e);
View Full Code Here

Examples of org.eclipse.orion.server.core.tasks.ITaskService

  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    traceRequest(req);
    String pathInfo = req.getPathInfo();
    IPath path = pathInfo == null ? Path.EMPTY : new Path(pathInfo);
    ITaskService taskService = taskTracker.getService();
    if (path.segmentCount() == 0) {
      taskService.removeCompletedTasks(TaskJobHandler.getUserId(req));
      List<TaskInfo> tasks = taskService.getTasks(TaskJobHandler.getUserId(req));
      List<String> locations = new ArrayList<String>();
      try {
        for (TaskInfo task : tasks) {
          locations.add(getJsonWithLocation(req, task).optString(ProtocolConstants.KEY_LOCATION));
        }
      } catch (Exception e) {
        handleException(resp, e.getMessage(), e);
      }
      writeJSONResponse(req, resp, new JSONArray(locations));
      return;
    }

    if (path.segmentCount() != 2 || (!"id".equals(path.segment(0)) && !"temp".equals(path.segment(0)))) {//$NON-NLS-1$
      handleException(resp, "Invalid request path: " + EncodingUtils.encodeForHTML(path.toString()), null, HttpServletResponse.SC_BAD_REQUEST);
      return;
    }

    boolean isKeep = "id".equals(path.segment(0));

    String taskId = path.segment(1);
    try {
      taskService.removeTask(TaskJobHandler.getUserId(req), taskId, isKeep);
    } catch (TaskDoesNotExistException e) {
      handleException(resp, "Could not remove task that does not exist: " + e.getTaskId(), e, HttpServletResponse.SC_NOT_FOUND);
      return;
    } catch (TaskOperationException e) {
      handleException(resp, e.getMessage(), e);
View Full Code Here

Examples of org.eclipse.orion.server.core.tasks.ITaskService

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    traceRequest(req);
    String pathInfo = req.getPathInfo();
    IPath path = pathInfo == null ? Path.EMPTY : new Path(pathInfo);
    ITaskService taskService = taskTracker.getService();

    if (path.segmentCount() == 0) {

      List<TaskInfo> tasks = taskService.getTasks(TaskJobHandler.getUserId(req));
      try {
        writeJSONResponse(req, resp, getTasksList(tasks, req, resp));
      } catch (JSONException e) {
        handleException(resp, e.getMessage(), e);
        return;
      } catch (URISyntaxException e) {
        handleException(resp, e.getMessage(), e);
        return;
      }

      return;
    }

    if (path.segmentCount() != 2 || (!"id".equals(path.segment(0)) && !"temp".equals(path.segment(0)))) {//$NON-NLS-1$
      handleException(resp, "Invalid request path: " + EncodingUtils.encodeForHTML(path.toString()), null, HttpServletResponse.SC_BAD_REQUEST);
      return;
    }
    if (taskService == null) {
      handleException(resp, "Task service is unavailable", null);
      return;
    }
    String taskId = path.segment(1);
    boolean keep = "id".equals(path.segment(0));
    TaskInfo task = taskService.getTask(TaskJobHandler.getUserId(req), taskId, keep);

    if (task == null) {
      JSONObject errorDescription = new JSONObject();
      try {
        errorDescription.put("taskNotFound", taskId);
View Full Code Here

Examples of org.eclipse.orion.server.core.tasks.ITaskService

    }
  }

  @Test
  public void testUniqueTaskInfo() throws InterruptedException { //see Bug 370729
    final ITaskService taskService = new TaskService(new Path(tempDir.getAbsolutePath()));
    int numberOfChecks = 100;
    Job[] jobs = new Job[numberOfChecks];
    final TaskInfo[] taskInfos = new TaskInfo[numberOfChecks];
    for (int i = 0; i < numberOfChecks; i++) {
      jobs[i] = new TaskStoreTestJob(taskService, taskInfos, i);
View Full Code Here

Examples of org.wicketstuff.progressbar.spring.ITaskService

      }
    };
    form.add(bar = new ProgressBar("bar", progressionModel) {
      @Override
      protected void onFinished(AjaxRequestTarget target) {
        ITaskService taskService = getExampleApplication()
            .getTaskService();
        // finish the task!
        taskService.finish(progressionModel.getTaskId());
        // Hide progress bar after finish
        setVisible(false);
        // Add some JavaScript after finish
        target.appendJavaScript("alert('Task done and finished!')");

        // re-enable button
        Component button = form.get("submit");
        button.setEnabled(true);
        target.addComponent(button);
      }
    });
    // Hide progress bar initially
    bar.setVisible(false);

    form.add(new IndicatingAjaxButton("submit", form) {
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form form) {
        ITaskService taskService = getExampleApplication()
            .getTaskService();
        // Schedule and start a new task
        Long taskId = taskService.scheduleAndStart(new DummyTask(60));
        // Set taskId for model
        progressionModel.setTaskId(taskId);
        // Start the progress bar, will set visibility to true
        bar.start(target);
View Full Code Here

Examples of org.wicketstuff.progressbar.spring.ITaskService

      private static final long serialVersionUID = 1L;

      @Override
      protected void onFinished(AjaxRequestTarget target)
      {
        ITaskService taskService = getExampleApplication().getTaskService();
        // finish the task!
        taskService.finish(progressionModel.getTaskId());
        // Hide progress bar after finish
        setVisible(false);
        // Add some JavaScript after finish
        target.appendJavaScript("alert('Task done and finished!')");

        // re-enable button
        Component button = form.get("submit");
        button.setEnabled(true);
        target.add(button);
      }
    });
    // Hide progress bar initially
    bar.setVisible(false);

    form.add(new IndicatingAjaxButton("submit", form)
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        ITaskService taskService = getExampleApplication().getTaskService();
        // Schedule and start a new task
        Long taskId = taskService.scheduleAndStart(new DummyTask(60));
        // Set taskId for model
        progressionModel.setTaskId(taskId);
        // Start the progress bar, will set visibility to true
        bar.start(target);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.