class SchedulerAdapter {

	public XmlBuilder jobDataMapToXmlBuilder(JobDataMap jd) {

		XmlBuilder xbRoot = new XmlBuilder("jobDataMap");
		String[] keys = jd.getKeys();

		for (int i = 0; i < keys.length; i++) {
			String name = keys[i];
			String value="";
			Object obj = jd.get(keys[i]);
			if (obj!=null) {
				value = obj.toString();
			}
			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);
		}

		return xbRoot;
	}

}