Tabnine Logo
JobSecurityException
Code IndexAdd Tabnine to your IDE (free)

How to use
JobSecurityException
in
javax.batch.operations

Best Java code snippets using javax.batch.operations.JobSecurityException (Showing top 20 results out of 315)

origin: wildfly/wildfly

  @Override
  public final JobSecurityException unauthorized(final String user, final Permission permission) {
    final JobSecurityException result = new JobSecurityException(String.format(getLoggingLocale(), unauthorized$str(), user, permission));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
  }
}
origin: OpenLiberty/open-liberty

/**
 * If app security is enabled we just do a quick check to make sure the user is part of some batch role.
 * Otherwise we throw a JobSecurityException immediately.
 */
private void batchRoleCheck() {
  if (authService != null) {
    if (!authService.isInAnyBatchRole()) {
      throw new JobSecurityException("Current user " + authService.getRunAsUser() + " is not authorized to perform batch operations");
    }
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

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;
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

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;
}
origin: org.jboss.eap/wildfly-batch-jberet

  @Override
  public final JobSecurityException unauthorized(final String user, final Permission permission) {
    final JobSecurityException result = new JobSecurityException(String.format(getLoggingLocale(), unauthorized$str(), user, permission));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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");
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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");
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

@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");
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

@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");
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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;
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

@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;
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

@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;
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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;
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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");
  }
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

@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;
}
origin: com.ibm.jbatch/com.ibm.jbatch-runtime

@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");
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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;
}
origin: com.ibm.jbatch/com.ibm.jbatch.container

@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");
}
origin: OpenLiberty/open-liberty

  jobInstances = getPersistenceManagerService().getJobInstances(jobName, batchSecurityHelper.getRunAsUser(), start, count);
} else {
  throw new JobSecurityException("Current user " + authService.getRunAsUser() + " is not authorized to perform batch operations");
origin: OpenLiberty/open-liberty

/**
 * {@inheritDoc}
 */
@Override
public Set<String> getJobNames() {
  if (authService == null || authService.isAdmin() || authService.isMonitor()) {
    return persistenceManagerService.getJobNamesSet();
  } else if (authService.isSubmitter()) {
    return persistenceManagerService.getJobNamesSet(authService.getRunAsUser());
  }
  throw new JobSecurityException("The current user " + authService.getRunAsUser() + " is not authorized to perform any batch operations.");
}
javax.batch.operationsJobSecurityException

Javadoc

SecurityException is thrown when an user is not authorized to run a JobOperator method, such as restart, stop, abandon, any getters, etc.

Most used methods

  • <init>
  • getStackTrace
  • setStackTrace

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now