Package org.apache.camel.model.dataformat

Examples of org.apache.camel.model.dataformat.XStreamDataFormat


    /**
     * Uses the XStream data format
     */
    public T xstream() {
        return dataFormat(new XStreamDataFormat());
    }
View Full Code Here


    /**
     * Uses the XStream data format
     */
    public T xstream() {
        return dataFormat(new XStreamDataFormat());
    }
View Full Code Here

    /**
     * Uses the xstream by setting the encoding
     */
    public T xstream(String encoding) {
        return dataFormat(new XStreamDataFormat(encoding));
    }
View Full Code Here

    /**
     * Uses the XStream data format
     */
    public T xstream() {
        return dataFormat(new XStreamDataFormat());
    }
View Full Code Here

    /**
     * Uses the xstream by setting the encoding
     */
    public T xstream(String encoding) {
        return dataFormat(new XStreamDataFormat(encoding));
    }
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                XStreamDataFormat xstreamDefinition = new XStreamDataFormat();
                Map<String, String> aliases = new HashMap<String, String>();
                aliases.put("purchase-order", PurchaseOrder.class.getName());
                xstreamDefinition.setAliases(aliases);

                List<String> converters = new ArrayList<String>();
                converters.add(PurchaseOrderConverter.class.getName());
                converters.add(CheckMethodInjection.class.getName());
                converters.add(CheckConstructorInjection.class.getName());

                xstreamDefinition.setConverters(converters);

                Map<String, String[]> implicits = new HashMap<String, String[]>();
                implicits.put(PurchaseHistory.class.getName(), new String[] {"history"});
                xstreamDefinition.setImplicitCollections(implicits);

                from("direct:marshal").marshal(xstreamDefinition).to("mock:result");
                from("direct:unmarshal").unmarshal(xstreamDefinition).to("mock:result");

                xstreamDefinition = new XStreamDataFormat();
                xstreamDefinition.setDriver("json");
                aliases = new HashMap<String, String>();
                aliases.put("purchase-order", PurchaseOrder.class.getName());
                xstreamDefinition.setAliases(aliases);

                converters = new ArrayList<String>();
                converters.add(PurchaseOrderConverter.class.getName());
                xstreamDefinition.setConverters(converters);
                from("direct:marshal-json").marshal(xstreamDefinition).to("mock:result");
                from("direct:unmarshal-json").unmarshal(xstreamDefinition).to("mock:result");
               
                org.apache.camel.dataformat.xstream.XStreamDataFormat xStreamDataFormat
                    = new org.apache.camel.dataformat.xstream.XStreamDataFormat();
View Full Code Here

    /**
     * Uses the XStream data format
     */
    public T xstream() {
        return dataFormat(new XStreamDataFormat());
    }
View Full Code Here

    /**
     * Uses the xstream by setting the encoding
     */
    public T xstream(String encoding) {
        return dataFormat(new XStreamDataFormat(encoding));
    }
View Full Code Here

    public static final String COMPONENT = extractName(CamelXstreamTest.class);
   
    protected DataFormatDefinition createDataformatDefinition(String format) {
        if (format.equals("xstream")) {
            return new XStreamDataFormat();
        } else {
            return new JsonDataFormat();
        }
    }
View Full Code Here

    private static DataFormatDefinition processDataFormatType(RouteContext routeContext,
                                                              String ref,
                                                              DataFormatDefinition dformatDefinition) {
        if ( dformatDefinition == null ) {
            if ( "json".equals( ref ) ) {
                dformatDefinition = new XStreamDataFormat();
                ((XStreamDataFormat) dformatDefinition).setDriver( "json" );
            } else if ( "xstream".equals( ref ) ) {
                dformatDefinition = new XStreamDataFormat();
            } else if ( "jaxb".equals( ref ) ) {
                dformatDefinition = new JaxbDataFormat();
            } else {
                dformatDefinition = routeContext.getCamelContext().resolveDataFormatDefinition( ref );
            }
        }

        // always clone before changing
        dformatDefinition = new FastCloner().deepClone( dformatDefinition );

        if ( dformatDefinition instanceof JaxbDataFormat ) {
            dformatDefinition = augmentJaxbDataFormatDefinition( (JaxbDataFormat) dformatDefinition );
        } else if ( dformatDefinition instanceof XStreamDataFormat ) {
            XStreamDataFormat xstreamDataFormat = (XStreamDataFormat) dformatDefinition;
            if ( "json".equals( xstreamDataFormat.getDriver() ) ) {
                dformatDefinition = XStreamJson.newJSonMarshaller( xstreamDataFormat );;
            } else {
                dformatDefinition = XStreamXml.newXStreamMarshaller( (XStreamDataFormat) dformatDefinition );
            }
View Full Code Here

TOP

Related Classes of org.apache.camel.model.dataformat.XStreamDataFormat

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.