Package org.apache.oodt.cas.workflow.engine

Examples of org.apache.oodt.cas.workflow.engine.WorkflowProcessor


    this.dateGen = 0;
  }

  public void testSort() throws InstantiationException {
    FILOPrioritySorter sorter = new FILOPrioritySorter();
    WorkflowProcessor proc = getProcessor(2.0);
    WorkflowProcessor proc2 = getProcessor(7.0);
    WorkflowProcessor proc3 = getProcessor(9.0);
    List<WorkflowProcessor> candidates = new Vector<WorkflowProcessor>();
    candidates.add(proc3);
    candidates.add(proc2);
    candidates.add(proc);   
    sorter.sort(candidates);
View Full Code Here


  }
 
 
  public void testSort() throws InstantiationException {
    HighestPrioritySorter sorter = new HighestPrioritySorter();
    WorkflowProcessor proc = getProcessor(2.0);
    WorkflowProcessor proc2 = getProcessor(7.0);
    List<WorkflowProcessor> candidates = new Vector<WorkflowProcessor>();
    candidates.add(proc);
    candidates.add(proc2);
    System.out.println("BEFORE sort: ["+candidates+"]");
    sorter.sort(candidates);
View Full Code Here

    this.dateGen = 0;
  }
 
  public void testSort() throws InstantiationException {
    HighestFIFOPrioritySorter sorter = new HighestFIFOPrioritySorter(1, 15.0, 25.0);
    WorkflowProcessor proc = getProcessor(2.0);
    WorkflowProcessor proc2 = getProcessor(7.0);
    List<WorkflowProcessor> candidates = new Vector<WorkflowProcessor>();
    candidates.add(proc);
    candidates.add(proc2);
    sorter.sort(candidates);
    assertNotNull(candidates);
View Full Code Here

      condWorkflow.getGraph().setExecutionType("condition");
      condWorkflow.getGraph().setCond(cond);
      subProcessors.add(buildProcessor(instanceId, condWorkflow,
          modelToProcessorMap, preCond));
    }
    WorkflowProcessor wp = buildProcessor(instanceId, workflow, workflow
        .getGraph().isCondition(), modelToProcessorMap);
    wp.setSubProcessors(subProcessors);
    return wp;
  }
View Full Code Here

  public WorkflowProcessor buildProcessor(String instanceId,
      ParentChildWorkflow model, boolean isCondition,
      Map<String, Class<? extends WorkflowProcessor>> modelToProcessorMap)
      throws Exception {
    WorkflowProcessor wp = modelToProcessorMap.get(
        model.getGraph().getExecutionType()).newInstance();
    WorkflowLifecycle wLifecycle = lifecycle.getLifecycleForWorkflow(model) != null ? lifecycle
        .getLifecycleForWorkflow(model) : lifecycle.getDefaultLifecycle();
    // FIXME: I'm not sure what these excused processor Ids are. I didn't seem
    // need them in the PackagedWorkflowRepository, so not sure what they do.
    // wp.setExcusedSubProcessorIds(model.getGraph().getExcusedSubProcessorIds());
    wp.getWorkflowInstance().setId(instanceId);
    wp.setConditionProcessor(isCondition);
    wp.setExecutionType(model.getGraph().getExecutionType());
    if (model.getPreConditions() != null)
      wp.setPreConditions(buildProcessor(instanceId, model,
          modelToProcessorMap, true));
    if (model.getPostConditions() != null)
      wp.setPostConditions(buildProcessor(instanceId, model,
          modelToProcessorMap, false));
    wp.setPriority(Priority.getDefault());
    wp.setMinReqSuccessfulSubProcessors(Integer.parseInt(model.getGraph()
        .getMinReqSuccessfulSubProcessors()));
    wp.setStaticMetadata(new Metadata());
    wp.setState(wLifecycle.createState("Loaded", wLifecycle
        .getStageForWorkflow("Loaded").getName(), ""));
    if (wp instanceof TaskProcessor)
      ((TaskProcessor) wp)
          .setInstanceClass((Class<? extends WorkflowTaskInstance>) Class
              .forName(model.getGraph().getTask().getTaskInstanceClassName()));
View Full Code Here

  public WorkflowProcessor findSkeleton(WorkflowProcessor skeleton,
      String modelId) {
    if (skeleton.getWorkflowInstance().getParentChildWorkflow().getGraph()
        .getModelId().equals(modelId))
      return skeleton;
    WorkflowProcessor found = findSkeleton(skeleton.getSubProcessors(), modelId);
    if (found == null) {
      if (skeleton.getPreConditions() != null)
        found = findSkeleton(skeleton.getPreConditions(), modelId);
      if (found == null && skeleton.getPostConditions() != null)
        found = findSkeleton(skeleton.getPostConditions(), modelId);
View Full Code Here

  public WorkflowProcessor findProcessor(WorkflowProcessor wp, String modelId) {
    if (wp.getWorkflowInstance().getParentChildWorkflow().getId()
        .equals(modelId))
      return wp;
    WorkflowProcessor found = findProcessor(wp.getSubProcessors(), modelId);
    if (found == null) {
      if (wp.getPreConditions() != null)
        found = findProcessor(wp.getPreConditions(), modelId);
      if (found == null && wp.getPostConditions() != null)
        found = findProcessor(wp.getPostConditions(), modelId);
View Full Code Here

  public List<WorkflowProcessor> getTasks(WorkflowProcessor skeleton) {
    List<WorkflowProcessor> options = new Vector<WorkflowProcessor>();
    options.add(skeleton);
    List<WorkflowProcessor> tasks = new Vector<WorkflowProcessor>();
    while (!options.isEmpty()) {
      WorkflowProcessor currentOption = options.remove(0);
      if (currentOption.getSubProcessors().isEmpty()) {
        tasks.add(currentOption);
      } else {
        if (currentOption.getPreConditions() != null)
          options.add(currentOption.getPreConditions());
        if (currentOption.getPostConditions() != null)
          options.add(currentOption.getPostConditions());
        for (WorkflowProcessor ps : currentOption.getSubProcessors())
          options.add(ps);
      }
    }
    return tasks;
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.workflow.engine.WorkflowProcessor

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.