当前位置: 首页>>代码示例>>Java>>正文


Java BeforeStep类代码示例

本文整理汇总了Java中org.springframework.batch.core.annotation.BeforeStep的典型用法代码示例。如果您正苦于以下问题:Java BeforeStep类的具体用法?Java BeforeStep怎么用?Java BeforeStep使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BeforeStep类属于org.springframework.batch.core.annotation包,在下文中一共展示了BeforeStep类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: step2

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@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();
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:43,代码来源:YourTwoStepJobConfig.java

示例2: connect

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
/**
 * 
 * @param stepExecution the step execution
 */
@BeforeStep
public void connect(StepExecution stepExecution) 
{
	this.skipCommand.connect();
	
	if(this.beforeCommand != null)
		this.beforeCommand.connect();
	
}
 
开发者ID:nyla-solutions,项目名称:nyla,代码行数:14,代码来源:DAOCommandProcessor.java

示例3: open

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@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;
}
 
开发者ID:nyla-solutions,项目名称:nyla,代码行数:16,代码来源:ExcelItemReader.java

示例4: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@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));
}
 
开发者ID:cegeka,项目名称:batchers,代码行数:11,代码来源:SingleJVMJobProgressListener.java

示例5: createOutputNameFromInput

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
/**
 * 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");
	}
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:18,代码来源:EgovOutputFileListener.java

示例6: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@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);
		}
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:35,代码来源:JdkFilterItemProcessor.java

示例7: beforeAnyRead

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@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();
}
 
开发者ID:gboissinot,项目名称:jenkins-csvexporter,代码行数:11,代码来源:JobItemReader.java

示例8: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    LOG.info("Starting step: {}", stepExecution.getStepName());
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:5,代码来源:LoggingBatchListener.java

示例9: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@Override
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
     log.info("$$$ before step  {}",stepExecution.getStepName());
 
}
 
开发者ID:przodownikR1,项目名称:springBatchBootJavaConfigkata,代码行数:7,代码来源:StepLoggingListener.java

示例10: saveStepExecution

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@BeforeStep
public void saveStepExecution(StepExecution sStepExecution) {
    stepExecution = sStepExecution;
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:5,代码来源:ExtendedMultiResourceItemReader.java

示例11: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@Override
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    jobStartParams = new JobStartParamsMapper().map(stepExecution.getJobParameters());
    stepName = stepExecution.getStepName();
}
 
开发者ID:cegeka,项目名称:batchers,代码行数:7,代码来源:SlaveJobProgressListener.java

示例12: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
	jobExecution = stepExecution.getJobExecution();
}
 
开发者ID:camposer,项目名称:curso_spring-batch,代码行数:5,代码来源:Step1FilterReportProcessor.java

示例13: beforeStep

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
	log.info("스텝 실행 전에 호출되는 리스너의 메소드입니다.");
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:5,代码来源:ImportProductsExecutionListener.java

示例14: retrieveInterstepData

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
/**
 * retrieveInterstepData.
 * 
 * @param stepExecution
 *            to set
 */
@BeforeStep
public void retrieveInterstepData(StepExecution stepExecution) {
    this.stepExecution = stepExecution;
}
 
开发者ID:appstatus,项目名称:appstatus-spring-boot-starter,代码行数:11,代码来源:OneItemWritter.java

示例15: retrieveInterstepData

import org.springframework.batch.core.annotation.BeforeStep; //导入依赖的package包/类
/**
 * retrieveInterstepData.
 * 
 * @param stepExecution
 *            to set
 */
@BeforeStep
public void retrieveInterstepData(StepExecution stepExecution) {
    StatusJobs.getMonitor("One job", "element", stepExecution)
              .beginTask("insert", "insert element", NB_ITEM.get());
}
 
开发者ID:appstatus,项目名称:appstatus-spring-boot-starter,代码行数:12,代码来源:OneItemReader.java


注:本文中的org.springframework.batch.core.annotation.BeforeStep类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。