use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class SchedulerAdapter method jobDataMapToXmlBuilder.
public XmlBuilder jobDataMapToXmlBuilder(Scheduler theScheduler, String jobName, String groupName) {
XmlBuilder xbRoot = new XmlBuilder("jobDataMap");
try {
JobDataMap jd = theScheduler.getJobDetail(jobName, groupName).getJobDataMap();
xbRoot.addAttribute("containsTransientData", (jd.containsTransientData() ? "True" : "False"));
xbRoot.addAttribute("allowsTransientData", (jd.getAllowsTransientData() ? "True" : "False"));
xbRoot.addAttribute("jobName", jobName);
xbRoot.addAttribute("groupName", groupName);
String[] keys = jd.getKeys();
for (int i = 0; i < keys.length; i++) {
String name = keys[i];
String value = "";
if (jd.get(keys[i]) != null) {
value = jd.get(keys[i]).toString();
}
Object obj = jd.get(keys[i]);
XmlBuilder ds = new XmlBuilder("property");
ds.addAttribute("key", name);
if (obj != null) {
ds.addAttribute("className", obj.getClass().getName());
} else
ds.addAttribute("className", "null");
ds.setValue(value);
xbRoot.addSubElement(ds);
}
} catch (org.quartz.SchedulerException se) {
log.error(se);
}
return xbRoot;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class SchedulerAdapter method triggerToXmlBuilder.
public XmlBuilder triggerToXmlBuilder(Scheduler theScheduler, String triggerName, String groupName) {
XmlBuilder xbRoot = new XmlBuilder("triggerDetail");
try {
Trigger trigger = theScheduler.getTrigger(triggerName, groupName);
xbRoot.addAttribute("fullName", trigger.getFullName());
xbRoot.addAttribute("triggerName", trigger.getName());
xbRoot.addAttribute("triggerGroup", trigger.getGroup());
String cn = trigger.getCalendarName();
xbRoot.addAttribute("calendarName", (cn == null ? "none" : cn));
Date date;
try {
date = trigger.getEndTime();
xbRoot.addAttribute("endTime", (null == date ? "" : DateUtils.format(date, DateUtils.FORMAT_GENERICDATETIME)));
} catch (Exception e) {
log.debug(e);
}
;
try {
date = trigger.getFinalFireTime();
xbRoot.addAttribute("finalFireTime", (null == date ? "" : DateUtils.format(date, DateUtils.FORMAT_GENERICDATETIME)));
} catch (Exception e) {
log.debug(e);
}
;
try {
date = trigger.getPreviousFireTime();
xbRoot.addAttribute("previousFireTime", (null == date ? "" : DateUtils.format(date, DateUtils.FORMAT_GENERICDATETIME)));
} catch (Exception e) {
log.debug(e);
}
;
try {
date = trigger.getNextFireTime();
xbRoot.addAttribute("nextFireTime", (null == date ? "" : DateUtils.format(date, DateUtils.FORMAT_GENERICDATETIME)));
} catch (Exception e) {
log.debug(e);
}
;
try {
date = trigger.getStartTime();
xbRoot.addAttribute("startTime", (null == date ? "" : DateUtils.format(date, DateUtils.FORMAT_GENERICDATETIME)));
} catch (Exception e) {
log.debug(e);
}
;
xbRoot.addAttribute("misfireInstruction", Integer.toString(trigger.getMisfireInstruction()));
if (trigger instanceof CronTrigger) {
xbRoot.addAttribute("triggerType", "cron");
xbRoot.addAttribute("cronExpression", ((CronTrigger) trigger).getCronExpression());
} else if (trigger instanceof SimpleTrigger) {
xbRoot.addAttribute("triggerType", "simple");
xbRoot.addAttribute("repeatInterval", ((SimpleTrigger) trigger).getRepeatInterval());
} else {
xbRoot.addAttribute("triggerType", "unknown");
}
xbRoot.addAttribute("jobGroup", trigger.getJobGroup());
xbRoot.addAttribute("jobName", trigger.getJobName());
xbRoot.addAttribute("isVolatile", (trigger.isVolatile() ? "True" : "False"));
} catch (SchedulerException se) {
log.error(se);
}
return xbRoot;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class SchedulerAdapter method getJobTriggers.
public XmlBuilder getJobTriggers(Scheduler theScheduler, String jobName, String groupName) {
XmlBuilder xbRoot = new XmlBuilder("triggersForJob");
xbRoot.addAttribute("jobName", jobName);
xbRoot.addAttribute("groupName", groupName);
try {
String[] tgnames = theScheduler.getTriggerGroupNames();
for (int i = 0; i < tgnames.length; i++) {
String[] triggerNames = theScheduler.getTriggerNames(tgnames[i]);
for (int s = 0; s < triggerNames.length; s++) {
Trigger trigger = theScheduler.getTrigger(triggerNames[s], tgnames[i]);
if ((trigger.getJobName().equals(jobName)) && (trigger.getJobGroup().equals(groupName))) {
XmlBuilder tr = triggerToXmlBuilder(theScheduler, triggerNames[s], tgnames[i]);
xbRoot.addSubElement(tr);
}
}
}
} catch (org.quartz.SchedulerException se) {
log.error(se);
}
return xbRoot;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class PercentileEstimatorBase method getSample.
public XmlBuilder getSample(int index, long count, long min, long max) {
XmlBuilder sample = new XmlBuilder("sample");
sample.addAttribute("percentile", "" + (100 * index) / values.length);
sample.addAttribute("value", "" + values[index]);
return sample;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class PercentileEstimatorRanked method getSample.
public XmlBuilder getSample(int index, long count, long min, long max) {
long value;
long rank;
if (index <= 0) {
value = min;
rank = 1;
} else {
if (index >= local_count + 1) {
value = max;
rank = count;
} else {
value = values[index - 1];
rank = ranks[index - 1];
}
}
XmlBuilder sample = new XmlBuilder("sample");
sample.addAttribute("value", "" + value);
sample.addAttribute("rank", "" + rank);
sample.addAttribute("percentile", "" + ((100 * rank) - 50) / count);
return sample;
}
Aggregations