Package org.jibx.runtime.impl

Examples of org.jibx.runtime.impl.UnmarshallingContext


     */
    public boolean isPresent(IUnmarshallingContext iUnmarshallingContext)
        throws JiBXException {

        boolean result = false;
        UnmarshallingContext ctx =
            (UnmarshallingContext) iUnmarshallingContext;
        if (ctx.toStart().equals(name)) {
            result = true;
        }

        return result;
    }
View Full Code Here


     */
    public Object unmarshal(Object o,
                            IUnmarshallingContext iUnmarshallingContext)
        throws JiBXException {

        UnmarshallingContext ctx = (UnmarshallingContext) iUnmarshallingContext;
        preprocessUnmarshallingContext(ctx);
        final String nextElement = ctx.toStart();

        IBindingFactory delegateFactory =
            BindingDirectory.getFactory("metadata", JIBX_FACTORY_CLASS);

        UnmarshallingContext delegateContext =
            (UnmarshallingContext) delegateFactory.createUnmarshallingContext();
        delegateContext.setFromContext(ctx);
        // note that this is not checking that the namespace matches
        final int pos = findIndex(
            delegateFactory.getElementNames(),
            delegateFactory.getElementNamespaces(),
            nextElement, ctx.getElementNamespace());
        if (pos < 0) {
            throw new JiBXException(
                EXCEPTION_LOCALIZER.format("unmarshaller-not-found",
                    "{" + uri + "} " + JIBX_FACTORY_CLASS.getName()));
        }
        IUnmarshaller unmarshaller =  delegateContext.getUnmarshaller(pos);
        final Object value = unmarshaller.unmarshal(o, delegateContext);
        postprocessUnmarshallingContext(ctx);
        return value;
    }
View Full Code Here

     */
    public boolean isPresent(IUnmarshallingContext iUnmarshallingContext)
        throws JiBXException {

        boolean result = false;
        UnmarshallingContext ctx =
            (UnmarshallingContext) iUnmarshallingContext;
        if (ctx.toStart().equals(name)) {
            result = true;
        }

        return result;
    }
View Full Code Here

     */
    public Object unmarshal(Object o,
                            IUnmarshallingContext iUnmarshallingContext)
        throws JiBXException {

        UnmarshallingContext ctx = (UnmarshallingContext) iUnmarshallingContext;

        IBindingFactory delegateFactory =
            BindingDirectory.getFactory(getTargetBindingName(), getTargetClass());

        UnmarshallingContext delegateContext =
            (UnmarshallingContext) delegateFactory.createUnmarshallingContext();
        delegateContext.setFromContext(ctx);
        // note that this is not checking that the namespace matches
        final int pos = findIndex(
            delegateFactory.getMappedClasses(), getTargetClass().getName());
        if (pos < 0) {
            throw new JiBXException(
                EXCEPTION_LOCALIZER.format("unmarshaller-not-found",
                    "{" + uri + "} " + getTargetClass().getName()));
        }
        IUnmarshaller unmarshaller =  delegateContext.getUnmarshaller(pos);
        return unmarshaller.unmarshal(o, delegateContext);
    }
View Full Code Here

   
    // javadoc inherited
    public boolean isPresent(IUnmarshallingContext iUnmarshallingContext)
            throws JiBXException {
        boolean result = false;
        UnmarshallingContext ctx = (UnmarshallingContext) iUnmarshallingContext;
        if (!ctx.isEnd()
                || ctx.isAt(ctx.getNamespace(), DataSourceType.JDBC_DATASOURCE
                        .toString())
                || ctx.isAt(ctx.getNamespace(),
                        DataSourceType.INTERNAL_POOL_DATASOURCE.toString())
                || ctx.isAt(ctx.getNamespace(), DataSourceType.JNDI_DATASOURCE
                        .toString())) {
            result = true;
        }
        return result;
    }   
View Full Code Here

   
    // javadoc inherited
    public Object unmarshal(Object object, IUnmarshallingContext context)
            throws JiBXException {
        final DatasourceConfiguration datasource;
        final UnmarshallingContext ctx = (UnmarshallingContext) context;       
       
        final DataSourceType type = DataSourceType.literal(ctx.toStart());
       
        if (type == DataSourceType.JDBC_DATASOURCE) {
            datasource = unmarshalJDBCDatasource(ctx);
        } else if (type == DataSourceType.INTERNAL_POOL_DATASOURCE) {
            datasource = unmarshalInternalPoolDatasource(ctx);
View Full Code Here

        if (JibxSimpleTypes.isSimpleType(jtype)) {
            factory = JibxNullBindingFactory.getFactory();
        } else {
            factory = BindingDirectory.getFactory(jtype);
        }
        UnmarshallingContext ctx = (UnmarshallingContext)factory.createUnmarshallingContext();
        StAXReaderWrapper wrapper = new StAXReaderWrapper(reader, "Data-element", true);
        ctx.setDocument(wrapper);
        ctx.toTag();
        return ctx;
    }
View Full Code Here

    }

    public Object read(MessagePartInfo part, XMLStreamReader input) {
        Class<?> type = part.getTypeClass();
        try {
            UnmarshallingContext ctx = getUnmarshallingContext(input, type);
            if (JibxSimpleTypes.isSimpleType(type)) {
                QName stype = part.getTypeQName();
                QName ctype = part.getConcreteName();
                if (ctx.isAt(ctype.getNamespaceURI(), ctype.getLocalPart())) {
                    String text = ctx.parseElementText(ctype.getNamespaceURI(), ctype.getLocalPart());
                    return JibxSimpleTypes.toObject(text, stype);
                } else {
                    throw new RuntimeException("Missing required element [" + ctype + "]");
                }
            } else {
                return ctx.unmarshalElement(part.getTypeClass());  
            }
        } catch (JiBXException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    }

    public Object read(MessagePartInfo part, XMLStreamReader input) {
        Class<?> type = part.getTypeClass();
        try {
            UnmarshallingContext ctx = getUnmarshallingContext(input, type);
            if (JibxSimpleTypes.isSimpleType(type)) {
                QName stype = part.getTypeQName();
                QName ctype = part.getConcreteName();
                if (ctx.isAt(ctype.getNamespaceURI(), ctype.getLocalPart())) {
                    String text = ctx.parseElementText(ctype.getNamespaceURI(), ctype.getLocalPart());
                    return JibxSimpleTypes.toObject(text, stype);
                } else {
                    throw new RuntimeException("Missing required element [" + ctype + "]");
                }
            } else {
                return ctx.unmarshalElement(part.getTypeClass());  
            }
        } catch (JiBXException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        if (JibxSimpleTypes.isSimpleType(jtype)) {
            factory = JibxNullBindingFactory.getFactory();
        } else {
            factory = BindingDirectory.getFactory(jtype);
        }
        UnmarshallingContext ctx = (UnmarshallingContext)factory.createUnmarshallingContext();
        StAXReaderWrapper wrapper = new StAXReaderWrapper(reader, "Data-element", true);
        ctx.setDocument(wrapper);
        ctx.toTag();
        return ctx;
    }
View Full Code Here

TOP

Related Classes of org.jibx.runtime.impl.UnmarshallingContext

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.