1 17 18 21 package org.quartz.xml; 22 23 import org.quartz.Calendar; 24 25 30 public class CalendarBundle implements Calendar { 31 static final long serialVersionUID = 6970348562827644914L; 32 33 40 41 protected String calendarName; 42 43 protected String className; 44 45 protected Calendar calendar; 46 47 protected boolean replace; 48 49 56 57 public CalendarBundle() { 58 } 59 60 67 68 public String getCalendarName() { 69 return calendarName; 70 } 71 72 public void setCalendarName(String calendarName) { 73 this.calendarName = calendarName; 74 } 75 76 public String getClassName() { 77 return className; 78 } 79 80 public void setClassName(String className) 81 throws ClassNotFoundException , InstantiationException , IllegalAccessException { 82 this.className = className; 83 createCalendar(); 84 } 85 86 public Calendar getCalendar() { 87 return calendar; 88 } 89 90 public void setCalendar(Calendar calendar) { 91 this.calendar = calendar; 92 } 93 94 public boolean getReplace() { 95 return replace; 96 } 97 98 public void setReplace(boolean replace) { 99 this.replace = replace; 100 } 101 102 public Calendar getBaseCalendar() { 103 return calendar.getBaseCalendar(); 104 } 105 106 public void setBaseCalendar(Calendar baseCalendar) { 107 if (baseCalendar instanceof CalendarBundle) { 108 baseCalendar = ((CalendarBundle)baseCalendar).getCalendar(); 109 } 110 calendar.setBaseCalendar(baseCalendar); 111 } 112 113 public String getDescription() { 114 return calendar.getDescription(); 115 } 116 117 public void setDescription(String description) { 118 calendar.setDescription(description); 119 } 120 121 public boolean isTimeIncluded(long timeStamp) { 122 return calendar.isTimeIncluded(timeStamp); 123 } 124 125 public long getNextIncludedTime(long timeStamp) { 126 return calendar.getNextIncludedTime(timeStamp); 127 } 128 129 protected void createCalendar() 130 throws ClassNotFoundException , InstantiationException , IllegalAccessException { 131 Class clazz = Thread.currentThread().getContextClassLoader().loadClass(getClassName()); 132 setCalendar((Calendar)clazz.newInstance()); 133 } 134 } 135 | Popular Tags |