class SchedulerAdapter {

    public XmlBuilder getSchedulerMetaDataToXml(Scheduler theScheduler) {
        XmlBuilder xbRoot = new XmlBuilder("schedulerMetaData");

        try {
            SchedulerMetaData smd = theScheduler.getMetaData();

            xbRoot.addAttribute("schedulerName", smd.getSchedulerName());
            xbRoot.addAttribute("schedulerInstanceId", smd.getSchedulerInstanceId().toString());
            xbRoot.addAttribute("version", smd.getVersion());
            xbRoot.addAttribute("isPaused", smd.isInStandbyMode());
            xbRoot.addAttribute("isSchedulerRemote", smd.isSchedulerRemote());
            xbRoot.addAttribute("isShutdown", smd.isShutdown());
            xbRoot.addAttribute("isStarted", smd.isStarted());
            xbRoot.addAttribute("jobStoreSupportsPersistence", smd.isJobStoreSupportsPersistence());
            xbRoot.addAttribute("numJobsExecuted", Integer.toString(smd.getNumberOfJobsExecuted()));
            try {
                Date runningSince = smd.getRunningSince();

                xbRoot.addAttribute("runningSince", (null == runningSince ? "unknown" : DateUtils.format(runningSince, DateUtils.FORMAT_GENERICDATETIME)));
            } catch (Exception e) {
	            log.debug(e);
	        };
            xbRoot.addAttribute("jobStoreClass", smd.getJobStoreClass().getName());
            xbRoot.addAttribute("schedulerClass", smd.getSchedulerClass().getName());
            xbRoot.addAttribute("threadPoolClass", smd.getThreadPoolClass().getName());
            xbRoot.addAttribute("threadPoolSize", Integer.toString(smd.getThreadPoolSize()));
        } catch (SchedulerException se) {
            log.error(se);
        }

        return xbRoot;
    }

}