Package org.apache.camel.model

Examples of org.apache.camel.model.MarshalDefinition


                                     beanDef ); // insert after cxf
                        i = i + 2;// adjust for the two inserts
                        augmented = true;
                    }
                } else if ( child instanceof MarshalDefinition ) {
                    MarshalDefinition m = (MarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned
                } else if ( child instanceof UnmarshalDefinition ) {
                    UnmarshalDefinition m = (UnmarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned                   
                }
            }

            for ( Iterator<ProcessorDefinition> it = nav.getOutputs().iterator(); it.hasNext(); ) {
                ProcessorDefinition child = it.next();
View Full Code Here


                        outputs.add( i+2, beanDef ); // insert after cxfrs
                        i = i + 2;// adjust for the two inserts
                    }
                   
                } else if ( child instanceof MarshalDefinition ) {
                    MarshalDefinition m = (MarshalDefinition) child;

                    DataFormatDefinition dformatDefinition = m.getDataFormatType();   
                   
                    if ( dformatDefinition == null ) {
                        String ref = m.getRef();
                        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 );   
                        }
                       
                    }
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned
                   
                   
                } else if ( child instanceof UnmarshalDefinition ) {
                    UnmarshalDefinition m = (UnmarshalDefinition) child;
                   
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                   
                    if ( dformatDefinition == null ) {
                        String ref = m.getRef();
                        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 );                                      
                   
                    // Augment the Jaxb DataFormatDefinition, but clone first so we don't alter the original.
                    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 );   
                        }
                    }
                    
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned                   
                }
            }
           
            for ( Iterator<ProcessorDefinition> it = nav.getOutputs().iterator(); it.hasNext(); ) {
                ProcessorDefinition child = it.next();
View Full Code Here

                                     beanDef ); // insert after cxf
                        i = i + 2;// adjust for the two inserts
                        augmented = true;
                    }
                } else if ( child instanceof MarshalDefinition ) {
                    MarshalDefinition m = (MarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned
                } else if ( child instanceof UnmarshalDefinition ) {
                    UnmarshalDefinition m = (UnmarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned                   
                }
            }

            for ( Iterator<ProcessorDefinition<?>> it = nav.getOutputs().iterator(); it.hasNext(); ) {
                ProcessorDefinition child = it.next();
View Full Code Here

                                     beanDef ); // insert after cxf
                        i = i + 2;// adjust for the two inserts
                        augmented = true;
                    }
                } else if ( child instanceof MarshalDefinition ) {
                    MarshalDefinition m = (MarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned
                } else if ( child instanceof UnmarshalDefinition ) {
                    UnmarshalDefinition m = (UnmarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned                   
                }
            }

            for ( Iterator<ProcessorDefinition<?>> it = nav.getOutputs().iterator(); it.hasNext(); ) {
                ProcessorDefinition child = it.next();
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Override
    public ProcessorDefinition createCamelDefinition() {
        MarshalDefinition answer = new MarshalDefinition();

        answer.setRef(toXmlPropertyValue(PROPERTY_REF, this.getRef()));
        answer.setDataFormatType(toXmlPropertyValue(PROPERTY_DATAFORMATTYPE, this.getDataFormatType()));

        super.savePropertiesToCamelDefinition(answer);
        return answer;
    }
View Full Code Here

    @Override
    protected void loadPropertiesFromCamelDefinition(ProcessorDefinition processor) {
        super.loadPropertiesFromCamelDefinition(processor);

        if (processor instanceof MarshalDefinition) {
            MarshalDefinition node = (MarshalDefinition) processor;

            this.setRef(node.getRef());
            this.setDataFormatType(node.getDataFormatType());
        } else {
            throw new IllegalArgumentException("ProcessorDefinition not an instanceof MarshalDefinition. Was " + processor.getClass().getName());
        }
    }
View Full Code Here

                                     beanDef ); // insert after cxf
                        i = i + 2;// adjust for the two inserts
                        augmented = true;
                    }
                } else if ( child instanceof MarshalDefinition ) {
                    MarshalDefinition m = (MarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned
                } else if ( child instanceof UnmarshalDefinition ) {
                    UnmarshalDefinition m = (UnmarshalDefinition) child;
                    DataFormatDefinition dformatDefinition = m.getDataFormatType();
                    dformatDefinition = processDataFormatType( routeContext,
                                                               m.getRef(),
                                                               dformatDefinition );
                    m.setDataFormatType( dformatDefinition ); // repoint the marshaller, if it was cloned                   
                }
            }

            for ( Iterator<ProcessorDefinition> it = nav.getOutputs().iterator(); it.hasNext(); ) {
                ProcessorDefinition child = it.next();
View Full Code Here

TOP

Related Classes of org.apache.camel.model.MarshalDefinition

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.