List of usage examples for javax.xml.bind JAXBException getMessage
public String getMessage()
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public List<Host> getHostsOfTesbed(String location) { Boolean exception = false;/*from w w w. j a v a 2s . c om*/ String hostsUrl = url + "/testbeds/" + location + "/hosts"; String response = getMethod(hostsUrl, null, null, exception); logger.debug("PAYLOAD: " + response); Collection collection = null; try { JAXBContext jaxbContext = JAXBContext.newInstance(Collection.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); collection = (Collection) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/testbeds/" + location + " Exception: " + e.getMessage()); exception = true; } if (collection == null) return null; return collection.getItems().getHosts(); }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public VMReport getVMReport(VM vm) { Boolean exception = false;// ww w .j av a 2 s .c o m String vmUrl = url + vm.getBonfireUrl() + "/report"; String response = getMethod(vmUrl, null, null, exception); logger.debug("PAYLOAD: " + response); VMReport vmReport = new VMReport(); try { JAXBContext jaxbContext = JAXBContext.newInstance(VMReport.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); vmReport = (VMReport) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned vm monitoring: " + url + vm.getBonfireUrl() + "/report" + " Exception: " + e.getMessage()); exception = true; } if (exception) return new VMReport(); return vmReport; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public VMMonitoring getVMMonitoringStatus(VM vm) { Boolean exception = false;// w w w.j ava 2 s . co m String vmUrl = url + getVMUrl(vm) + "/monitoring"; logger.debug(" Constructed VM Monitoring URL: " + vmUrl); String response = getMethod(vmUrl, null, null, exception); logger.debug("PAYLOAD: " + response); VMMonitoring vmMonitoring = new VMMonitoring(); try { JAXBContext jaxbContext = JAXBContext.newInstance(VMMonitoring.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); vmMonitoring = (VMMonitoring) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned vm monitoring: " + url + vm.getBonfireUrl() + "/monitoring" + " Exception: " + e.getMessage()); exception = true; } if (exception) return new VMMonitoring(); return vmMonitoring; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@SuppressWarnings("unchecked") public List<Experiment> getListOfRunningExperiments(String bonfireUserId, String bonfireGroupId) { Boolean exception = false;//from w ww . j a v a 2 s . c o m String testbedsUrl = url + "/experiments/status/" + "?status=\"running\""; String response = getMethod(testbedsUrl, null, null, exception); logger.debug("PAYLOAD: " + response); List<Experiment> experiments = new ArrayList<Experiment>(); try { JAXBContext jaxbContext = JAXBContext.newInstance(Collection.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); experiments = (List<Experiment>) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/experiments/status/?status=\"running\"" + " Exception: " + e.getMessage()); exception = true; } return experiments; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@SuppressWarnings("unchecked") public List<Experiment> getListOfRunningExperiments(String bonfireUserId, String bonfireGroupId, String status) {//from w w w.j a va 2 s . co m Boolean exception = false; String testbedsUrl = url + "/experiments//" + "?status=\"" + status + "\""; String response = getMethod(testbedsUrl, null, null, exception); logger.debug("PAYLOAD: " + response); List<Experiment> experiments = new ArrayList<Experiment>(); try { JAXBContext jaxbContext = JAXBContext.newInstance(Collection.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); experiments = (List<Experiment>) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/experiments/status/?status=\"" + status + "\"" + " Exception: " + e.getMessage()); exception = true; } return experiments; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public Host getHostOfTestbed(String location, String hostName) { Boolean exception = false;// www . java 2s . c o m String hostUrl = url + "/testbeds/" + location + "/hosts/" + hostName; String response = getMethod(hostUrl, null, null, exception); logger.debug("PAYLOAD: " + response); Host host = null; try { JAXBContext jaxbContext = JAXBContext.newInstance(Host.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); host = (Host) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/testbeds/" + location + "/hosts/" + hostName + " Exception: " + e.getMessage()); exception = true; } if (host == null) return null; return host; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public TestbedMonitoring getTestbedMonitoringStatus(Testbed testbed) { Boolean exception = false;/*from w ww.j av a2 s . c o m*/ String testbedsUrl = url + "/testbeds/" + testbed.getName() + "/monitoring"; String response = getMethod(testbedsUrl, null, null, exception); logger.debug("PAYLOAD: " + response); TestbedMonitoring testbedMonitoring = new TestbedMonitoring(); try { JAXBContext jaxbContext = JAXBContext.newInstance(TestbedMonitoring.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); testbedMonitoring = (TestbedMonitoring) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/testbeds/" + testbed.getName() + "/monitoring" + " Exception: " + e.getMessage()); exception = true; } if (exception) return new TestbedMonitoring(); return testbedMonitoring; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public ExperimentReport getExperimentReport(Experiment experiment, String bonfireUser, String bonfireGroup) { Boolean exception = false;/*from ww w .ja va2 s. c om*/ String experimentUrl = url + "/experiments/" + experiment.getId() + "/report"; String response = getMethod(experimentUrl, bonfireUser, bonfireGroup, exception); logger.debug("PAYLOAD: " + response); ExperimentReport experimentReport = new ExperimentReport(); try { JAXBContext jaxbContext = JAXBContext.newInstance(ExperimentReport.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); experimentReport = (ExperimentReport) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/experiments/" + experiment.getId() + "/report" + " Exception: " + e.getMessage()); exception = true; } if (exception) return new ExperimentReport(); return experimentReport; }
From source file:eu.eco2clouds.scheduler.accounting.client.AccountingClientHC.java
@Override public HostMonitoring getHostMonitoringStatus(Testbed testbed, String hostname) { Boolean exception = false;/*w w w. j av a2s . c om*/ String testbedsUrl = url + "/testbeds/" + testbed.getName() + "/hosts/" + hostname + "/monitoring"; String response = getMethod(testbedsUrl, null, null, exception); logger.debug("PAYLOAD: " + response); HostMonitoring hostMonitoring = new HostMonitoring(); try { JAXBContext jaxbContext = JAXBContext.newInstance(HostMonitoring.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); hostMonitoring = (HostMonitoring) jaxbUnmarshaller.unmarshal(new StringReader(response)); } catch (JAXBException e) { logger.warn("Error trying to parse returned list of testbed: " + url + "/testbeds/" + testbed.getName() + "/hosts/" + hostname + "/monitoring" + " Exception: " + e.getMessage()); exception = true; } if (exception) return new HostMonitoring(); return hostMonitoring; }
From source file:ca.phon.ipamap.IpaMap.java
/** * Load static IPA map data//from w w w . java2 s .c om * */ private static IpaGrids getGridData() { ObjectFactory factory = new ObjectFactory(); if (grids == null) { try { JAXBContext ctx = JAXBContext.newInstance(factory.getClass()); Unmarshaller unmarshaller = ctx.createUnmarshaller(); // unmarshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); grids = (IpaGrids) unmarshaller.unmarshal(IpaMap.class.getResource(GRID_FILE)); // add generated grids generateMissingGrids(grids); } catch (JAXBException e) { e.printStackTrace(); LOGGER.severe(e.getMessage()); grids = factory.createIpaGrids(); } } return grids; }