dayofmonthi++)
for (int houri = 0; houri < hourSize; houri++)
for (int minutei = 0; minutei < minuteSize; minutei++) {
for (int secondi = 0; secondi < secondSize; secondi++) {
try {
alarmEntryArray[totali] = new AlarmEntry(second[secondi],
minute[minutei], hour[houri], dayofmonth[dayofmonthi],
month[monthi], dayofweek[dayofweeki], year[yeari],timeZoneStr,
myAlarmListener);
mgr.addAlarm(alarmEntryArray[totali]);
}
catch (PastDateException e) {
// Make log entry.
msgEntry.setAppContext(
"JcronWatchManager -- set up alarm").setDocInfo(null);
msgEntry.setMessageText("PastDateException");
msgEntry.setError("PastDateException - ignore on startup of Xmultra");
logger.logWarning(msgEntry);
}
catch (InvalidTimeZoneException e) {
// Make log entry.
msgEntry.setAppContext(
"JcronWatchManager -- set up alarm").setDocInfo(null);
msgEntry.setMessageText("Invalid TimeZone.");
msgEntry.setError(e.getMessage());
logger.logWarning(msgEntry);
return false;
}
totali++;
}
} // end of for
} // end of each cronAlarm
} else if (identityNodeName.equals(XmultraConfig.RELATIVE_JCRON_ALARM)) { // Relative case
int delaySeconds = 0;
String intervalValueString = null;
String isRepetitiveString = null;
isRepetitiveString = xmlParseUtils.getAttributeValueFromNode(
alarmNodeList.item(0), XmultraConfig.REPETITIVE_ATTRIBUTE);
// Get the list of interval nodes
NodeList intervalNodeList = alarmNodeList.item(0).getChildNodes();
// Tranverse the node list
for (int i = 0; i < intervalNodeList.getLength(); i++) {
Node intervalNode = intervalNodeList.item(i);
// Get attributes for the interval node
intervalValueString = xmlParseUtils.getAttributeValueFromNode(
intervalNode, XmultraConfig.VALUE_ATTRIBUTE);
// Get the hour interval
if (intervalNode.getNodeName().equals(XmultraConfig.HOUR_INTERVAL)) {
try {
delaySeconds += Integer.parseInt(intervalValueString) *
XmultraConfig.SECONDS_PER_HOUR;
} catch (NumberFormatException e) {
logInitWarningMessage(
"HourInterval element, Value attribute has value: " +
intervalValueString + ". Must be integer.");
return false;
}
// Get the day interval
} else if (intervalNode.getNodeName().equals(XmultraConfig.DAY_INTERVAL)) {
try {
delaySeconds += Integer.parseInt(intervalValueString) *
XmultraConfig.SECONDS_PER_DAY;
} catch (NumberFormatException e) {
logInitWarningMessage(
"DayInterval element, Value attribute has value: " +
intervalValueString + ". Must be integer.");
return false;
}
// Get the minute interval
} else if (intervalNode.getNodeName().equals(XmultraConfig.MINUTE_INTERVAL)) {
try {
delaySeconds += Integer.parseInt(intervalValueString) *
XmultraConfig.SECONDS_PER_MINUTE;
} catch (NumberFormatException e) {
logInitWarningMessage(
"MinuteInterval element, Value attribute has value: " +
intervalValueString + ". Must be integer.");
return false;
}
// Get the second interval
} else {
try {
delaySeconds += Integer.parseInt(intervalValueString);
} catch (NumberFormatException e) {
logInitWarningMessage(
"SecondInterval element, Value attribute has value: " +
intervalValueString + ". Must be integer.");
return false;
}
}
}
// Set the alarm for the second interval
if (isRepetitiveString == null || isRepetitiveString.equalsIgnoreCase("yes")) {
isRepetitiveString = "true";
} else {
isRepetitiveString = "false";
}
try {
AlarmEntry cronAlarmEntry = new AlarmEntry(
delaySeconds, Boolean.valueOf(isRepetitiveString).booleanValue(),
myAlarmListener);
mgr.addAlarm(cronAlarmEntry);
} catch (PastDateException e) {
// Make log entry.