use of org.ow2.proactive.scheduler.permissions.ChangePriorityPermission in project scheduling by ow2-proactive.
the class SchedulerFrontendState method createJob.
synchronized InternalJob createJob(Job userJob, UserIdentificationImpl ident) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
UniqueID id = checkAccess();
// get the internal job.
InternalJob job = InternalJobFactory.createJob(userJob, this.credentials.get(id));
// setting job informations
if (job.getTasks().size() == 0) {
String msg = "Job " + job.getId().value() + " contains no task. You need to insert at least one task before submitting job";
logger.info(msg);
throw new JobCreationException(msg);
}
// job.
try {
ident.checkPermission(new ChangePriorityPermission(job.getPriority().ordinal()), ident.getUsername() + " does not have rights to set job priority " + job.getPriority());
} catch (PermissionException ex) {
logger.info(ex.getMessage());
throw ex;
}
// setting the job properties
job.setOwner(ident.getUsername());
return job;
}
use of org.ow2.proactive.scheduler.permissions.ChangePriorityPermission in project scheduling by ow2-proactive.
the class SchedulerFrontendState method checkChangeJobPriority.
synchronized void checkChangeJobPriority(JobId jobId, JobPriority priority) throws NotConnectedException, UnknownJobException, PermissionException, JobAlreadyFinishedException {
checkPermissions("changeJobPriority", getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_CHANGE_THE_PRIORITY_OF_THIS_JOB);
UserIdentificationImpl ui = identifications.get(PAActiveObject.getContext().getCurrentRequest().getSourceBodyID()).getUser();
try {
ui.checkPermission(new ChangePriorityPermission(priority.getPriority()), ui.getUsername() + " does not have permissions to set job priority to " + priority);
} catch (PermissionException ex) {
logger.info(ex.getMessage());
throw ex;
}
if (jobs.get(jobId).isFinished()) {
String msg = " is already finished";
jlogger.info(jobId, msg);
throw new JobAlreadyFinishedException("Job " + jobId + msg);
}
}
Aggregations