Determine if a job name and job type are valid.
@param jobName the name of the job
@param jobType the class of the job
@throws IllegalArgumentException if the name or type are invalid
480921
protected void checkJobType(final String jobName, final Class<?> jobType) {
        if (jobName == null) {
            throw new IllegalArgumentException("jobName must not be null");
        }
        if (jobType == null) {
            throw new IllegalArgumentException("jobType must not be null");
        }
        if (!(Runnable.class.isAssignableFrom(jobType)) 
                && !(Callable.class.isAssignableFrom(jobType))) {
            throw new IllegalArgumentException(
                    "jobType must implement either Runnable or Callable: " + jobType);
        }
    }
1107824
public function isQueued($reference, $jobType = null) {
		if (!$reference) {
			throw new InvalidArgumentException('A reference is needed');
		}

		$conditions = [
			'reference' => $reference,
			'completed IS' => null,
		];
		if ($jobType) {
			$conditions['job_type'] = $jobType;
		}

		return (bool)$this->find()->where($conditions)->select(['id'])->first();
	}
88367
public void removeJobType(final Class<?> jobType) {
        if (jobType == null) {
            throw new IllegalArgumentException("jobType must not be null");
        }
        this.jobTypes.values().remove(jobType);
    }
753558
public static JobBuilder newJobBuilder(Class<? extends Job> jobClass) {

    JobBuilder b = new JobBuilder();
    b.ofType(jobClass);
    return b;
  }
178773
public void setJobName(String jobName) {

        checkFrozen();
        if (CmsStringUtil.isEmpty(jobName) || !jobName.trim().equals(jobName)) {
            throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_JOB_NAME_1, jobName));

        }
        m_jobName = jobName;
    }
1182935
private static void setJobConf(Object theObject, Configuration conf) {
        //If JobConf and JobConfigurable are in classpath, AND
        //theObject is of type JobConfigurable AND
        //conf is of type JobConf then
        //invoke configure on theObject
        try {
            Class<?> jobConfClass = conf.getClassByName("org.apache.hadoop.mapred.JobConf");
            Class<?> jobConfigurableClass = conf.getClassByName("org.apache.hadoop.mapred.JobConfigurable");
            if (jobConfClass.isAssignableFrom(conf.getClass())
                    && jobConfigurableClass.isAssignableFrom(theObject.getClass())) {
                Method configureMethod = jobConfigurableClass.getMethod("configure", jobConfClass);
                configureMethod.invoke(theObject, conf);
            }
        } catch (ClassNotFoundException e) {
            //JobConf/JobConfigurable not in classpath. no need to configure
        } catch (Exception e) {
            throw new RuntimeException("Error in configuring object", e);
        }
    }
442534
public void setJobGroup (final String jobGroup)
  {
    if (jobGroup != null && jobGroup.trim ().length () == 0)
      throw new IllegalArgumentException ("Group name cannot be null or empty.");

    if (jobGroup == null)
      m_sJobGroup = IScheduler.DEFAULT_GROUP;
    else
      m_sJobGroup = jobGroup;
  }
602669
public Optional<JobDefinition> getJobDefinition(final String jobType) {
        return jobDefinitions
                .stream()
                .filter((j) -> j.jobType().equalsIgnoreCase(jobType))
                .findAny();
    }
1152658
public void setJobName (final String jobName)
  {
    if (jobName == null || jobName.trim ().length () == 0)
    {
      throw new IllegalArgumentException ("Job name cannot be null or empty.");
    }

    m_sJobName = jobName;
  }
150457
def _name_is_available(self, job_name):
        
        return (False
                if [job for job in self.jobs if job.name == job_name]
                else True)
751851
public static void addJob(String jobName, String jobClassName) throws SundialSchedulerException {

    addJob(jobName, jobClassName, null, false);
  }
1319536
public JobResult job(String jobname) {
        HttpGet getRequest = new HttpGet(baseUrl + "job/" + jobname);
        getRequest.addHeader("Accept", "application/xml");
        return jobResult(getRequest);
    }
788115
@POST
  @Produces(APPLICATION_JSON)
  @Timed
  @ExceptionMetered
  public CreateJobResponse post(@Valid final Job job,
                                @RequestUser final String username) {
    final Job.Builder clone = job.toBuilder()
        .setCreatingUser(username)
        .setCreated(clock.now().getMillis())
        // If the job had a hash coming in, preserve it
        .setHash(job.getId().getHash());
    final Job actualJob = clone.build();
    final Collection<String> errors = jobValidator.validate(actualJob);
    final String jobIdString = actualJob.getId().toString();
    if (!errors.isEmpty()) {
      throw badRequest(new CreateJobResponse(INVALID_JOB_DEFINITION, ImmutableList.copyOf(errors),
          jobIdString));
    }
    try {
      model.addJob(actualJob);
    } catch (JobExistsException e) {
      throw badRequest(new CreateJobResponse(JOB_ALREADY_EXISTS, ImmutableList.<String>of(),
          jobIdString));
    }
    log.info("created job: {}", actualJob);
    return new CreateJobResponse(CreateJobResponse.Status.OK, ImmutableList.<String>of(),
        jobIdString);
  }
1254426
public JobReport execute(Job job) {
        try {
            return executorService.submit(job).get();
        } catch (InterruptedException | ExecutionException e) {
            throw new RuntimeException("Unable to execute job " + job.getName(), e);
        }
    }
770083
public static void startJob(String jobName) throws SundialSchedulerException {

    try {
      getScheduler().triggerJob(jobName, null);
    } catch (SchedulerException e) {
      throw new SundialSchedulerException("ERROR STARTING JOB!!!", e);
    }
  }
6529
public void validate () throws SchedulerException
  {
    if (m_sName == null)
    {
      throw new SchedulerException ("Trigger's name cannot be null");
    }

    if (m_sGroup == null)
    {
      throw new SchedulerException ("Trigger's group cannot be null");
    }

    if (m_sJobName == null)
    {
      throw new SchedulerException ("Trigger's related Job's name cannot be null");
    }

    if (m_sJobGroup == null)
    {
      throw new SchedulerException ("Trigger's related Job's group cannot be null");
    }
  }
135474
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString name_validator = new MPSString();
		name_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		name_validator.validate(operationType, name, "\"name\"");
		
		MPSBoolean enable_validator = new MPSBoolean();
		enable_validator.validate(operationType, enable, "\"enable\"");
		
		MPSString severity_validator = new MPSString();
		severity_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		severity_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		severity_validator.validate(operationType, severity, "\"severity\"");
		
	}