예제 #1
0
 @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);
   }
 }
예제 #2
0
 @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);
   }
 }