Package org.quartz.impl.calendar

Examples of org.quartz.impl.calendar.HolidayCalendar


       
        // create a calendar to exclude a particular date
        Calendar cal = Calendar.getInstance();
        cal.set(2004, Calendar.DECEMBER, 25);
       
        HolidayCalendar calendar = new HolidayCalendar();
        calendar.addExcludedDate(cal.getTime());
       
        // add to scheduler
        scheduler.addCalendar("xmasCalendar", calendar, true, false);
       
        JobDetail jobDetail = new JobDetail("messageJob",
View Full Code Here


        this.excludeUsFederalHolidays = excludeUsFederalHolidays;
      }
     
      public HolidayCalendar getHolidayCalendar ()
      {
        HolidayCalendar holidays;
       
        if (excludeWeekends) {
          WeeklyCalendar wCal = new WeeklyCalendar ();
          holidays = new HolidayCalendar (wCal);
        } else {
          holidays = new HolidayCalendar ();
        }
       
        for (Date d : additionalHolidays) {
          holidays.addExcludedDate( d );
        }
       
       
        // US Federal Holiday based on http://www.opm.gov/fedhol/
        if (excludeUsFederalHolidays) {
          java.util.Calendar hCal = java.util.Calendar.getInstance();
         
          // Year 2007
          hCal.set(2007, java.util.Calendar.JANUARY, 1); // New Year
          holidays.addExcludedDate(hCal.getTime())
          hCal.set(2007, java.util.Calendar.JANUARY, 15); // MLK
          holidays.addExcludedDate(hCal.getTime());         
          hCal.set(2007, java.util.Calendar.FEBRUARY, 19); // Washington
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.MAY, 28); // Memorial
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.JULY, 4); // Independence
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.SEPTEMBER, 3); // Labor
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.OCTOBER, 8); // Columbus
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.NOVEMBER, 12); // Veterans
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.NOVEMBER, 22); // Thanksgiving
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2007, java.util.Calendar.DECEMBER, 25); // Christmas
          holidays.addExcludedDate(hCal.getTime());
         
          // Year 2008
          hCal.set(2008, java.util.Calendar.JANUARY, 1); // New Year
          holidays.addExcludedDate(hCal.getTime())
          hCal.set(2008, java.util.Calendar.JANUARY, 21); // MLK
          holidays.addExcludedDate(hCal.getTime());         
          hCal.set(2008, java.util.Calendar.FEBRUARY, 18); // Washington
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.MAY, 26); // Memorial
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.JULY, 4); // Independence
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.SEPTEMBER, 1); // Labor
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.OCTOBER, 13); // Columbus
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.NOVEMBER, 11); // Veterans
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.NOVEMBER, 27); // Thanksgiving
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2008, java.util.Calendar.DECEMBER, 25); // Christmas
          holidays.addExcludedDate(hCal.getTime());
         
          // Year 2009
          hCal.set(2009, java.util.Calendar.JANUARY, 1); // New Year
          holidays.addExcludedDate(hCal.getTime())
          hCal.set(2009, java.util.Calendar.JANUARY, 19); // MLK
          holidays.addExcludedDate(hCal.getTime());         
          hCal.set(2009, java.util.Calendar.FEBRUARY, 16); // Washington
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.MAY, 25); // Memorial
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.JULY, 3); // Independence
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.SEPTEMBER, 7); // Labor
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.OCTOBER, 12); // Columbus
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.NOVEMBER, 11); // Veterans
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.NOVEMBER, 26); // Thanksgiving
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2009, java.util.Calendar.DECEMBER, 25); // Christmas
          holidays.addExcludedDate(hCal.getTime());
         
          // Year 2010
          hCal.set(2010, java.util.Calendar.JANUARY, 1); // New Year
          holidays.addExcludedDate(hCal.getTime())
          hCal.set(2010, java.util.Calendar.JANUARY, 18); // MLK
          holidays.addExcludedDate(hCal.getTime());         
          hCal.set(2010, java.util.Calendar.FEBRUARY, 15); // Washington
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.MAY, 31); // Memorial
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.JULY, 5); // Independence
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.SEPTEMBER, 6); // Labor
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.OCTOBER, 11); // Columbus
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.NOVEMBER, 11); // Veterans
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.NOVEMBER, 25); // Thanksgiving
          holidays.addExcludedDate(hCal.getTime());
          hCal.set(2010, java.util.Calendar.DECEMBER, 24); // Christmas
          holidays.addExcludedDate(hCal.getTime());
        }
        return holidays;
      }
View Full Code Here

    }

    public void init() throws SchedulerException {
        logger.warning("Starting scheduler service...");
        scheduler = new StdSchedulerFactory(schedulerProperties).getScheduler();
        scheduler.addCalendar(QuartzSchedulerService.class.getName(), new HolidayCalendar(), true, true);
        scheduler.getListenerManager().addJobListener(jobListener, EverythingMatcher.allJobs());
        scheduler.start();
        logger.warning("Scheduler service online!");
    }
View Full Code Here

TOP

Related Classes of org.quartz.impl.calendar.HolidayCalendar

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.