Package org.apache.oodt.cas.workflow.structs

Examples of org.apache.oodt.cas.workflow.structs.WorkflowInstancePage


    }
    clean.cleanRepository();
  }

  public void cleanRepository() throws Exception {
    WorkflowInstancePage page = wm != null ? wm.getFirstPage() : rep
        .getFirstPage();
    while (page != null && page.getPageWorkflows() != null
        && page.getPageWorkflows().size() > 0) {

      LOG.log(Level.INFO,
          "Cleaning workflow instances: page: [" + page.getPageNum() + "] of ["
              + page.getTotalPages() + "]: page size: [" + page.getPageSize()
              + "]");
      for (WorkflowInstance inst : (List<WorkflowInstance>) page
          .getPageWorkflows()) {
        if (inst.getStatus().equals(WorkflowStatus.CREATED)
            || inst.getStatus().equals(WorkflowStatus.STARTED)
            || inst.getStatus().equals(WorkflowStatus.QUEUED)
            || inst.getStatus().equals(WorkflowStatus.RESMGR_SUBMIT)
            || inst.getStatus().equals(CONF_FILE_BUILD)
            || inst.getStatus().equals(CRAWLING)
            || inst.getStatus().equals(RUNNING_PGE)
            || inst.getStatus().equals(STAGING_INPUT)) {
          String endDateTimeIsoStr = DateUtils.toString(Calendar.getInstance());
          LOG.log(Level.INFO, "Updated workflow instance id: [" + inst.getId()
              + "]: setting end date time to: [" + endDateTimeIsoStr + "]");
          LOG.log(Level.INFO, "Existing status: [" + inst.getStatus()
              + "]: setting to [" + WorkflowStatus.FINISHED + "]");
          inst.setEndDateTimeIsoStr(endDateTimeIsoStr);
          if (inst.getStartDateTimeIsoStr() == null
              || (inst.getStartDateTimeIsoStr() != null && inst
                  .getStartDateTimeIsoStr().equals(""))) {
            inst.setStartDateTimeIsoStr(endDateTimeIsoStr);
          }
          inst.setStatus(WorkflowStatus.FINISHED);
          if (wm != null) {
            wm.updateWorkflowInstance(inst);
          } else {
            rep.updateWorkflowInstance(inst);
          }
        }
      }

      if (page.isLastPage()) {
        LOG.log(Level.INFO, "Last set of workflow instances cleaned.");
        break;
      }

      page = wm != null ? wm.getNextPage(page) : rep.getNextPage(page);
View Full Code Here


         throws CmdLineActionException {
      Validate.isTrue(pageNum != -1);

      try {
         XmlRpcWorkflowManagerClient client = getClient();
         WorkflowInstancePage page = null;
         if (status != null && !status.equals("")) {
            page = client.paginateWorkflowInstances(pageNum + 1, status);
         } else {
            page = client.paginateWorkflowInstances(pageNum + 1);
         }

         printer.println("Page: [num=" + page.getPageNum() + ","
               + "pageSize=" + page.getPageSize() + ",totalPages="
               + page.getTotalPages() + "]");
         if (page.getPageWorkflows() == null) {
            throw new Exception(
                  "WorkflowManager returned null page of workflows");
         }
         for (WorkflowInstance inst : (List<WorkflowInstance>) page
               .getPageWorkflows()) {
            printer.println("Instance: [id=" + inst.getId() + ", status="
                  + inst.getStatus() + ", currentTask="
                  + inst.getCurrentTaskId() + ", workflow="
                  + inst.getWorkflow().getName() + ",wallClockTime="
View Full Code Here

   @Override
   public void execute(ActionMessagePrinter printer)
         throws CmdLineActionException {
      try {
         XmlRpcWorkflowManagerClient client = getClient();
         WorkflowInstancePage page = null;
         if (status != null && !status.equals("")) {
            page = client.paginateWorkflowInstances(1, status);
         } else {
            page = client.getFirstPage();
         }

         printer.println("Page: [num=" + page.getPageNum() + ","
               + "pageSize=" + page.getPageSize() + ",totalPages="
               + page.getTotalPages() + "]");
         if (page.getPageWorkflows() == null) {
            throw new Exception(
                  "WorkflowManager returned null page of workflows");
         }
         for (WorkflowInstance inst : (List<WorkflowInstance>) page
               .getPageWorkflows()) {
            printer.println("Instance: [id=" + inst.getId() + ", status="
                  + inst.getStatus() + ", currentTask="
                  + inst.getCurrentTaskId() + ", workflow="
                  + inst.getWorkflow().getName() + ", wallClockTime="
View Full Code Here

   * Should return the list of available, Queued, {@link WorkflowProcessor}s.
   *
   * @return the list of available, Queued, {@link WorkflowProcessor}s.
   */
  public synchronized List<WorkflowProcessor> getProcessors() {
    WorkflowInstancePage page = null;
    try {
      page = repo.getPagedWorkflows(1);
    } catch (Exception e) {
      e.printStackTrace();
      LOG.log(Level.WARNING, "Unable to load workflow processors: Message: "
          + e.getMessage());
      return null;
    }

    List<WorkflowProcessor> processors = new Vector<WorkflowProcessor>(
        page.getPageWorkflows() != null ? page.getPageWorkflows().size() : 0);
    for (WorkflowInstance inst : (List<WorkflowInstance>) (List<?>) page
        .getPageWorkflows()) {
      if (!inst.getState().getCategory().getName().equals("done")) {
        WorkflowProcessor processor = null;
        try {
          processor = fromWorkflowInstance(inst);
View Full Code Here

        }

    }

    public Hashtable getFirstPage() {
      WorkflowInstancePage page = engine.getInstanceRepository()
                .getFirstPage();
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                            .blankPage());
    }

    public Hashtable getNextPage(Hashtable currentPage) {
        // first unpack current page
        WorkflowInstancePage currPage = XmlRpcStructFactory
                .getWorkflowInstancePageFromXmlRpc(currentPage);
        WorkflowInstancePage page = engine.getInstanceRepository().getNextPage(
                currPage);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                            .blankPage());
    }

    public Hashtable getPrevPage(Hashtable currentPage) {
        // first unpack current page
        WorkflowInstancePage currPage = XmlRpcStructFactory
                .getWorkflowInstancePageFromXmlRpc(currentPage);
        WorkflowInstancePage page = engine.getInstanceRepository().getPrevPage(
                currPage);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
    }

    public Hashtable getLastPage() {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getLastPage();
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                            .blankPage());
    }

    public Hashtable paginateWorkflowInstances(int pageNum, String status)
            throws InstanceRepositoryException {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getPagedWorkflows(pageNum, status);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

    }

    public Hashtable paginateWorkflowInstances(int pageNum)
            throws InstanceRepositoryException {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getPagedWorkflows(pageNum);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.workflow.structs.WorkflowInstancePage

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.