/** * * @param stepExecution the step execution */ @BeforeStep public void connect(StepExecution stepExecution) { this.skipCommand.connect(); if(this.beforeCommand != null) this.beforeCommand.connect(); }
@BeforeStep public void open() throws IOException { this.excel = Excel.getExcel(this.filePath); if(this.sheetName != null && this.sheetName.length() > 0) this.sheet = this.excel.retrieveSheet(this.sheetName); else this.sheet = this.excel.retrieveSheet(this.sheetNumber); this.rowCount = this.sheet.getRowCount(); index = 1; }
@Override @BeforeStep public void beforeStep(StepExecution stepExecution) { totalItemCount = employeeService.getEmployeeCount().intValue(); jobStartParams = new JobStartParamsMapper().map(stepExecution.getJobParameters()); stepName = stepExecution.getStepName(); currentItemCount = new AtomicLong(); lastPercentageComplete = new AtomicInteger(); eventBus.post(new JobProgressEvent(jobStartParams, stepName, 0)); }
/** * stepExecutionContext에 inputKeyName 을 이용하여 outputKeyName을 put 함 * * @param stepExecution */ @BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); } if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".csv"); } }
@BeforeStep public void beforeStep(final StepExecution stepExecution) { try { InMemoryCompiler javac = new InMemoryCompiler(); String javaCode = InMemoryCompiler.getTheSourceCode(getExpression(), getScriptFile()); final Class<?> clazz ; if( CODE2CLASS.containsKey(javaCode)) { if(LOG.isWarnEnabled()) LOG.warn("Code already compiled"); clazz = CODE2CLASS.get(javaCode); } else { final String className = "FunctionImpl"+ rand.nextInt()+ System.currentTimeMillis(); if(LOG.isInfoEnabled()) LOG.info("Compiling\n" + InMemoryCompiler.beautifyCode(javaCode)); clazz = javac.compileClass(className, javaCode.replace("__CLASS__", className)); CODE2CLASS.put(javaCode, clazz); } final Constructor<?> ctor = clazz.getConstructor(); final Object instance = ctor.newInstance(); if(!(instance instanceof Function)) { throw new JvarkitException.ScriptingError("Not an instance of Function"); } this.transformer = (Function)instance; } catch(final Exception err) { throw new RuntimeException(err); } }
@BeforeStep @SuppressWarnings({"unused", "unchecked"}) private void beforeAnyRead(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); ExecutionContext executionContext = jobExecution.getExecutionContext(); contextMap = (Map<String, Map<String, String>>) executionContext.get("mapContext"); urls = jenkinsReader.buildURLs(); }
@BeforeStep public void beforeStep(StepExecution stepExecution) { LOG.info("Starting step: {}", stepExecution.getStepName()); }
@Override @BeforeStep public void beforeStep(StepExecution stepExecution) { log.info("$$$ before step {}",stepExecution.getStepName()); }
@Bean @JobScope public Step step2(StepBuilderFactory stepBuilderFactory) { ItemReader<String> reader = new ItemReader<String>() { int i = 0; @Override public String read() throws Exception { i++; return i == 1 ? "hello" : null; } }; ItemWriter<String> writer = new ItemWriter<String>() { String someString; @BeforeStep public void beforeStep(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); ExecutionContext jobContext = jobExecution.getExecutionContext(); this.someString = jobContext.getString("someKey"); } @Override public void write(List<? extends String> items) throws Exception { logger.info("Step 2: " + someString); for (String item : items) { logger.info("step2: " + item); } } }; return stepBuilderFactory.get("step2") .<String, String>chunk(10) .reader(reader) .writer(writer) .listener(writer) .build(); }
@BeforeStep public void saveStepExecution(StepExecution sStepExecution) { stepExecution = sStepExecution; }
@Override @BeforeStep public void beforeStep(StepExecution stepExecution) { jobStartParams = new JobStartParamsMapper().map(stepExecution.getJobParameters()); stepName = stepExecution.getStepName(); }
@BeforeStep public void beforeStep(StepExecution stepExecution) { jobExecution = stepExecution.getJobExecution(); }
@BeforeStep public void beforeStep(StepExecution stepExecution) { log.info("스텝 실행 전에 호출되는 리스너의 메소드입니다."); }
/** * retrieveInterstepData. * * @param stepExecution * to set */ @BeforeStep public void retrieveInterstepData(StepExecution stepExecution) { this.stepExecution = stepExecution; }
/** * retrieveInterstepData. * * @param stepExecution * to set */ @BeforeStep public void retrieveInterstepData(StepExecution stepExecution) { StatusJobs.getMonitor("One job", "element", stepExecution) .beginTask("insert", "insert element", NB_ITEM.get()); }