/** Gets all extensions to the monitors extension point and loads their names and types. */ private static void loadSystemTypes() { String[] configNames = JAXBExtensionUtils.getConfiguationNames(); for (String name : configNames) { URL url = JAXBExtensionUtils.getConfigurationURL(name); try { ResourceManagerData data = JAXBInitializationUtils.initializeRMData(url); MonitorType monitorType = data.getMonitorData(); if (monitorType != null) { String type = monitorType.getSchedulerType(); if (type != null) { fSystemTypesByConfigName.put(name, type); } } } catch (Exception e) { // Ignore } } }
/** * Gets all extensions to the monitors extension point and loads their names and default layouts. * Stores them in the map fSystemLayoutByConfigName. */ private static void loadSystemLayouts() { String[] configNames = JAXBExtensionUtils.getConfiguationNames(); // Use JAXB marshaller to convert JAXB object back to XML data, which is sent to LML_DA JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(RMXSDJAXBPackage); } catch (JAXBException e1) { e1.printStackTrace(); return; } Marshaller marshaller; try { marshaller = jaxbContext.createMarshaller(); } catch (JAXBException e1) { e1.printStackTrace(); return; } for (String name : configNames) { URL url = JAXBExtensionUtils.getConfigurationURL(name); try { ResourceManagerData data = JAXBInitializationUtils.initializeRMData(url); MonitorType monitorType = data.getMonitorData(); if (monitorType != null) { // Check if there is a layout existant if (monitorType.getLayout() != null) { final StringWriter sw = new StringWriter(); QName qname = new QName(LMLNamespace, LocalPartOfLMLLayout, LMLPrefix); JAXBElement<LayoutRoot> jaxbEl = new JAXBElement<LayoutRoot>(qname, LayoutRoot.class, monitorType.getLayout()); marshaller.marshal(jaxbEl, sw); fSystemLayoutByConfigName.put(name, sw.toString()); } } } catch (Exception e) { // Ignore } } }