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     */
017    package org.apache.camel.util;
018    
019    import java.util.List;
020    import javax.xml.bind.annotation.XmlAccessType;
021    import javax.xml.bind.annotation.XmlAccessorType;
022    import javax.xml.bind.annotation.XmlAttribute;
023    import javax.xml.bind.annotation.XmlElement;
024    import javax.xml.bind.annotation.XmlElementRef;
025    import javax.xml.bind.annotation.XmlElementWrapper;
026    import javax.xml.bind.annotation.XmlElements;
027    import javax.xml.bind.annotation.XmlRootElement;
028    import javax.xml.bind.annotation.XmlValue;
029    
030    /**
031     * A model of a message dump from {@link MessageHelper#dumpAsXml(org.apache.camel.Message)}.
032     */
033    @XmlRootElement(name = "message")
034    @XmlAccessorType(XmlAccessType.FIELD)
035    public final class MessageDump {
036    
037        @XmlRootElement(name = "header")
038        @XmlAccessorType(XmlAccessType.FIELD)
039        public static class Header {
040    
041            @XmlAttribute
042            private String key;
043    
044            @XmlAttribute
045            private String type;
046    
047            @XmlValue
048            private String value;
049    
050            public String getKey() {
051                return key;
052            }
053    
054            public void setKey(String key) {
055                this.key = key;
056            }
057    
058            public String getType() {
059                return type;
060            }
061    
062            public void setType(String type) {
063                this.type = type;
064            }
065    
066            public String getValue() {
067                return value;
068            }
069    
070            public void setValue(String value) {
071                this.value = value;
072            }
073        }
074    
075        @XmlRootElement(name = "body")
076        @XmlAccessorType(XmlAccessType.FIELD)
077        public static class Body {
078    
079            @XmlAttribute
080            private String type;
081    
082            @XmlValue
083            private String value;
084    
085            public String getType() {
086                return type;
087            }
088    
089            public void setType(String type) {
090                this.type = type;
091            }
092    
093            public String getValue() {
094                return value;
095            }
096    
097            public void setValue(String value) {
098                this.value = value;
099            }
100        }
101    
102        @XmlAttribute
103        private String exchangeId;
104    
105        @XmlElementWrapper(name = "headers")
106        @XmlElements({
107            @XmlElement(type = Header.class, name = "header")
108        })
109        private List<Header> headers;
110    
111        @XmlElementRef
112        private Body body;
113    
114        public String getExchangeId() {
115            return exchangeId;
116        }
117    
118        public void setExchangeId(String exchangeId) {
119            this.exchangeId = exchangeId;
120        }
121    
122        public List<Header> getHeaders() {
123            return headers;
124        }
125    
126        public void setHeaders(List<Header> headers) {
127            this.headers = headers;
128        }
129    
130        public Body getBody() {
131            return body;
132        }
133    
134        public void setBody(Body body) {
135            this.body = body;
136        }
137    }