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