if(dateNode != null && dateNode.getText() != null)
{
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm");
try
{
AlarmEntry alarmEntry = new AlarmEntry(name,sdf.parse(dateNode.getText()), alarm);
alarmEntry.setRingInNewThead();
if(log.isDebugEnabled())
log.debug("adding event: "+ alarmEntry);
alarmManager.addAlarm(alarmEntry);
}
catch (ParseException e)
{
log.warn("unparseable date format of event: " + name,e);
}
catch (PastDateException e)
{
if(log.isInfoEnabled())
log.info("ignoring old event: " + name);
}
}
}
else if(alarm != null && type.equals("DELAY"))
{
Node minuteNode = root.selectSingleNode("//events/event/minute");
if(minuteNode != null && minuteNode.getText() != null)
{
int minute = Integer.parseInt(minuteNode.getText());
try
{
AlarmEntry alarmEntry = new AlarmEntry(name,minute,true,alarm);
alarmEntry.setRingInNewThead();
if(log.isDebugEnabled())
log.debug("adding event: "+ alarmEntry);
alarmManager.addAlarm(alarmEntry);
}
catch (PastDateException e)
{
if(log.isInfoEnabled())
log.info("ignoring old event: " + name);;
}
}
}
else if(alarm != null && type.equals("CRON"))
{
//Minuten
int minutes[] = getChildEntries(element, "minute");
//Stunden
int hours[] = getChildEntries(element, "hour");
//Tag des Monats
int dayOfMonth[] = getChildEntries(element, "dayofmonth");
//Monat
int months[] = getChildEntries(element, "month");
//Tag der Woche
int dayOfWeek[] = getChildEntries(element, "dayofweek");
//Jahr
Node yearNode = root.selectSingleNode("//events/event/year");
int year = -1;
if(yearNode != null && yearNode.getText() != null)
year = Integer.parseInt(yearNode.getText());
try
{
AlarmEntry alarmEntry = new AlarmEntry(name,minutes,hours,dayOfMonth,months,dayOfWeek,year,alarm);
alarmEntry.setRingInNewThead();
if(log.isDebugEnabled())
log.debug("adding event: "+ alarmEntry);
alarmManager.addAlarm(alarmEntry);
}
catch (PastDateException e)