Package org.eclipse.persistence.jaxb

Examples of org.eclipse.persistence.jaxb.JAXBUnmarshaller


        }
    }

    private XMLUnmarshaller createXMLUnmarshaller() {
        try {
            JAXBUnmarshaller unmarshaller = (JAXBUnmarshaller) getHelperContext().getJAXBContext().createUnmarshaller();
            XMLUnmarshaller xmlUnmarshaller = unmarshaller.getXMLUnmarshaller();
            xmlUnmarshaller.setResultAlwaysXMLRoot(true);
            return xmlUnmarshaller;
        } catch(JAXBException e) {
            throw SDOException.sdoJaxbErrorCreatingJAXBUnmarshaller(e);
        }
View Full Code Here


    // This is used in RPC
    @Override
    public T unmarshal(XMLStreamReader in, AttachmentUnmarshaller au)
            throws JAXBException {
        JAXBUnmarshaller unmarshaller = null;
        try {
            QName tagName = null;
            if (in.getEventType() == XMLStreamConstants.START_ELEMENT) {
                tagName = in.getName();
            }

            unmarshaller = parent.upool.allocate();
            unmarshaller.setAttachmentUnmarshaller(au);

            Object o;
            if (in instanceof XMLStreamReaderEx) {
                CustomXMLStreamReaderReader cr = new CustomXMLStreamReaderReader();
                XMLStreamReaderInputSource is = new XMLStreamReaderInputSource(
                        in);
                SAXSource saxSource = new SAXSource(cr, is);
                o = ((mappingInfo != null) ? unmarshaller.unmarshal(saxSource,
                        mappingInfo) : unmarshaller.unmarshal(saxSource));
            } else {
                o = ((mappingInfo != null) ? unmarshaller.unmarshal(in,
                        mappingInfo) : unmarshaller.unmarshal(in));
            }

            if (o instanceof JAXBElement) {
                o = ((JAXBElement) o).getValue();
            }
            // TODO recycle to pool

            // Workaround for Eclipselink JAXB not consuming END_ELEMENT.
            try {
                if (in.getEventType() == XMLStreamConstants.END_ELEMENT && in.getName().equals(tagName)) {
                    in.next();
                }
            } catch (XMLStreamException e) {
                throw new WebServiceException(e);
            }
            return (T) o;
        } finally {
            if (unmarshaller != null) {
                unmarshaller.setAttachmentUnmarshaller(null);
                parent.upool.replace(unmarshaller);
            }
        }
    }
View Full Code Here

    }

    @Override
    public T unmarshal(Source in, AttachmentUnmarshaller au)
            throws JAXBException {
        JAXBUnmarshaller unmarshaller = null;
        try {
            unmarshaller = parent.upool.allocate();
            unmarshaller.setAttachmentUnmarshaller(au);
            Object o;
            if (mappingInfo != null) {
                o = unmarshaller.unmarshal(in, mappingInfo);
            } else {
                o = unmarshaller.unmarshal(in);
            }
            if (o instanceof JAXBElement) {
                o = ((JAXBElement) o).getValue();
            }
            // TODO recycle to pool
            return (T) o;
        } finally {
            if (unmarshaller != null) {
                unmarshaller.setAttachmentUnmarshaller(null);
                parent.upool.replace(unmarshaller);
            }
        }
    }
View Full Code Here

        }
    }

    @Override
    public T unmarshal(InputStream in) throws JAXBException {
        JAXBUnmarshaller unmarshaller = null;
        try {
            unmarshaller = parent.upool.allocate();
            // GAG missing
            Object o = ((mappingInfo != null) ? unmarshaller.unmarshal(
                    new StreamSource(in), mappingInfo) : unmarshaller
                    .unmarshal(in));
            // Object o = unmarshaller.unmarshal(in);
            if (o instanceof JAXBElement) {
                o = ((JAXBElement) o).getValue();
            }
            // TODO recycle to pool
            return (T) o;
        } finally {
            if (unmarshaller != null) {
                unmarshaller.setAttachmentUnmarshaller(null);
                parent.upool.replace(unmarshaller);
            }
        }
    }
View Full Code Here

        }
    }

    @Override
    public T unmarshal(Node in, AttachmentUnmarshaller au) throws JAXBException {
        JAXBUnmarshaller unmarshaller = null;
        try {
            unmarshaller = parent.upool.allocate();
            unmarshaller.setAttachmentUnmarshaller(au);
            Object o = ((mappingInfo != null) ? unmarshaller.unmarshal(
                    new DOMSource(in), mappingInfo) : unmarshaller
                    .unmarshal(in));
            // Object o = unmarshaller.unmarshal(in);
            if (o instanceof JAXBElement) {
                o = ((JAXBElement) o).getValue();
            }
            // TODO recycle to pool
            return (T) o;
        } finally {
            if (unmarshaller != null) {
                unmarshaller.setAttachmentUnmarshaller(null);
                parent.upool.replace(unmarshaller);
            }
        }
    }
View Full Code Here

        }
    }

    private XMLUnmarshaller createXMLUnmarshaller() {
        try {
            JAXBUnmarshaller unmarshaller = (JAXBUnmarshaller) getHelperContext().getJAXBContext().createUnmarshaller();
            XMLUnmarshaller xmlUnmarshaller = unmarshaller.getXMLUnmarshaller();
            xmlUnmarshaller.setResultAlwaysXMLRoot(true);
            return xmlUnmarshaller;
        } catch(JAXBException e) {
            throw SDOException.sdoJaxbErrorCreatingJAXBUnmarshaller(e);
        }
View Full Code Here

        }
    }

    private XMLUnmarshaller createXMLUnmarshaller() {
        try {
            JAXBUnmarshaller unmarshaller = (JAXBUnmarshaller) getHelperContext().getJAXBContext().createUnmarshaller();
            XMLUnmarshaller xmlUnmarshaller = unmarshaller.getXMLUnmarshaller();
            xmlUnmarshaller.setResultAlwaysXMLRoot(true);
            return xmlUnmarshaller;
        } catch(JAXBException e) {
            throw SDOException.sdoJaxbErrorCreatingJAXBUnmarshaller(e);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jaxb.JAXBUnmarshaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.