Class JaxbDataFormat

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatContentTypeHeader, org.apache.camel.spi.DataFormatName, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Dataformat("jaxb")
    public class JaxbDataFormat
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.spi.DataFormatContentTypeHeader, org.apache.camel.CamelContextAware
    A data format (DataFormat) using JAXB2 to marshal to and from XML
    • Constructor Detail

      • JaxbDataFormat

        public JaxbDataFormat()
      • JaxbDataFormat

        public JaxbDataFormat​(JAXBContext context)
      • JaxbDataFormat

        public JaxbDataFormat​(String contextPath)
    • Method Detail

      • getDataFormatName

        public String getDataFormatName()
        Specified by:
        getDataFormatName in interface org.apache.camel.spi.DataFormatName
      • marshal

        public void marshal​(org.apache.camel.Exchange exchange,
                            Object graph,
                            OutputStream stream)
                     throws IOException
        Specified by:
        marshal in interface org.apache.camel.spi.DataFormat
        Throws:
        IOException
      • unmarshal

        public Object unmarshal​(org.apache.camel.Exchange exchange,
                                InputStream stream)
                         throws IOException
        Specified by:
        unmarshal in interface org.apache.camel.spi.DataFormat
        Throws:
        IOException
      • needFiltering

        protected boolean needFiltering​(org.apache.camel.Exchange exchange)
      • isIgnoreJAXBElement

        public boolean isIgnoreJAXBElement()
      • setIgnoreJAXBElement

        public void setIgnoreJAXBElement​(boolean flag)
      • isMustBeJAXBElement

        public boolean isMustBeJAXBElement()
      • setMustBeJAXBElement

        public void setMustBeJAXBElement​(boolean mustBeJAXBElement)
      • setContext

        public void setContext​(JAXBContext context)
      • getContextPath

        public String getContextPath()
      • setContextPath

        public void setContextPath​(String contextPath)
      • isContextPathIsClassName

        public boolean isContextPathIsClassName()
      • setContextPathIsClassName

        public void setContextPathIsClassName​(boolean contextPathIsClassName)
      • setSchemaFactory

        public void setSchemaFactory​(SchemaFactory schemaFactory)
      • getSchema

        public String getSchema()
      • setSchema

        public void setSchema​(String schema)
      • getSchemaSeverityLevel

        public int getSchemaSeverityLevel()
      • setSchemaSeverityLevel

        public void setSchemaSeverityLevel​(int schemaSeverityLevel)
      • isPrettyPrint

        public boolean isPrettyPrint()
      • setPrettyPrint

        public void setPrettyPrint​(boolean prettyPrint)
      • isObjectFactory

        public boolean isObjectFactory()
      • setObjectFactory

        public void setObjectFactory​(boolean objectFactory)
      • isFragment

        public boolean isFragment()
      • setFragment

        public void setFragment​(boolean fragment)
      • isFilterNonXmlChars

        public boolean isFilterNonXmlChars()
      • setFilterNonXmlChars

        public void setFilterNonXmlChars​(boolean filterNonXmlChars)
      • getEncoding

        public String getEncoding()
      • setEncoding

        public void setEncoding​(String encoding)
      • getPartNamespace

        public QName getPartNamespace()
      • setPartNamespace

        public void setPartNamespace​(QName partNamespace)
      • getPartClass

        public Class<?> getPartClass()
      • setPartClass

        public void setPartClass​(Class<?> partClass)
      • setNamespacePrefix

        public void setNamespacePrefix​(Map<String,​String> namespacePrefix)
      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.CamelContextAware
      • setCamelContext

        public void setCamelContext​(org.apache.camel.CamelContext camelContext)
        Specified by:
        setCamelContext in interface org.apache.camel.CamelContextAware
      • getSchemaLocation

        public String getSchemaLocation()
      • setSchemaLocation

        public void setSchemaLocation​(String schemaLocation)
      • getNoNamespaceSchemaLocation

        public String getNoNamespaceSchemaLocation()
      • setNoNamespaceSchemaLocation

        public void setNoNamespaceSchemaLocation​(String schemaLocation)
      • getJaxbProviderProperties

        public Map<String,​Object> getJaxbProviderProperties()
      • setJaxbProviderProperties

        public void setJaxbProviderProperties​(Map<String,​Object> jaxbProviderProperties)
      • isContentTypeHeader

        public boolean isContentTypeHeader()
      • setContentTypeHeader

        public void setContentTypeHeader​(boolean contentTypeHeader)
        If enabled then JAXB will set the Content-Type header to application/xml when marshalling.
        Specified by:
        setContentTypeHeader in interface org.apache.camel.spi.DataFormatContentTypeHeader
      • getAccessExternalSchemaProtocols

        public String getAccessExternalSchemaProtocols()
      • setAccessExternalSchemaProtocols

        public void setAccessExternalSchemaProtocols​(String accessExternalSchemaProtocols)
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.service.BaseService
        Throws:
        Exception