@Override public void read(InputStream in) throws IllegalArgumentException { try { Unmarshaller unMarsh = org.orbisgis.coremap.map.JaxbContainer.JAXBCONTEXT.createUnmarshaller(); JAXBElement<OWSContextType> importedOwsContextType = (JAXBElement<OWSContextType>) unMarsh.unmarshal(in); setJAXBObject(importedOwsContextType.getValue()); } catch (JAXBException ex) { throw new IllegalArgumentException(I18N.tr("Unable to read the provided map context"), ex); } }
@Override public void write(OutputStream out) { ObjectFactory owsFactory = new ObjectFactory(); try { JAXBElement<OWSContextType> exportedOwsContextType = owsFactory.createOWSContext(getJAXBObject()); Marshaller marshaller = org.orbisgis.coremap.map.JaxbContainer.JAXBCONTEXT.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE); marshaller.marshal(exportedOwsContextType, out); } catch (JAXBException ex) { throw new IllegalArgumentException( I18N.tr("Error raised while exporting the map context"), ex); } }