Package org.quartz

Examples of org.quartz.JobDetail


                "Message Forwarding Processor view", getName());
    }

    @Override
    protected JobDetail getJobDetail() {
        JobDetail jobDetail = new JobDetail();
        jobDetail.setName(name + "-forward job");
        jobDetail.setJobClass(ForwardingJob.class);
        return jobDetail;
    }
View Full Code Here


  
   private void startSchedule(Scheduler sched, String name, CronData data) throws XmlBlasterException {
      try {
         log.info("Starting scheduler " + data.toString());
         Class clazz = Class.forName(data.getCommand());
         JobDetail jobDetail = new JobDetail(name, null, clazz);
         Object obj = global.getObjectEntry(ORIGINAL_ENGINE_GLOBAL);
         if (obj != null)
            jobDetail.getJobDataMap().put(ORIGINAL_ENGINE_GLOBAL, obj);
         else
            throw new XmlBlasterException(global, ErrorCode.INTERNAL, "SchedulerPlugin.doInit", "Could not find the ServerScope");
         String triggerName = name;
         Trigger trigger = null;
        
         if (data.getMonth() > -1)
            throw new XmlBlasterException(global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "Yearly Events are not implemented");

         int dayOfMonth = data.getDayOfMonth();
         int hour = data.getHour();
         int min = data.getMin();
         if (dayOfMonth > -1) { // monthly trigger
            if (hour < 0)
               throw new XmlBlasterException(this.global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "On monthly triggers the hour must be specified");
            if (min < 0)
               throw new XmlBlasterException(this.global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "On monthly triggers the min must be specified");
            trigger = TriggerUtils.makeMonthlyTrigger(triggerName, dayOfMonth, hour, min);
            trigger.setStartTime(new Date())// start now
         }
         else {
            int dayOfWeek = data.getDayOfWeek();
            if (dayOfWeek > -1) {
               if (hour < 0)
                  throw new XmlBlasterException(this.global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "On weekly triggers the hour must be specified");
               if (min < 0)
                  throw new XmlBlasterException(this.global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "On weekly triggers the min must be specified");
               trigger = TriggerUtils.makeWeeklyTrigger(triggerName, dayOfWeek+1, hour, min);
               trigger.setStartTime(new Date())// start now
            }
            else {
               if (hour > -1) {
                  if (min < 0)
                     throw new XmlBlasterException(this.global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "On daily triggers the min must be specified");
                  trigger = TriggerUtils.makeDailyTrigger(triggerName, hour, min);
                  trigger.setStartTime(new Date())// start now
               }
               else {
                  if (min > -1) {
                     trigger = TriggerUtils.makeHourlyTrigger(1);
                     trigger.setName(triggerName);
                     Date startTime = TriggerUtils.getNextGivenMinuteDate(new Date(), min);
                     trigger.setStartTime(startTime);
                  }
                  else {
                     throw new XmlBlasterException(global, ErrorCode.USER_CONFIGURATION, "SchedulerPlugin.doInit", "No time has been specified in the configuration");
                  }
               }
              
            }
         }
         String[] args = data.getArguments();
         for (int i=0; i < args.length; i++)
            jobDetail.getJobDataMap().put("arg" + i, args[i]);
         sched.scheduleJob(jobDetail, trigger);
         cronDataMap.put(name, data);
      }
      catch (ClassNotFoundException ex) {
         throw new XmlBlasterException(this.global, ErrorCode.RESOURCE, "", "SchedulerPlugin.doInit", ex);
View Full Code Here

        // Get Scheduler on the quartz component
        Scheduler scheduler = quartzComponent.getScheduler();

        // Get detail
        JobDetail jobDetail = null;
        try {
            jobDetail = scheduler.getJobDetail(jobName, groupName);
        } catch (SchedulerException e) {
            throw new EJBException("Cannot get the jobDetail for the jobName '" + jobName + "'.", e);
        }
View Full Code Here

        if (jobNames != null) {
            // For each job name
            for (String jobName : jobNames) {

                // Get detail
                JobDetail jobDetail = null;
                try {
                    jobDetail = this.scheduler.getJobDetail(jobName, getJobDetailGroupName());
                } catch (SchedulerException e) {
                    throw new EJBException("Cannot get the jobDetail for the jobName '" + jobName + "'.", e);
                }
View Full Code Here

      if (tmpMe instanceof StatefulJob) clazz = StatefulQuartzJob.class;
      tmpMe.release();

      try
      {
         JobDetail jobDetail = new JobDetail(quartzSpec.getJobName(), quartzSpec.getJobGroup(), clazz, true, false, false);
         jobDetail.getJobDataMap().setAllowsTransientData(true);
         jobDetail.getJobDataMap().put("endpointFactory", endpointFactory);
         log.debug("adding job: " + quartzSpec);
         CronTrigger trigger = new CronTrigger(quartzSpec.getTriggerName(), quartzSpec.getTriggerGroup(), quartzSpec.getCronTrigger());
         sched.scheduleJob(jobDetail, trigger);
      }
      catch (Exception e)
View Full Code Here

    log4JLogger.addAppender(writerAppender);
    updateLogViewFromWriter();
    // Add job to read from the string writer every second
    try {
      jobName = "Log_Displayer_Job_" + this.hashCode();
      jobDetail = new JobDetail(jobName, LOG_DISPLAYER_GROUP, NoOpJob.class);
      jobDetail.addJobListener(jobName);
      CronTrigger trigger = new CronTrigger();
      trigger.setName(jobName);
      trigger.setGroup(LOG_DISPLAYER_GROUP);
      trigger.setCronExpression("* * * * * ?");
 
View Full Code Here

        } catch (SchedulerException e) {
          log_.warn("refreshUIState: Got a SchedulerException while asking for the updateStatisticsTrigger's state", e);
        }
      }
      CronTriggerBean triggerBean = (CronTriggerBean) CoreSpringFactory.getBean("updateStatisticsTrigger");
      JobDetail jobDetail = triggerBean.getJobDetail();
      enabled &= jobDetail.getName().equals("org.olat.statistics.job.enabled");
      log_.info("refreshUIState: org.olat.statistics.job.enabled check, enabled now: "+enabled);
      cronExpression = triggerBean.getCronExpression();
      StatisticUpdateManager statisticUpdateManager = getStatisticUpdateManager();
      if (statisticUpdateManager==null) {
        log_.info("refreshUIState: statisticUpdateManager not configured");
View Full Code Here

    // create a crontrigger inside because cron expression is random generated -> this can not be done by config? REVIEW:gs:
    Scheduler scheduler = (Scheduler) CoreSpringFactory.getBean("schedulerFactoryBean");
    String cronExpression = "ERROR";
    try {
      // Create job with cron trigger configuration
      JobDetail jobDetail = new JobDetail(SCHEDULER_NAME, Scheduler.DEFAULT_GROUP, SystemRegistrationJob.class);
      CronTrigger trigger = new CronTrigger();
      trigger.setName("system_registration_trigger");
      cronExpression = persitedProperties.getStringPropertyValue(CONF_KEY_REGISTRATION_CRON, true);
      if (!CronExpression.isValidExpression(cronExpression)) {
        cronExpression = createCronTriggerExpression();
View Full Code Here

    //FIXME: move this to spring and add a delay otherwise the job may accesses the database and the database it not yet ready, see examples in spring with jobs
    // Use scheduler from spring config
    Scheduler scheduler = (Scheduler) CoreSpringFactory.getBean("schedulerFactoryBean");
    try {
      // Create job with cron trigger configuration
      JobDetail jobDetail = new JobDetail("LDAP_Cron_Syncer_Job", Scheduler.DEFAULT_GROUP, LDAPUserSynchronizerJob.class);
      CronTrigger trigger = new CronTrigger();
      trigger.setName("LDAP_Cron_Syncer_Trigger");
      trigger.setCronExpression(ldapSyncCronSyncExpression);
      // Schedule job now
      scheduler.scheduleJob(jobDetail, trigger);
View Full Code Here

  void captureScreenStart(){
    try {
     
      System.err.println("captureScreenStart");
     
      JobDetail jobDetail = new JobDetail(ConnectionBean.quartzScreenJobName, Scheduler.DEFAULT_GROUP, ScreenJob.class);
     
      Trigger trigger = TriggerUtils.makeSecondlyTrigger(ConnectionBean.intervallSeconds);
      trigger.setStartTime(new Date());
      trigger.setName("myTrigger");
     
View Full Code Here

TOP

Related Classes of org.quartz.JobDetail

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.