Examples of WorkflowContext


Examples of com.opensymphony.workflow.WorkflowContext

    {
        boolean passesCondition = true;
       
        try
        {
            WorkflowContext context = (WorkflowContext) transientVars.get("context");
            String roleName = (String)args.get("roleName");
            String userName = (String)args.get("userName");
           
            logger.info("passesCondition.............");
            logger.info("caller:" + context.getCaller());
            logger.info("roleName:" + roleName);
            logger.info("userName:" + userName);
           
            InfoGluePrincipal principal = UserControllerProxy.getController().getUser(context.getCaller());
           
            if(userName != null && userName.length() > 0 && !principal.getName().equals(userName))
                passesCondition = false;
           
            if(roleName != null && roleName.length() > 0)
View Full Code Here

Examples of com.opensymphony.workflow.WorkflowContext

    private final static Logger logger = Logger.getLogger(CustomClassExecutor.class.getName());

    public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException
    {
      logger.info("CustomClassExecutor.execute........");
        final WorkflowContext wfContext = (WorkflowContext) transientVars.get("context");

        String className = (String) args.get("customClass.name");
        HttpServletRequest request = (HttpServletRequest) transientVars.get("request");
        logger.info("className:" + className);
       
        Iterator paramsIterator = transientVars.keySet().iterator();
      while(paramsIterator.hasNext())
      {
          String key = (String)paramsIterator.next();
          logger.info("transientVars key:" + key);
          Object value = args.get(key);
          logger.info("transientVars value:" + value);
      }
     
        Map params = new HashMap(transientVars);
        params.putAll(args);
        ActionContext.setParameters(Collections.unmodifiableMap(params));
       
        CustomWorkflowAction customWorkflowAction = getCustomWorkflowActionWithName(className);
        if(customWorkflowAction != null)
            customWorkflowAction.invokeAction(wfContext.getCaller(), request, Collections.unmodifiableMap(params), ps);       
        else
        {
            logger.warn("Could not find custom class " + className + ". Is it in the classpath?");
            throw new WorkflowException("Could not find custom class " + className + ". Is it in the classpath?");
        }
View Full Code Here

Examples of com.opensymphony.workflow.WorkflowContext

    //~ Methods ////////////////////////////////////////////////////////////////

    public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException
    {
        final WorkflowContext wfContext = (WorkflowContext) transientVars.get("context");

        String actionName = (String) args.get("action.name");
        GenericDispatcher gd = new GenericDispatcher(actionName);
        gd.prepareContext();
       
        ActionContext.setPrincipal(new Principal() {
                public String getName() {
                    return wfContext.getCaller();
                }
            });
        ActionContext.setApplication(args);
        ActionContext.setSession(ps.getProperties(""));
        ActionContext.setLocale(Locale.getDefault());
View Full Code Here

Examples of edu.indiana.extreme.xbaya.workflow.proxy.WorkflowContext

      String password, String workflowAsAString,
      Pair<String, String>[] inputs,
      Workflow workflow) throws IOException, GSSException {

    WorkflowClient wfClient = null;
    WorkflowContext context = null;
    String topic = UUID.randomUUID().toString();

    context = new GPELWorkflowContext(topic, userName, password);
    wfClient = new GPELWorkflowClient(context, workflow);
    wfClient.init();
    try {
      System.out.println(workflow.getGPELTemplateID());
      context.prepare(wfClient, workflow);
    } catch (GSSException e) {
      throw new RuntimeException(e);
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

Examples of eu.planets_project.ifr.core.wee.api.workflow.WorkflowContext

 
 
  private static WorkflowContext workflowContext = null;
  private static WorkflowContext getOrInitWFContext(){
    if(workflowContext==null){
      workflowContext = new WorkflowContext();
    }
    return workflowContext;
  }
View Full Code Here

Examples of org.apache.ambari.eventdb.model.WorkflowContext

    WorkflowDag wfDag = new WorkflowDag();
    WorkflowDagEntry wfDagEntry = new WorkflowDagEntry();
    wfDagEntry.setSource("X");
    wfDag.addEntry(wfDagEntry);
   
    WorkflowContext wc = new WorkflowContext();
    wc.setWorkflowId(historyEvent.getJobId().toString().replace("job_", "mr_"));
    wc.setWorkflowName(historyEvent.getJobName());
    wc.setWorkflowEntityName("X");
    wc.setWorkflowDag(wfDag);
    return wc;
  }
View Full Code Here

Examples of org.apache.ambari.eventdb.model.WorkflowContext

    String workflowNodeName = historyEvent.getWorkflowNodeName()
        .replace("\\", "");
    String workflowAdjacencies = StringUtils.unEscapeString(
        historyEvent.getWorkflowAdjacencies(),
        StringUtils.ESCAPE_CHAR, new char[] {'"', '=', '.'});
    WorkflowContext context = new WorkflowContext();
    context.setWorkflowId(workflowId);
    context.setWorkflowName(workflowName);
    context.setWorkflowEntityName(workflowNodeName);
    WorkflowDag dag = new WorkflowDag();
    Matcher matcher = adjPattern.matcher(workflowAdjacencies);

    while(matcher.find()){
      WorkflowDagEntry dagEntry = new WorkflowDagEntry();
      dagEntry.setSource(matcher.group(1).replace("\\", ""));
      String[] values = StringUtils.getStrings(
          matcher.group(2).replace("\\", ""));
      if (values != null) {
        for (String target : values) {
          dagEntry.addTarget(target);
        }
      }
      dag.addEntry(dagEntry);
    }
    if (dag.getEntries().isEmpty()) {
      WorkflowDagEntry wfDagEntry = new WorkflowDagEntry();
      wfDagEntry.setSource(workflowNodeName);
      dag.addEntry(wfDagEntry);
    }
    context.setWorkflowDag(dag);
    return context;
  }
View Full Code Here

Examples of org.apache.ambari.eventdb.model.WorkflowContext

    }
    return mergedDag;
  }
 
  private static WorkflowContext getSanitizedWorkflow(WorkflowContext workflowContext, WorkflowContext existingWorkflowContext) {
    WorkflowContext sanitizedWC = new WorkflowContext();
    if (existingWorkflowContext == null) {
      sanitizedWC.setWorkflowDag(workflowContext.getWorkflowDag());
      sanitizedWC.setParentWorkflowContext(workflowContext.getParentWorkflowContext());
    } else {
      sanitizedWC.setWorkflowDag(constructMergedDag(existingWorkflowContext, workflowContext));
      sanitizedWC.setParentWorkflowContext(existingWorkflowContext.getParentWorkflowContext());
    }
    return sanitizedWC;
  }
View Full Code Here

Examples of org.apache.ambari.eventdb.model.WorkflowContext

      jobPS.setString(3, historyEvent.getUserName());
      jobPS.setString(4, historyEvent.getJobConfPath());
      jobPS.setString(5, historyEvent.getJobQueueName());
      jobPS.setLong(6, historyEvent.getSubmitTime());
     
      WorkflowContext workflowContext = buildWorkflowContext(historyEvent);
     
      // Get workflow information
      boolean insertWorkflow = false;
      String existingContextString = null;
     
      ResultSet rs = null;
      try {
        workflowSelectPS.setString(1, workflowContext.getWorkflowId());
        workflowSelectPS.execute();
        rs = workflowSelectPS.getResultSet();
        if (rs.next()) {
          existingContextString = rs.getString(1);
        } else {
          insertWorkflow = true;
        }
      } catch (SQLException sqle) {
        LOG.warn("workflow select failed with: ", sqle);
        insertWorkflow = false;
      } finally {
        try {
          if (rs != null)
            rs.close();
        } catch (SQLException e) {
          LOG.error("Exception while closing ResultSet", e);
        }
      }

      // Insert workflow
      if (insertWorkflow) {
        workflowPS.setString(1, workflowContext.getWorkflowId());
        workflowPS.setString(2, workflowContext.getWorkflowName());
        workflowPS.setString(3, getWorkflowString(getSanitizedWorkflow(workflowContext, null)));
        workflowPS.setString(4, historyEvent.getUserName());
        workflowPS.setLong(5, historyEvent.getSubmitTime());
        workflowPS.setLong(6, historyEvent.getSubmitTime());
        workflowPS.setLong(7, workflowContext.getWorkflowDag().size());
        workflowPS.executeUpdate();
        LOG.debug("Successfully inserted workflowId = " +
            workflowContext.getWorkflowId());
      } else {
        ObjectMapper om = new ObjectMapper();
        WorkflowContext existingWorkflowContext = null;
        try {
          if (existingContextString != null)
            existingWorkflowContext = om.readValue(existingContextString.getBytes(), WorkflowContext.class);
        } catch (IOException e) {
          LOG.warn("Couldn't read existing workflow context for " + workflowContext.getWorkflowId(), e);
        }
       
        WorkflowContext sanitizedWC = getSanitizedWorkflow(workflowContext, existingWorkflowContext);
        workflowUpdateTimePS.setString(1, getWorkflowString(sanitizedWC));
        workflowUpdateTimePS.setLong(2, sanitizedWC.getWorkflowDag().size());
        workflowUpdateTimePS.setLong(3, historyEvent.getSubmitTime());
        workflowUpdateTimePS.setLong(4, historyEvent.getSubmitTime());
        workflowUpdateTimePS.setString(5, workflowContext.getWorkflowId());
        workflowUpdateTimePS.setString(6, workflowContext.getWorkflowId());
        workflowUpdateTimePS.executeUpdate();
View Full Code Here

Examples of org.apache.ambari.eventdb.model.WorkflowContext

    setProperties(conf, workflowId, workflowName, workflowNodeName, adjacencies);
    String log = log("JOB", new String[] {ID, NAME, NODE, ADJ},
        new String[] {conf.get(ID_PROP), conf.get(NAME_PROP), conf.get(NODE_PROP), JobHistory.JobInfo.getWorkflowAdjacencies(conf)});
    ParsedLine line = new ParsedLine(log);
    JobSubmittedEvent event = new JobSubmittedEvent(null, "", "", 0l, "", null, "", line.get(ID), line.get(NAME), line.get(NODE), line.get(ADJ));
    WorkflowContext context = MapReduceJobHistoryUpdater.buildWorkflowContext(event);
    assertEquals("Didn't recover workflowId", workflowId, context.getWorkflowId());
    assertEquals("Didn't recover workflowName", workflowName, context.getWorkflowName());
    assertEquals("Didn't recover workflowNodeName", workflowNodeName, context.getWorkflowEntityName());
    assertEquals("Got incorrect number of adjacencies", adjacencies.size(), context.getWorkflowDag().getEntries().size());
    for (WorkflowDagEntry entry : context.getWorkflowDag().getEntries()) {
      String[] sTargets = adjacencies.get(entry.getSource());
      assertNotNull("No original targets for " + entry.getSource(), sTargets);
      List<String> dTargets = entry.getTargets();
      assertEquals("Got incorrect number of targets for " + entry.getSource(), sTargets.length, dTargets.size());
      for (int i = 0; i < sTargets.length; i++) {
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.