• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JobSecurityException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: restartJobAndWaitForResult

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
public TCKJobExecutionWrapper restartJobAndWaitForResult(long oldExecutionId, Properties restartJobParameters) throws NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, JobSecurityException, JobExecutionTimeoutException {    	

		JobExecution terminatedJobExecution = null;
		long newExecutionId = jobOp.restart(oldExecutionId, restartJobParameters);

		JobExecutionWaiter waiter = waiterFactory.createWaiter(newExecutionId, jobOp, sleepTime);

		try {
			terminatedJobExecution = waiter.awaitTermination();
		} catch (JobExecutionTimeoutException e) {
			logger.severe(TIMEOUT_MSG);
			Reporter.log(TIMEOUT_MSG);
			throw e;
		}									

		return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp);
	}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:18,代码来源:JobOperatorBridge.java


示例2: stopJobAndWaitForResult

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
public JobExecution stopJobAndWaitForResult(JobExecution jobExecution) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException, JobExecutionTimeoutException {
	
	JobExecution terminatedJobExecution = null;
	jobOp.stop(jobExecution.getExecutionId());

	JobExecutionWaiter waiter = waiterFactory.createWaiter(jobExecution.getExecutionId(), jobOp, sleepTime);

	try {
		terminatedJobExecution = waiter.awaitTermination();
	} catch (JobExecutionTimeoutException e) {
		logger.severe(TIMEOUT_MSG);
		Reporter.log(TIMEOUT_MSG);
		throw e;
	}									

	return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp);
}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:18,代码来源:JobOperatorBridge.java


示例3: startJobAndWaitForResult

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
public TCKJobExecutionWrapper startJobAndWaitForResult(String jobName, Properties jobParameters) throws JobStartException, NoSuchJobExecutionException, JobSecurityException, JobExecutionTimeoutException{
	JobExecution terminatedJobExecution = null;
	long executionId = jobOp.start(jobName, jobParameters);

	JobExecutionWaiter waiter = waiterFactory.createWaiter(executionId, jobOp, sleepTime);

	try {
		terminatedJobExecution = waiter.awaitTermination();
	} catch (JobExecutionTimeoutException e) {
		logger.severe(TIMEOUT_MSG);
		Reporter.log(TIMEOUT_MSG);
		throw e;
	}									

	return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp);
}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:17,代码来源:JobOperatorBridge.java


示例4: getJobExecutions

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public List<JobExecution> getJobExecutions(JobInstance instance)
		throws NoSuchJobInstanceException, JobSecurityException {
	List<JobExecution> executions = new ArrayList<JobExecution>();

	if (isAuthorized(instance.getInstanceId())) {
		// Mediate between one 
		List<IJobExecution> executionImpls = persistenceService.jobOperatorGetJobExecutions(instance.getInstanceId());
		if (executionImpls.size() == 0 ){
			logger.warning("The current user is not authorized to perform this operation");
			throw new NoSuchJobInstanceException( "Job: " + instance.getJobName() + " does not exist");
		}
		for (IJobExecution e : executionImpls) {
			executions.add(e);
		}
	} else {
		logger.warning("The current user is not authorized to perform this operation");
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

	return executions;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:23,代码来源:JobOperatorImpl.java


示例5: getJobInstanceCount

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException {

	int jobInstanceCount = 0;

	BatchSecurityHelper helper = getBatchSecurityHelper();
	
	if (isCurrentTagAdmin(helper)) {
		// Do an unfiltered query
		jobInstanceCount = persistenceService.jobOperatorGetJobInstanceCount(jobName);
	} else {
		jobInstanceCount = persistenceService.jobOperatorGetJobInstanceCount(jobName, helper.getCurrentTag());
	}

	if (jobInstanceCount > 0) {
		return jobInstanceCount;
	}
	else { 
		logger.fine("getJobInstanceCount: Job Name " + jobName + " not found");
		throw new NoSuchJobException( "Job " + jobName + " not found");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:23,代码来源:JobOperatorImpl.java


示例6: getJobNames

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public Set<String> getJobNames() throws JobSecurityException {

	Set<String> jobNames = new HashSet<String>();
	Map<Long, String> data = persistenceService.jobOperatorGetExternalJobInstanceData();
	Iterator<Map.Entry<Long,String>> it = data.entrySet().iterator();
	while (it.hasNext()) {
		Map.Entry<Long,String> entry = it.next();
		long instanceId = entry.getKey();
		if(isAuthorized(instanceId)) {
			String name = entry.getValue();
			jobNames.add(name);
		}
	}
	return jobNames;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:17,代码来源:JobOperatorImpl.java


示例7: getParameters

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public Properties getParameters(long executionId)
		throws NoSuchJobExecutionException, JobSecurityException{

	Properties props = null;
	JobInstance requestedJobInstance = batchKernel.getJobInstance(executionId);

	if (isAuthorized(requestedJobInstance.getInstanceId())) {
		props = persistenceService.getParameters(executionId);
	} else {
		logger.warning("getParameters: The current user is not authorized to perform this operation");
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

	return props;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:17,代码来源:JobOperatorImpl.java


示例8: getStepExecutions

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public List<StepExecution> getStepExecutions(long executionId)
		throws NoSuchJobExecutionException, JobSecurityException {

	logger.entering(sourceClass, "getStepExecutions", executionId);

	List<StepExecution> stepExecutions = new ArrayList<StepExecution>();

	IJobExecution jobEx = batchKernel.getJobExecution(executionId);
	if (jobEx == null){
		logger.fine("Job Execution: " + executionId + " not found");
		throw new NoSuchJobExecutionException("Job Execution: " + executionId + " not found");
	}
	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		stepExecutions = persistenceService.getStepExecutionsForJobExecution(executionId);
	} else {
		logger.warning("getStepExecutions: The current user is not authorized to perform this operation");
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

	logger.exiting(sourceClass, "getStepExecutions", stepExecutions);
	return stepExecutions;

}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:25,代码来源:JobOperatorImpl.java


示例9: startBatches

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
public void startBatches() throws JobSecurityException, JobStartException, NoSuchJobExecutionException {
      JobOperator jobOperator = BatchRuntime.getJobOperator();

      logger.log(Level.INFO, "starting simple");
      Long executionId = jobOperator.start("simple", new Properties());
      JobExecution jobExecution = jobOperator.getJobExecution(executionId);

      logger.log(Level.INFO, "Started simple job with id {0}", jobExecution.getExecutionId());
      logger.log(Level.INFO, "Status simple {0}", jobExecution.getBatchStatus());

//      logger.log(Level.INFO, "starting chunk");
//      Long chunkExecutionId = jobOperator.start("chunk", new Properties());
//      JobExecution chunkJobExecution = jobOperator.getJobExecution(chunkExecutionId);
//
//      logger.log(Level.INFO, "Status chunk {0}", chunkJobExecution.getBatchStatus());
//      logger.log(Level.INFO, "Started chunk job with id {0}", chunkJobExecution.getExecutionId());
   }
 
开发者ID:ivargrimstad,项目名称:javaee-batch,代码行数:18,代码来源:SimpleBatchStarter.java


示例10: startInternal

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
private long startInternal(final String jobXMLName, final Properties jobParameters) throws JobStartException, JobSecurityException {
    final StringWriter jobParameterWriter = new StringWriter();
    if (jobParameters != null) {
        try {
            jobParameters.store(jobParameterWriter, "Job parameters on start: ");
        } catch (IOException e) {
            jobParameterWriter.write("Job parameters on start: not printable");
        }
    } else {
        jobParameterWriter.write("Job parameters on start = null");
    }

    final String jobXML = xmlLoaderService.loadJSL(jobXMLName);
    final InternalJobExecution execution = kernelService.startJob(jobXML, jobParameters);
    return execution.getExecutionId();
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:JobOperatorImpl.java


示例11: abandon

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public void abandon(final long executionId) throws NoSuchJobExecutionException, JobExecutionIsRunningException, JobSecurityException {
    final InternalJobExecution jobEx = persistenceManagerService.jobOperatorGetJobExecution(executionId);

    // if it is not in STARTED or STARTING state, mark it as ABANDONED
    BatchStatus status = jobEx.getBatchStatus();
    if (status == BatchStatus.STARTING ||  status == BatchStatus.STARTED) {
        throw new JobExecutionIsRunningException("Job Execution: " + executionId + " is still running");
    }

    // update table to reflect ABANDONED state
    persistenceManagerService.updateBatchStatusOnly(jobEx.getExecutionId(), BatchStatus.ABANDONED, new Timestamp(System.currentTimeMillis()));

    // Don't forget to update JOBSTATUS table
    statusManagerService.updateJobBatchStatus(jobEx.getInstanceId(), BatchStatus.ABANDONED);
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:JobOperatorImpl.java


示例12: getRunningExecutions

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public List<Long> getRunningExecutions(final String jobName) throws NoSuchJobException, JobSecurityException {
    final List<Long> jobExecutions = new ArrayList<Long>();

    // get the jobexecution ids associated with this job name
    final Set<Long> executionIds = persistenceManagerService.jobOperatorGetRunningExecutions(jobName);

    if (executionIds.isEmpty()) {
        throw new NoSuchJobException("Job Name " + jobName + " not found");
    }

    // for every job instance id
    for (final long id : executionIds) {
        try {
            if (kernelService.isExecutionRunning(id)) {
                final InternalJobExecution jobEx = kernelService.getJobExecution(id);
                jobExecutions.add(jobEx.getExecutionId());
            }
        } catch (final NoSuchJobExecutionException e) {
            throw new IllegalStateException("Just found execution with id = " + id + " in table, but now seeing it as gone", e);
        }
    }
    return jobExecutions;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:25,代码来源:JobOperatorImpl.java


示例13: triggerJob

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public long triggerJob(String jobName) throws BatchException {
    LOGGER.info("Starting execution of JOB {}", jobName);

    Properties jobParameters = getJobParameters(jobName);

    storeJobContent(jobName);
    try {
        return jsrJobOperator.start(jobName, jobParameters);
    } catch (JobStartException | JobSecurityException e) {
        throw new BatchException(ApplicationErrors.JOB_TRIGGER_FAILED, e,
                e.getMessage());
    }
}
 
开发者ID:motech,项目名称:modules,代码行数:15,代码来源:JobTriggerServiceImpl.java


示例14: startInternal

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
private long startInternal(String jobXMLName, Properties jobParameters)	throws JobStartException, JobSecurityException {

		StringWriter jobParameterWriter = new StringWriter();
		if (jobParameters != null) {
			try {
				jobParameters.store(jobParameterWriter, "Job parameters on start: ");
			} catch (IOException e) {
				jobParameterWriter.write("Job parameters on start: not printable");
			}
		} else {
			jobParameterWriter.write("Job parameters on start = null");
		}

		if (logger.isLoggable(Level.FINE)) {            
			logger.fine("JobOperator start, with jobXMLName = " + jobXMLName + "\n" + jobParameterWriter.toString());
		}

		String jobXML = jobXMLLoaderService.loadJSL(jobXMLName);

		long executionId = 0;

		if (logger.isLoggable(Level.FINE)) {            
			int concatLen = jobXML.length() > 200 ? 200 : jobXML.length();
			logger.fine("Starting job: " + jobXML.substring(0, concatLen) + "... truncated ...");
		}

		IJobExecution execution = batchKernel.startJob(jobXML, jobParameters);
		executionId = execution.getExecutionId();

		if (logger.isLoggable(Level.FINE)) {
			logger.fine("Started job with instanceId: " + execution.getInstanceId() + ", executionId: " + executionId);
		}

		return executionId;
	}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:36,代码来源:JobOperatorImpl.java


示例15: abandon

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public void abandon(long executionId)
		throws NoSuchJobExecutionException, JobExecutionIsRunningException, JobSecurityException {

	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		IJobExecution jobEx = persistenceService.jobOperatorGetJobExecution(executionId);

		// if it is not in STARTED or STARTING state, mark it as ABANDONED
		List<BatchStatus> runningStatusesList = Arrays.asList(new BatchStatus[] {BatchStatus.STARTED, BatchStatus.STARTING});
		Set<BatchStatus> runningStatusesSet = Collections.unmodifiableSet(new HashSet<BatchStatus>(runningStatusesList));

		if (!runningStatusesSet.contains(jobEx.getBatchStatus())) {
			// update table to reflect ABANDONED state
			long time = System.currentTimeMillis();
			Timestamp timestamp = new Timestamp(time);
			persistenceService.updateBatchStatusOnly(jobEx.getExecutionId(), BatchStatus.ABANDONED, timestamp);
			logger.fine("Job Execution: " + executionId + " was abandoned");

			// Don't forget to update JOBSTATUS table
			_jobStatusManagerService.updateJobBatchStatus(jobEx.getInstanceId(), BatchStatus.ABANDONED);
		}
		else {
			logger.warning("Job Execution: " + executionId + " is still running");
			throw new JobExecutionIsRunningException("Job Execution: " + executionId + " is still running");
		}
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:31,代码来源:JobOperatorImpl.java


示例16: getJobExecution

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public IJobExecution getJobExecution(long executionId)
		throws NoSuchJobExecutionException, JobSecurityException {
	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		return batchKernel.getJobExecution(executionId);
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:10,代码来源:JobOperatorImpl.java


示例17: getJobInstance

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public JobInstance getJobInstance(long executionId)
		throws NoSuchJobExecutionException, JobSecurityException {
	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		return this.batchKernel.getJobInstance(executionId);
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:10,代码来源:JobOperatorImpl.java


示例18: getRunningExecutions

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public List<Long> getRunningExecutions(String jobName)
		throws NoSuchJobException, JobSecurityException {

	logger.entering(sourceClass, "getRunningExecutions", jobName);
	List<Long> jobExecutions = new ArrayList<Long>();

	// get the jobexecution ids associated with this job name
	Set<Long> executionIds = persistenceService.jobOperatorGetRunningExecutions(jobName);

	if (executionIds.size() > 0){
		// for every job instance id
		for (long id : executionIds){
			try {
				logger.finer("Examining executionId: " + id);
				if(isAuthorized(persistenceService.getJobInstanceIdByExecutionId(id))) {
					if (batchKernel.isExecutionRunning(id)) {
						IJobExecution jobEx = batchKernel.getJobExecution(id);
						jobExecutions.add(jobEx.getExecutionId());
					} else {
						logger.finer("Found executionId: " + id + " with a BatchStatus indicating running, but kernel doesn't currently have an entry for this execution in the kernel's in-memory map.");
					}
				} else {
					logger.finer("Don't have authorization for executionId: " + id);
				}
			} catch (NoSuchJobExecutionException e) {
				String errorMsg = "Just found execution with id = " + id + " in table, but now seeing it as gone";
				logger.severe(errorMsg);
				throw new IllegalStateException(errorMsg, e);
			}
		}
		// send the list of objs back to caller
		logger.exiting(sourceClass, "getRunningExecutions", jobExecutions);
		return jobExecutions;
	}
	else { 
		logger.fine("getRunningExecutions: Job Name " + jobName + " not found");
		throw new NoSuchJobException( "Job Name " + jobName + " not found");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:41,代码来源:JobOperatorImpl.java


示例19: restartInternal

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
private long restartInternal(long oldExecutionId, Properties restartParameters) throws JobExecutionAlreadyCompleteException,
NoSuchJobExecutionException, JobExecutionNotMostRecentException, JobRestartException, JobSecurityException {
	long newExecutionId = -1;

	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(oldExecutionId))) {
		StringWriter jobParameterWriter = new StringWriter();
		if (restartParameters != null) {
			try {
				restartParameters.store(jobParameterWriter, "Job parameters on restart: ");
			} catch (IOException e) {
				jobParameterWriter.write("Job parameters on restart: not printable");
			}
		} else {
			jobParameterWriter.write("Job parameters on restart = null");
		}

		if (logger.isLoggable(Level.FINE)) {            
			logger.fine("JobOperator restart, with old executionId = " + oldExecutionId + "\n" + jobParameterWriter.toString());
		}

		IJobExecution execution = batchKernel.restartJob(oldExecutionId, restartParameters);

		newExecutionId = execution.getExecutionId();

		if (logger.isLoggable(Level.FINE)) {            
			logger.fine("Restarted job with instanceID: " + execution.getInstanceId() + ", new executionId: " + newExecutionId + ", and old executionID: " + oldExecutionId);
		}
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

	return newExecutionId;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:34,代码来源:JobOperatorImpl.java


示例20: stop

import javax.batch.operations.JobSecurityException; //导入依赖的package包/类
@Override
public void stop(long executionId) throws NoSuchJobExecutionException,
JobExecutionNotRunningException, JobSecurityException {

	logger.entering(sourceClass, "stop", executionId);

	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		batchKernel.stopJob(executionId);
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

	logger.exiting(sourceClass, "stop");
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:15,代码来源:JobOperatorImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AppleNotificationServerBasicImpl类代码示例发布时间:2022-05-22
下一篇:
Java Action类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap