本文整理汇总了Java中javax.batch.runtime.context.StepContext类的典型用法代码示例。如果您正苦于以下问题:Java StepContext类的具体用法?Java StepContext怎么用?Java StepContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StepContext类属于javax.batch.runtime.context包,在下文中一共展示了StepContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTransactionManager
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
public TransactionManagerAdapter getTransactionManager(StepContext stepContext) throws TransactionManagementException {
logger.entering(CLASSNAME, "getTransactionManager", stepContext);
TransactionManagerAdapter transactionManager = null;
// get the JTA tran manager if we are in Java EE
if (! this.batchConfig.isJ2seMode()) {
// use the container JNDI java:comp/UserTransaction
logger.fine("getting transaction object from JNDI java:comp/UserTransaction");
transactionManager = new JTAUserTransactionAdapter("java:comp/UserTransaction");
}
else if (this.batchConfig.isJ2seMode()) {
// If we are in J2SE mode use the non-transactional manager
// java environment is Java SE
// NoOp transaction manager
logger.fine("J2SE mode non-transactional manager");
transactionManager = new DefaultNonTransactionalManager();
}
logger.exiting(CLASSNAME, "getTransactionManager", transactionManager);
return transactionManager;
}
示例2: newInstance
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
public static <T> GroovyInstance<T> newInstance(final Class<T> expected, final String path, final JobContext jobContext, final StepContext stepContext)
throws IllegalAccessException, InstantiationException {
if (path == null) {
throw new BatchRuntimeException("no script configured expected");
}
final File script = new File(path);
if (!script.exists()) {
throw new BatchRuntimeException("Can't find script: " + path);
}
final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
final GroovyClassLoader loader = new GroovyClassLoader(tccl);
final Class<?> clazz;
try {
clazz = loader.parseClass(script);
} catch (final IOException e) {
throw new BatchRuntimeException(e);
}
final T delegate = expected.cast(clazz.newInstance());
injectIfBatcheeIfAvailable(tccl, delegate, jobContext, stepContext);
return new GroovyInstance<T>(loader, delegate);
}
示例3: InjectionReferences
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
public InjectionReferences(JobContext jobContext, StepContext stepContext,
List<Property> props) {
this.jobContext = jobContext;
this.stepContext = stepContext;
this.props = props;
}
示例4: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Produces
@Dependent
public StepContext getStepContext() {
if (ProxyFactory.getInjectionReferences() != null) {
return ProxyFactory.getInjectionReferences().getStepContext();
} else {
return null;
}
}
示例5: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Produces
public StepContext getStepContext() {
if (ProxyFactory.getInjectionReferences() != null) {
return ProxyFactory.getInjectionReferences().getStepContext();
}
return null;
}
示例6: injectIfBatcheeIfAvailable
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
private static <T> void injectIfBatcheeIfAvailable(final ClassLoader tccl, final T delegate, final JobContext jobContext, final StepContext stepContext) {
try {
final Class<?> dependencyInjections = tccl.loadClass("org.apache.batchee.container.util.DependencyInjections");
final Class<?> injectionReferences = tccl.loadClass("org.apache.batchee.container.proxy.InjectionReferences");
final Method inject = dependencyInjections.getMethod("injectReferences", Object.class, injectionReferences);
final Constructor<?> injectionReferencesConstructor = injectionReferences.getConstructors()[0]; // there is a unique constructor
inject.invoke(null, delegate, injectionReferencesConstructor.newInstance(jobContext, stepContext, null));
} catch (final Throwable th) {
// no-op: BatchEE is not available, injections will not be available
}
}
示例7: currentKey
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
protected Long currentKey() {
StepContext stepContext = getContextResolver().getStepContext();
if (stepContext == null) {
return null;
}
return stepContext.getStepExecutionId();
}
示例8: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
public StepContext getStepContext() {
InjectionReferences references = getInjectionReferences();
if (references != null) {
return references.getStepContext();
}
return null;
}
示例9: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
public StepContext getStepContext() {
return stepContext;
}
示例10: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
protected StepContext getStepContext() {
return stepCtx;
}
示例11: getTransactionManager
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
public TransactionManagerAdapter getTransactionManager(StepContext stepContext)
{
return mockTxAdapter;
}
示例12: getTransactionManager
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
public TransactionManagerAdapter getTransactionManager(final StepContext stepContext) throws TransactionManagementException {
// Doesn't currently make use of stepContext but keeping signature
return getTransactionManager();
}
示例13: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
public StepContext getStepContext() {
return resolve(StepContext.class);
}
示例14: getTransactionManager
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
@Override
public TransactionManagerAdapter getTransactionManager(StepContext stepContext) {
UserTransaction ut = ThreadExecutorEjb.getUserTransaction();
return new UserTransactionTxAdapter(ut);
}
示例15: getStepContext
import javax.batch.runtime.context.StepContext; //导入依赖的package包/类
/**
* @return the current {@link StepContext} for this {@link Thread}
*/
StepContext getStepContext();