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


Java ExecutionContext.containsKey方法代码示例

本文整理汇总了Java中org.springframework.batch.item.ExecutionContext.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionContext.containsKey方法的具体用法?Java ExecutionContext.containsKey怎么用?Java ExecutionContext.containsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.batch.item.ExecutionContext的用法示例。


在下文中一共展示了ExecutionContext.containsKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: open

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Override
public void open(ExecutionContext executionContext) throws
        ItemStreamException {
    if (executionContext == null) {
        throw new IllegalArgumentException();
    }

    if (executionContext.containsKey(IDS_NUMBER)) {
        number = executionContext.getInt(IDS_NUMBER);
        count = executionContext.getInt(CURRENT_ID_COUNT);
        ids = new String[number];

        for (int i = 0; i < number; i++) {
            ids[i] = executionContext.getString(LIST_ID + i);
        }
    } else {
        ids = loadListIds();
        number = ids.length;
        count = 0;
    }
}
 
开发者ID:hosuaby,项目名称:signature-processing,代码行数:22,代码来源:ListIdsItemReader.java

示例2: execute

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
/**
 * Executes the task as specified by the taskName with the associated
 * properties and arguments.
 * @param contribution mutable state to be passed back to update the current step execution
 * @param chunkContext contains the task-execution-id used by the listener.
 * @return Repeat status of FINISHED.
 */
@Override
public RepeatStatus execute(StepContribution contribution,
		ChunkContext chunkContext) throws Exception {
	String tmpTaskName = this.taskName.substring(0,
			this.taskName.lastIndexOf('_'));

	List<String> args = this.arguments;

	ExecutionContext stepExecutionContext = chunkContext.getStepContext().getStepExecution().
			getExecutionContext();
	if(stepExecutionContext.containsKey("task-arguments")) {
		args = (List<String>) stepExecutionContext.get("task-arguments");
	}

	long executionId = this.taskOperations.launch(tmpTaskName,
			this.properties, args);

	stepExecutionContext.put("task-execution-id", executionId);
	stepExecutionContext.put("task-arguments", args);

	waitForTaskToComplete(executionId);

	return RepeatStatus.FINISHED;
}
 
开发者ID:spring-cloud-task-app-starters,项目名称:composed-task-runner,代码行数:32,代码来源:TaskLauncherTasklet.java

示例3: doOpen

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
/**
 * Apply the @DEFAULT_ITEM_SEPARATOR delimiter after the writing of the header. 
 * This changes from the default implementation where the @itemSeparator would have been applied per default.
 * 
 * @param executionContext
 * @throws ItemStreamException
 */
private void doOpen(ExecutionContext executionContext)
		throws ItemStreamException {
	OutputState outputState = getOutputState();
	if (executionContext
			.containsKey(getExecutionContextKey(RESTART_DATA_NAME))) {
		outputState.restoreFrom(executionContext);
	}
	try {
		outputState.initializeBufferedWriter();
	} catch (IOException ioe) {
		throw new ItemStreamException("Failed to initialize writer", ioe);
	}
	if (outputState.lastMarkedByteOffsetPosition == 0
			&& !outputState.appending) {
		if (headerFooterCallback != null) {
			try {
				headerFooterCallback
						.writeHeader(outputState.outputBufferedWriter);					
				outputState.write(DEFAULT_ITEM_SEPARATOR);
			} catch (IOException e) {
				throw new ItemStreamException(
						"Could not write headers.  The file may be corrupt.",
						e);
			}
		}
	}
}
 
开发者ID:SoatGroup,项目名称:json-file-itemwriter,代码行数:35,代码来源:JsonFlatFileItemWriter.java

示例4: open

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
/**
 * Open the output source.
 * @param newExecutionContext Set the execution context
 * @see org.springframework.batch.item.ItemStream#open(ExecutionContext)
 */
public final void open(final ExecutionContext newExecutionContext) {

	Assert.notNull(resource, "The resource must be set");

	long startAtPosition = 0;
	boolean restarted = false;

	// if restart data is provided, restart from provided offset
	// otherwise start from beginning
	if (newExecutionContext.containsKey(getKey(RESTART_DATA_NAME))) {
		startAtPosition = newExecutionContext
				.getLong(getKey(RESTART_DATA_NAME));
		restarted = true;
	}

	open(startAtPosition, restarted);

	if (startAtPosition == 0) {
		try {
			if (headerCallback != null) {
				headerCallback.write(delegateEventWriter);
			}
		} catch (IOException e) {
			throw new ItemStreamException("Failed to write headerItems", e);
		}
	}

}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:34,代码来源:StaxEventItemWriter.java

示例5: open

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
/**
 * Open the output source
 *
 * @see org.springframework.batch.item.ItemStream#open(ExecutionContext)
 */
public void open(ExecutionContext executionContext) {

	Assert.notNull(resource, "The resource must be set");

	long startAtPosition = 0;
	boolean restarted = false;

	// if restart data is provided, restart from provided offset
	// otherwise start from beginning
	if (executionContext.containsKey(getKey(RESTART_DATA_NAME))) {
		startAtPosition = executionContext
				.getLong(getKey(RESTART_DATA_NAME));
		restarted = true;
	}

	open(startAtPosition, restarted);

	if (startAtPosition == 0) {
		try {
			if (headerCallback != null) {
				headerCallback.write(delegateEventWriter);
			}
		} catch (IOException e) {
			throw new ItemStreamException("Failed to write headerItems", e);
		}
	}

}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:34,代码来源:StaxEventItemWriter.java


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