001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.model.transformer; 018 019import javax.xml.bind.annotation.XmlAccessType; 020import javax.xml.bind.annotation.XmlAccessorType; 021import javax.xml.bind.annotation.XmlAttribute; 022import javax.xml.bind.annotation.XmlElement; 023import javax.xml.bind.annotation.XmlElements; 024import javax.xml.bind.annotation.XmlType; 025 026import org.apache.camel.model.DataFormatDefinition; 027import org.apache.camel.model.dataformat.ASN1DataFormat; 028import org.apache.camel.model.dataformat.AvroDataFormat; 029import org.apache.camel.model.dataformat.BarcodeDataFormat; 030import org.apache.camel.model.dataformat.Base64DataFormat; 031import org.apache.camel.model.dataformat.BeanioDataFormat; 032import org.apache.camel.model.dataformat.BindyDataFormat; 033import org.apache.camel.model.dataformat.CryptoDataFormat; 034import org.apache.camel.model.dataformat.CsvDataFormat; 035import org.apache.camel.model.dataformat.CustomDataFormat; 036import org.apache.camel.model.dataformat.FhirJsonDataFormat; 037import org.apache.camel.model.dataformat.FhirXmlDataFormat; 038import org.apache.camel.model.dataformat.FlatpackDataFormat; 039import org.apache.camel.model.dataformat.GrokDataFormat; 040import org.apache.camel.model.dataformat.GzipDataFormat; 041import org.apache.camel.model.dataformat.HL7DataFormat; 042import org.apache.camel.model.dataformat.IcalDataFormat; 043import org.apache.camel.model.dataformat.JacksonXMLDataFormat; 044import org.apache.camel.model.dataformat.JaxbDataFormat; 045import org.apache.camel.model.dataformat.JsonApiDataFormat; 046import org.apache.camel.model.dataformat.JsonDataFormat; 047import org.apache.camel.model.dataformat.LZFDataFormat; 048import org.apache.camel.model.dataformat.MimeMultipartDataFormat; 049import org.apache.camel.model.dataformat.PGPDataFormat; 050import org.apache.camel.model.dataformat.ProtobufDataFormat; 051import org.apache.camel.model.dataformat.RssDataFormat; 052import org.apache.camel.model.dataformat.SoapJaxbDataFormat; 053import org.apache.camel.model.dataformat.SyslogDataFormat; 054import org.apache.camel.model.dataformat.TarFileDataFormat; 055import org.apache.camel.model.dataformat.ThriftDataFormat; 056import org.apache.camel.model.dataformat.TidyMarkupDataFormat; 057import org.apache.camel.model.dataformat.UniVocityCsvDataFormat; 058import org.apache.camel.model.dataformat.UniVocityFixedWidthDataFormat; 059import org.apache.camel.model.dataformat.UniVocityTsvDataFormat; 060import org.apache.camel.model.dataformat.XMLSecurityDataFormat; 061import org.apache.camel.model.dataformat.XStreamDataFormat; 062import org.apache.camel.model.dataformat.XmlRpcDataFormat; 063import org.apache.camel.model.dataformat.YAMLDataFormat; 064import org.apache.camel.model.dataformat.ZipDeflaterDataFormat; 065import org.apache.camel.model.dataformat.ZipFileDataFormat; 066import org.apache.camel.spi.Metadata; 067 068/** 069 * Represents a {@link org.apache.camel.impl.transformer.DataFormatTransformer} 070 * which leverages {@link org.apache.camel.spi.DataFormat} to perform 071 * transformation. One of the DataFormat 'ref' or DataFormat 'type' needs to be 072 * specified. {@see TransformerDefinition} {@see DataFormatTransformer} 073 */ 074@Metadata(label = "transformation") 075@XmlType(name = "dataFormatTransformer") 076@XmlAccessorType(XmlAccessType.FIELD) 077public class DataFormatTransformerDefinition extends TransformerDefinition { 078 079 @XmlElements({@XmlElement(required = false, name = "asn1", type = ASN1DataFormat.class), @XmlElement(required = false, name = "avro", type = AvroDataFormat.class), 080 @XmlElement(required = false, name = "barcode", type = BarcodeDataFormat.class), @XmlElement(required = false, name = "base64", type = Base64DataFormat.class), 081 @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class), @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class), 082 @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class), @XmlElement(required = false, name = "csv", type = CsvDataFormat.class), 083 @XmlElement(required = false, name = "custom", type = CustomDataFormat.class), @XmlElement(required = false, name = "fhirJson", type = FhirJsonDataFormat.class), 084 @XmlElement(required = false, name = "fhirXml", type = FhirXmlDataFormat.class), 085 @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class), @XmlElement(required = false, name = "grok", type = GrokDataFormat.class), 086 @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class), @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class), 087 @XmlElement(required = false, name = "ical", type = IcalDataFormat.class), @XmlElement(required = false, name = "jacksonxml", type = JacksonXMLDataFormat.class), 088 @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class), @XmlElement(required = false, name = "json", type = JsonDataFormat.class), 089 @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class), @XmlElement(required = false, name = "lzf", type = LZFDataFormat.class), 090 @XmlElement(required = false, name = "mimeMultipart", type = MimeMultipartDataFormat.class), 091 @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class), @XmlElement(required = false, name = "rss", type = RssDataFormat.class), 092 @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class), 093 @XmlElement(required = false, name = "soapjaxb", type = SoapJaxbDataFormat.class), @XmlElement(required = false, name = "syslog", type = SyslogDataFormat.class), 094 @XmlElement(required = false, name = "tarfile", type = TarFileDataFormat.class), @XmlElement(required = false, name = "thrift", type = ThriftDataFormat.class), 095 @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class), 096 @XmlElement(required = false, name = "univocity-csv", type = UniVocityCsvDataFormat.class), 097 @XmlElement(required = false, name = "univocity-fixed", type = UniVocityFixedWidthDataFormat.class), 098 @XmlElement(required = false, name = "univocity-tsv", type = UniVocityTsvDataFormat.class), 099 @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class), @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class), 100 @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class), @XmlElement(required = false, name = "yaml", type = YAMLDataFormat.class), 101 @XmlElement(required = false, name = "zip", type = ZipDeflaterDataFormat.class), @XmlElement(required = false, name = "zipfile", type = ZipFileDataFormat.class)}) 102 private DataFormatDefinition dataFormatType; 103 104 @XmlAttribute 105 private String ref; 106 107 public String getRef() { 108 return ref; 109 } 110 111 /** 112 * Set the reference of the DataFormat. 113 * 114 * @param ref reference of the DataFormat 115 */ 116 public void setRef(String ref) { 117 this.ref = ref; 118 } 119 120 public DataFormatDefinition getDataFormatType() { 121 return dataFormatType; 122 } 123 124 /** 125 * The data format to be used 126 */ 127 public void setDataFormatType(DataFormatDefinition dataFormatType) { 128 this.dataFormatType = dataFormatType; 129 } 130 131}