/**
  * Action의 기준 경로를 반환한다.
  *
  * @param actionContext Action Context
  * @return Action의 기준 경로
  */
 public static String getActionBasePath(ActionContext actionContext) {
   String workingPath =
       ConfigurationManagerHelper.getConfigurationManagerHelper()
           .getConfigurationManager()
           .get("working.path");
   String jobId =
       actionContext.getWorkflowContext().getGlobalVariables().getProperty("JOB_STRING_ID");
   Date current =
       (Date)
           actionContext
               .getWorkflowContext()
               .getSchedulerContext()
               .getJobExecutionContext()
               .getMergedJobDataMap()
               .get(JobVariable.CURRENT);
   String workflowId = actionContext.getWorkflowContext().getWorkflowId();
   return workingPath
       + "/"
       + DateUtils.parseDate(current, "yyyy")
       + "/"
       + DateUtils.parseDate(current, "MM")
       + "/"
       + DateUtils.parseDate(current, "dd")
       + "/"
       + workflowId
       + "/"
       + jobId
       + "/"
       + JVMIDUtils.generateUUID();
 }
Example #2
0
  @Override
  public void execute(WorkflowContext context) {
    this.actionContext = context.getCurrentActionContext();

    ELService service = this.actionContext.getWorkflowContext().getBean(ELService.class);
    this.evaluator = service.createEvaluator();
    this.globalVariables = actionContext.getWorkflowContext().getGlobalVariables();

    this.actionBasePath = ActionBasePathGenerator.getActionBasePath(actionContext);
    FileSystemUtils.testCorrentAndCreateDir(actionBasePath);

    this.logPath = actionBasePath + "/action.log";

    long actionLogMaxSize =
        ConfigurationManagerHelper.getConfigurationManagerHelper()
            .getConfigurationManager()
            .getLong("action.log.max.size");
    this.fileWriter = new FileWriter(logger, logPath, actionLogMaxSize);

    try {
      actionContext.changeState(State.PREPARE);
      before();

      actionContext.changeState(State.RUNNING);
      executeInternal();

      after();
      actionContext.changeState(State.SUCCESS);
    } catch (Exception ex) {
      actionContext.setObject(JobVariable.ACTION_EXCEPTION, ex);
      fail();
      String message =
          MessageFormatter.format(
                  "Cannot execute '{}' of action",
                  new String[] {context.getCurrentActionDescription()})
              .getMessage();
      throw new WorkflowException(message, ex);
    } finally {
      if (fileWriter != null) {
        try {
          fileWriter.close();
        } catch (Exception ex) {
        }
      }
    }
  }
Example #3
0
 /**
  * 지정한 Key의 값을 <tt>flamingo-site.xml</tt> 파일에서 찾아서 반환한다.
  *
  * @param key <tt>flamingo-site.xml</tt> 파일에서 환경설정을 식별하는 key의 이름
  * @return <tt>flamingo-site.xml</tt> 파일에서 환경설정을 식별하는 key의 값
  */
 public static String getFlamingoConf(String key) {
   return ConfigurationManagerHelper.getConfigurationManagerHelper()
       .getConfigurationManager()
       .get(key);
 }