tdcommon/src/main/java/thredds/featurecollection/CollectionUpdater.java
public void scheduleTasks(FeatureCollectionConfig config, Logger logger) {
    if (disabled || failed) return;
    if (logger == null) logger = fcLogger;

    FeatureCollectionConfig.UpdateConfig updateConfig = (isTdm) ? config.tdmConfig : config.updateConfig;
    if (updateConfig == null || updateConfig.updateType == CollectionUpdateType.never) return;

    String collectionName = config.getCollectionName();

    // prob dont need to set a job if theres no chron job ?

    // Job to update the collection
    org.quartz.JobDataMap map = new org.quartz.JobDataMap();
    map.put(EVENT_BUS, eventBus);
    map.put(COLLECTION_NAME, collectionName);
    map.put(LOGGER, logger);
    JobDetail updateJob = JobBuilder.newJob(UpdateCollectionJob.class)
            .withIdentity(collectionName, "UpdateCollection")
            .storeDurably()
            .usingJobData(map)
            .build();

    try {
      if(!scheduler.checkExists(updateJob.getKey())) {
      	scheduler.addJob(updateJob, false);
      } else {
        logger.warn("scheduler failed to add updateJob for " + updateJob.getKey() +". Another Job exists with that identification." );
      }
    } catch (Throwable e) {
      logger.error("scheduler failed to add updateJob for " + config, e);
      return;
    }

    // task to run the job on startup
    if (updateConfig.startupType != CollectionUpdateType.never) {
      map = new org.quartz.JobDataMap();
      map.put(UpdateType, updateConfig.startupType);
      map.put(Source, "startup");
      Date runTime = new Date(new Date().getTime() + startupWait); // wait startupWait before trigger
      SimpleTrigger startupTrigger = (SimpleTrigger) TriggerBuilder.newTrigger()
              .withIdentity(collectionName, "startup")
              .startAt(runTime)
              .forJob(updateJob)
              .usingJobData(map)
              .build();

      try {
        scheduler.scheduleJob(startupTrigger);
        logger.info("scheduleJob startup scan force={} for '{}' at {}", updateConfig.startupType.toString(), config.collectionName, runTime);
      } catch (Throwable e) {
        logger.error("scheduleJob failed to schedule startup Job for " + config, e);
        return;
      }
    }

    // task to run the job periodically, with rescan
    if (updateConfig.rescan != null) {
        map = new org.quartz.JobDataMap();
        map.put(UpdateType, updateConfig.updateType);
        map.put(Source, "rescan");
        CronTrigger rescanTrigger = TriggerBuilder.newTrigger()
                .withIdentity(collectionName, "rescan")
                .withSchedule(CronScheduleBuilder.cronSchedule(updateConfig.rescan))
                .forJob(updateJob)
                .usingJobData(map)
                .build();

      try {
    		scheduler.scheduleJob(rescanTrigger);
        logger.info("scheduleJob recurring scan for '{}' cronExpr={}", config.collectionName, updateConfig.rescan);
      } catch (Throwable e) {
        logger.error("scheduleJob failed to schedule cron Job", e);
        // e.printStackTrace();
      }
    }

    /* updating the proto dataset
    FeatureCollectionConfig.ProtoConfig pconfig = config.protoConfig;
    if (pconfig.change != null) {
      org.quartz.JobDataMap pmap = new org.quartz.JobDataMap();
      pmap.put(DCM_NAME, manager);
      map.put(LOGGER, logger);
      JobDetail protoJob = JobBuilder.newJob(ChangeProtoJob.class)
              .withIdentity(jobName, "UpdateProto")
              .usingJobData(pmap)
              .storeDurably()
              .build();

      try {
        CronTrigger protoTrigger = TriggerBuilder.newTrigger()
                .withIdentity(jobName, "rereadProto")
                .withSchedule(CronScheduleBuilder.cronSchedule(pconfig.change))
                .build();
        scheduler.scheduleJob(protoJob, protoTrigger);
        if (logger != null)logger.info("Schedule proto update for '{}' cronExpr={}", config.collectionName, pconfig.change);

      } catch (Throwable e) {
        if (logger != null)logger.error("cronExecutor failed to schedule RereadProtoJob", e);
        // e.printStackTrace();
      }
    } */

  }
public void scheduleTasks(FeatureCollectionConfig config, Logger logger) {
    if (disabled || failed) return;
    if (logger == null) logger = fcLogger;

    FeatureCollectionConfig.UpdateConfig updateConfig = (isTdm) ? config.tdmConfig : config.updateConfig;
    if (updateConfig == null || updateConfig.updateType == CollectionUpdateType.never) return;

    String collectionName = config.getCollectionName();

    // prob dont need to set a job if theres no chron job ?

    // Job to update the collection
    org.quartz.JobDataMap map = new org.quartz.JobDataMap();
    map.put(EVENT_BUS, eventBus);
    map.put(COLLECTION_NAME, collectionName);
    map.put(LOGGER, logger);
    JobDetail updateJob = JobBuilder.newJob(UpdateCollectionJob.class)
            .withIdentity(collectionName, "UpdateCollection")
            .storeDurably()
            .usingJobData(map)
            .build();

    try {
      if(!scheduler.checkExists(updateJob.getKey())) {
      	scheduler.addJob(updateJob, false);
      } else {
        logger.warn("scheduler failed to add updateJob for " + updateJob.getKey() +". Another Job exists with that identification." );
      }
    } catch (Throwable e) {
      logger.error("scheduler failed to add updateJob for " + config, e);
      return;
    }

    // task to run the job on startup
    if (updateConfig.startupType != CollectionUpdateType.never) {
      map = new org.quartz.JobDataMap();
      map.put(UpdateType, updateConfig.startupType);
      map.put(Source, "startup");
      Date runTime = new Date(new Date().getTime() + startupWait); // wait startupWait before trigger
      SimpleTrigger startupTrigger = (SimpleTrigger) TriggerBuilder.newTrigger()
              .withIdentity(collectionName, "startup")
              .startAt(runTime)
              .forJob(updateJob)
              .usingJobData(map)
              .build();

      try {
        scheduler.scheduleJob(startupTrigger);
        logger.info("scheduleJob startup scan force={} for '{}' at {}", updateConfig.startupType.toString(), config.collectionName, runTime);
      } catch (Throwable e) {
        logger.error("scheduleJob failed to schedule startup Job for " + config, e);
        return;
      }
    }

    // task to run the job periodically, with rescan
    if (updateConfig.rescan != null) {
        map = new org.quartz.JobDataMap();
        map.put(UpdateType, updateConfig.updateType);
        map.put(Source, "rescan");
        CronTrigger rescanTrigger = TriggerBuilder.newTrigger()
                .withIdentity(collectionName, "rescan")
                .withSchedule(CronScheduleBuilder.cronSchedule(updateConfig.rescan))
                .forJob(updateJob)
                .usingJobData(map)
                .build();

      try {
    		scheduler.scheduleJob(rescanTrigger);
        logger.info("scheduleJob recurring scan for '{}' cronExpr={}", config.collectionName, updateConfig.rescan);
      } catch (Throwable e) {
        logger.error("scheduleJob failed to schedule cron Job", e);
        // e.printStackTrace();
      }
    }

    /* updating the proto dataset
    FeatureCollectionConfig.ProtoConfig pconfig = config.protoConfig;
    if (pconfig.change != null) {
      org.quartz.JobDataMap pmap = new org.quartz.JobDataMap();
      pmap.put(DCM_NAME, manager);
      map.put(LOGGER, logger);
      JobDetail protoJob = JobBuilder.newJob(ChangeProtoJob.class)
              .withIdentity(jobName, "UpdateProto")
              .usingJobData(pmap)
              .storeDurably()
              .build();

      try {
        CronTrigger protoTrigger = TriggerBuilder.newTrigger()
                .withIdentity(jobName, "rereadProto")
                .withSchedule(CronScheduleBuilder.cronSchedule(pconfig.change))
                .build();
        scheduler.scheduleJob(protoJob, protoTrigger);
        if (logger != null)logger.info("Schedule proto update for '{}' cronExpr={}", config.collectionName, pconfig.change);

      } catch (Throwable e) {
        if (logger != null)logger.error("cronExecutor failed to schedule RereadProtoJob", e);
        // e.printStackTrace();
      }
    } */

  }
public void scheduleTasks ( FeatureCollectionConfig config , Logger logger ) { if ( disabled || failed ) return ; if ( logger == null ) logger = fcLogger ; FeatureCollectionConfig . UpdateConfig updateConfig = ( isTdm ) ? config . tdmConfig : config . updateConfig ; if ( updateConfig == null || updateConfig . updateType == CollectionUpdateType . never ) return ; String collectionName = config . getCollectionName ( ) ; // prob dont need to set a job if theres no chron job ? // Job to update the collection org . quartz . JobDataMap map = new org . quartz . JobDataMap ( ) ; map . put ( EVENT_BUS , eventBus ) ; map . put ( COLLECTION_NAME , collectionName ) ; map . put ( LOGGER , logger ) ; JobDetail updateJob = JobBuilder . newJob ( UpdateCollectionJob . class ) . withIdentity ( collectionName , "UpdateCollection" ) . storeDurably ( ) . usingJobData ( map ) . build ( ) ; try { if ( ! scheduler . checkExists ( updateJob . getKey ( ) ) ) { scheduler . addJob ( updateJob , false ) ; } else { logger . warn ( "scheduler failed to add updateJob for " + updateJob . getKey ( ) + ". Another Job exists with that identification." ) ; } } catch ( Throwable e ) { logger . error ( "scheduler failed to add updateJob for " + config , e ) ; return ; } // task to run the job on startup if ( updateConfig . startupType != CollectionUpdateType . never ) { map = new org . quartz . JobDataMap ( ) ; map . put ( UpdateType , updateConfig . startupType ) ; map . put ( Source , "startup" ) ; Date runTime = new Date ( new Date ( ) . getTime ( ) + startupWait ) ; // wait startupWait before trigger SimpleTrigger startupTrigger = ( SimpleTrigger ) TriggerBuilder . newTrigger ( ) . withIdentity ( collectionName , "startup" ) . startAt ( runTime ) . forJob ( updateJob ) . usingJobData ( map ) . build ( ) ; try { scheduler . scheduleJob ( startupTrigger ) ; logger . info ( "scheduleJob startup scan force={} for '{}' at {}" , updateConfig . startupType . toString ( ) , config . collectionName , runTime ) ; } catch ( Throwable e ) { logger . error ( "scheduleJob failed to schedule startup Job for " + config , e ) ; return ; } } // task to run the job periodically, with rescan if ( updateConfig . rescan != null ) { map = new org . quartz . JobDataMap ( ) ; map . put ( UpdateType , updateConfig . updateType ) ; map . put ( Source , "rescan" ) ; CronTrigger rescanTrigger = TriggerBuilder . newTrigger ( ) . withIdentity ( collectionName , "rescan" ) . withSchedule ( CronScheduleBuilder . cronSchedule ( updateConfig . rescan ) ) . forJob ( updateJob ) . usingJobData ( map ) . build ( ) ; try { scheduler . scheduleJob ( rescanTrigger ) ; logger . info ( "scheduleJob recurring scan for '{}' cronExpr={}" , config . collectionName , updateConfig . rescan ) ; } catch ( Throwable e ) { logger . error ( "scheduleJob failed to schedule cron Job" , e ) ; // e.printStackTrace(); } } /* updating the proto dataset
    FeatureCollectionConfig.ProtoConfig pconfig = config.protoConfig;
    if (pconfig.change != null) {
      org.quartz.JobDataMap pmap = new org.quartz.JobDataMap();
      pmap.put(DCM_NAME, manager);
      map.put(LOGGER, logger);
      JobDetail protoJob = JobBuilder.newJob(ChangeProtoJob.class)
              .withIdentity(jobName, "UpdateProto")
              .usingJobData(pmap)
              .storeDurably()
              .build();

      try {
        CronTrigger protoTrigger = TriggerBuilder.newTrigger()
                .withIdentity(jobName, "rereadProto")
                .withSchedule(CronScheduleBuilder.cronSchedule(pconfig.change))
                .build();
        scheduler.scheduleJob(protoJob, protoTrigger);
        if (logger != null)logger.info("Schedule proto update for '{}' cronExpr={}", config.collectionName, pconfig.change);

      } catch (Throwable e) {
        if (logger != null)logger.error("cronExecutor failed to schedule RereadProtoJob", e);
        // e.printStackTrace();
      }
    } */ }
Look at config and decide if tasks need to be started
Look at config and decide if tasks need to be started