public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(outputStream, getXmlMarshaller().getEncoding()); XMLMarshaller xmlMarshaller = getXmlContext().createMarshaller(); xmlMarshaller.setMarshalListener( new SDOMarshalListener(xmlMarshaller, (SDOTypeHelper) aHelperContext.getTypeHelper())); save(xmlDocument, writer, xmlMarshaller); }
public void setMarshalCallbacks(java.util.HashMap callbacks) { if (callbacks == null || callbacks.isEmpty()) { return; } if (xmlMarshaller.getMarshalListener() == null) { xmlMarshaller.setMarshalListener(new JAXBMarshalListener(jaxbContext, this)); } ((JAXBMarshalListener) xmlMarshaller.getMarshalListener()) .setClassBasedMarshalEvents(callbacks); }
public XMLMarshaller getXmlMarshaller() { XMLMarshaller marshaller = xmlMarshallerMap.get(Thread.currentThread()); if (marshaller == null) { marshaller = getXmlContext().createMarshaller(); marshaller.setMarshalListener( new SDOMarshalListener(marshaller, (SDOTypeHelper) aHelperContext.getTypeHelper())); xmlMarshallerMap.put(Thread.currentThread(), marshaller); } XMLContext context = getXmlContext(); if (marshaller.getXMLContext() != context) { marshaller.setXMLContext(context); } return marshaller; }
private XMLMarshaller getXmlMarshaller(Object options) { XMLMarshaller xmlMarshaller = getXmlMarshaller().clone(); if (null == options) { return xmlMarshaller; } try { DataObject optionsDO = (DataObject) options; if (optionsDO.isSet(SDOConstants.ATTACHMENT_MARSHALLER_OPTION)) { xmlMarshaller.setAttachmentMarshaller( (XMLAttachmentMarshaller) optionsDO.get(SDOConstants.ATTACHMENT_MARSHALLER_OPTION)); } xmlMarshaller.setMarshalListener( new SDOMarshalListener(xmlMarshaller, (SDOTypeHelper) aHelperContext.getTypeHelper())); return xmlMarshaller; } catch (ClassCastException ccException) { throw SDOException.optionsMustBeADataObject( ccException, SDOConstants.ORACLE_SDO_URL, SDOConstants.XMLHELPER_LOAD_OPTIONS); } }
public void setListener(Marshaller.Listener listener) { if (xmlMarshaller.getMarshalListener() == null) { xmlMarshaller.setMarshalListener(new JAXBMarshalListener(jaxbContext, this)); } ((JAXBMarshalListener) xmlMarshaller.getMarshalListener()).setListener(listener); }