Adds a new job with a given JobDetail and Trigger to the scheduler

@param jobDetail The JobDetail for the Job
@param trigger The Trigger for the job
@throws MangooSchedulerException when accessing the scheduler results in an error
351194
public void schedule(JobDetail jobDetail, Trigger trigger) throws MangooSchedulerException {
        Objects.requireNonNull(jobDetail, Required.JOB_DETAIL.toString());
        Objects.requireNonNull(trigger, Required.TRIGGER.toString());
        Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());

        try {
            this.quartzScheduler.scheduleJob(jobDetail, trigger);
        } catch (final SchedulerException e) {
            throw new MangooSchedulerException(e);
        }
    }
414565
public void scheduleAt(final org.easybatch.core.job.Job job, final Date startTime) throws JobSchedulerException {
        checkNotNull(job, "job");
        checkNotNull(startTime, "startTime");

        String name = job.getName();
        String jobName = JOB_NAME_PREFIX + name;
        String triggerName = TRIGGER_NAME_PREFIX + name;

        Trigger trigger = newTrigger()
                .withIdentity(triggerName)
                .startAt(startTime)
                .forJob(jobName)
                .build();

        JobDetail jobDetail = getJobDetail(job, jobName);

        try {
            LOGGER.info("Scheduling job ''{}'' to start at {}", name, startTime);
            scheduler.scheduleJob(jobDetail, trigger);
        } catch (SchedulerException e) {
            throw new JobSchedulerException(format("Unable to schedule job '%s'", name), e);
        }
    }
759630
public void unschedule(final org.easybatch.core.job.Job job) throws JobSchedulerException {
        String jobName = job.getName();
        LOGGER.info("Unscheduling job ''{}'' ", jobName);
        try {
            scheduler.unscheduleJob(TriggerKey.triggerKey(TRIGGER_NAME_PREFIX + jobName));
        } catch (SchedulerException e) {
            throw new JobSchedulerException(format("Unable to unschedule job '%s'", jobName), e);
        }
    }
962584
@Override
  public Trigger getTrigger(String triggerKey) throws SchedulerException {

    validateState();

    return quartzSchedulerResources.getJobStore().retrieveTrigger(triggerKey);
  }
711886
@SuppressWarnings("unchecked")
    public List<io.mangoo.models.Job> getAllJobs() throws MangooSchedulerException {
        Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
        
        List<io.mangoo.models.Job> jobs = new ArrayList<>();
        try {
            for (JobKey jobKey : getAllJobKeys()) {
                List<Trigger> triggers = (List<Trigger>) this.quartzScheduler.getTriggersOfJob(jobKey);
                Trigger trigger = triggers.get(0);  
                TriggerState triggerState = quartzScheduler.getTriggerState(trigger.getKey());
                boolean active = (TriggerState.NORMAL == triggerState) ? true : false;
                jobs.add(new io.mangoo.models.Job(active, jobKey.getName(), trigger.getDescription(), trigger.getNextFireTime(), trigger.getPreviousFireTime()));
            }
        } catch (SchedulerException e) {
            throw new MangooSchedulerException(e);
        }
        
        return jobs;
    }
777287
public boolean deleteJob (final JobKey jobKey) throws SchedulerException
  {
    validateState ();

    boolean result = false;

    final ICommonsList <? extends ITrigger> triggers = getTriggersOfJob (jobKey);
    for (final ITrigger trigger : triggers)
    {
      if (!unscheduleJob (trigger.getKey ()))
      {
        final StringBuilder sb = new StringBuilder ().append ("Unable to unschedule trigger [")
                                                     .append (trigger.getKey ())
                                                     .append ("] while deleting job [")
                                                     .append (jobKey)
                                                     .append ("]");
        throw new SchedulerException (sb.toString ());
      }
      result = true;
    }

    result = m_aResources.getJobStore ().removeJob (jobKey) || result;
    if (result)
    {
      notifySchedulerThread (0L);
      notifySchedulerListenersJobDeleted (jobKey);
    }
    return result;
  }
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;
  }
1071364
public String schedule(TriggerTask task) {
        if (getCurrentScheduler() == null) {
            throw new IllegalStateException("New scheduler should be crea");
        }
        ScheduledFuture<?> future = getCurrentScheduler().schedule(task.getRunnable(), task.getTrigger());
        String id = Schedulers.getUUID();
        runningSchedullers.put(id, future);
        Schedulers.increaseNoOfRunningSchedullers();
        setCurrentScheduler(null);
        return id;
    }
942192
public void addCalendar (final String calName,
                           final ICalendar calendar,
                           final boolean replace,
                           final boolean updateTriggers) throws SchedulerException
  {
    validateState ();

    m_aResources.getJobStore ().storeCalendar (calName, calendar, replace, updateTriggers);
  }
822890
public ICommonsList <? extends ITrigger> getTriggersOfJob (final JobKey jobKey) throws SchedulerException
  {
    validateState ();

    return m_aResources.getJobStore ().getTriggersForJob (jobKey);
  }
918874
@Override
    public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
        try {
            if (this.enterpriseConcurrentScheduler) {
                return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
            } else {
                ErrorHandler errorHandlerLocal = this.errorHandler != null ? this.errorHandler : TaskUtils
                        .getDefaultErrorHandler(true);
                return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandlerLocal).schedule();
            }
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task,
                    ex);
        }
    }
772935
public void pauseJob(String name) throws MangooSchedulerException {
        Objects.requireNonNull(name, Required.NAME.toString());
        
        try {
            JobKey jobKey = getJobKey(name);
            this.quartzScheduler.pauseJob(jobKey);
        } catch (SchedulerException | MangooSchedulerException e) {
            throw new MangooSchedulerException(e);
        }            
    }
818877
@Override
	public boolean isPaused(JobKey jobKey) throws SchedulerException {
		List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
		boolean result = true; 
		if (null != triggers && triggers.size() > 0) {
			for (Trigger trigger : triggers) {
				result = result && scheduler.getTriggerState(trigger.getKey()) == TriggerState.PAUSED;
			}
			return result;
		}
		return false;
	}
1350969
@Nonnull
  public TriggerBuilder <T> forJob (@Nonnull final IJobDetail jobDetail)
  {
    final JobKey k = jobDetail.getKey ();
    if (k.getName () == null)
      throw new IllegalArgumentException ("The given job has not yet had a name assigned to it.");
    m_aJobKey = k;
    return this;
  }
829085
@Override
  public synchronized void scheduleJob(Properties jobProps, JobListener jobListener) throws JobException {
    Map<String, Object> additionalJobDataMap = Maps.newHashMap();
    additionalJobDataMap.put(ServiceConfigKeys.GOBBLIN_SERVICE_FLOWSPEC,
        this.scheduledFlowSpecs.get(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY)));

    try {
      scheduleJob(jobProps, jobListener, additionalJobDataMap, GobblinServiceJob.class);
    } catch (Exception e) {
      throw new JobException("Failed to schedule job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
    }
  }
750040
public static DefaultJobSpecScheduleImpl createNoSchedule(JobSpec jobSpec,
                                                            Runnable jobRunnable) {
    return new DefaultJobSpecScheduleImpl(jobSpec, jobRunnable,
                                          Optional.<Long>absent());
  }
1040245
public void addJobEntry(BackupJob job)
   {
      // jobEntries
      try
      {
         JobEntryInfo info = new JobEntryInfo();
         info.setDate(Calendar.getInstance());
         info.setType(job.getType());
         info.setState(job.getState());
         info.setURL(job.getStorageURL());

         logWriter.write(info, config);
      }
      catch (IOException e)
      {
         logger.error("Can't add job", e);
      }
      catch (XMLStreamException e)
      {
         logger.error("Can't add job", e);
      }
      catch (BackupOperationException e)
      {
         logger.error("Can't add job", e);
      }
   }