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