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    
018    package org.apache.camel.component.spring.integration;
019    
020    import org.apache.camel.CamelContext;
021    import org.apache.camel.Exchange;
022    import org.apache.camel.ExchangePattern;
023    import org.apache.camel.Message;
024    import org.apache.camel.impl.DefaultExchange;
025    
026    /**
027     * An {@link Exchange} for working with Spring Integration endpoints which exposes the underlying
028     * Spring messages via {@link #getInMessage()} and {@link #getOutMessage()}
029     *
030     * @version $Revision: 652240 $
031     */
032    public class SpringIntegrationExchange  extends DefaultExchange {
033    
034        public SpringIntegrationExchange(CamelContext context) {
035            super(context);
036        }
037    
038        public SpringIntegrationExchange(CamelContext context, ExchangePattern pattern) {
039            super(context, pattern);
040        }
041    
042        @Override
043        public Exchange newInstance() {
044            return new SpringIntegrationExchange(this.getContext());
045        }
046    
047        @Override
048        public SpringIntegrationMessage getIn() {
049            return (SpringIntegrationMessage) super.getIn();
050        }
051    
052        @Override
053        public SpringIntegrationMessage getOut() {
054            return (SpringIntegrationMessage) super.getOut();
055        }
056    
057        @Override
058        public SpringIntegrationMessage getOut(boolean lazyCreate) {
059            return (SpringIntegrationMessage) super.getOut(lazyCreate);
060        }
061    
062        @Override
063        public SpringIntegrationMessage getFault() {
064            return (SpringIntegrationMessage) super.getFault();
065        }
066    
067        @Override
068        protected Message createFaultMessage() {
069            return new SpringIntegrationMessage();
070        }
071    
072        @Override
073        protected Message createInMessage() {
074            return new SpringIntegrationMessage();
075        }
076    
077        @Override
078        protected Message createOutMessage() {
079            return new SpringIntegrationMessage();
080        }
081    
082    }