Package org.apache.tuscany.sdo.helper

Examples of org.apache.tuscany.sdo.helper.XMLStreamHelper


                                                        ROOT_ELEMENT.getNamespaceURI(),
                                                        ROOT_ELEMENT.getLocalPart());
    }

    public XMLStreamReader getReader() throws XMLStreamException {
        XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
        return streamHelper.createXMLStreamReader(sourceDocument);
    }
View Full Code Here


    PullTransformer<XMLStreamReader, DataObject> {

    public DataObject transform(XMLStreamReader source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            // The XMLStreamHelper requires that the reader is posistioned at
            // START_ELEMENT
            while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext()) {
                source.next();
            }
            return streamHelper.loadObject(source);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

    PullTransformer<XMLStreamReader, XMLDocument> {

    public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            return streamHelper.load(source);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

        PullTransformer<DataObject, XMLStreamReader> {

    public XMLStreamReader transform(DataObject source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            XMLDocument document =
                    xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            return streamHelper.createXMLStreamReader(document);
        } catch (XMLStreamException e) {
            // TODO: Add context to the exception
            throw new TransformationException(e);
        }
    }
View Full Code Here

     * @return
     */
    public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            return streamHelper.createXMLStreamReader(source);
        } catch (XMLStreamException e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

    PullTransformer<XMLStreamReader, XMLDocument> {

    public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            return streamHelper.load(source);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

        PullTransformer<DataObject, XMLStreamReader> {

    public XMLStreamReader transform(DataObject source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            XMLDocument document =
                    xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            return streamHelper.createXMLStreamReader(document);
        } catch (XMLStreamException e) {
            // TODO: Add context to the exception
            throw new TransformationException(e);
        }
    }
View Full Code Here

     * @return
     */
    public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
            return streamHelper.createXMLStreamReader(source);
        } catch (XMLStreamException e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

    public ModelObject load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
        assert propertyQName.equals(reader.getName());
        // TODO: We need a way to get TypeHelper from deploymentContext
        TypeHelper typeHelper = TypeHelper.INSTANCE;
        XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
        DataObject dataObject = streamHelper.loadObject(reader);
        // TODO: Is it required that the object always extends from ModelObject?
        return new ModelDataObject(dataObject);
    }
View Full Code Here

        PullTransformer<DataObject, XMLStreamReader> {

    public XMLStreamReader transform(DataObject source, TransformationContext context) {
        try {
            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
            XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
            Object logicalType = context.getSourceDataType().getLogical();
            QName elementName =
                    (logicalType instanceof QName) ? (QName) logicalType : new QName("commonj.sdo", "dataObject");
            XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
            XMLDocument document =
                    xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            return streamHelper.createXMLStreamReader(document);
        } catch (XMLStreamException e) {
            // TODO: Add context to the exception
            throw new TransformationException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sdo.helper.XMLStreamHelper

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.