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.component.spring.integration;
018    
019    import org.apache.camel.CamelContext;
020    import org.apache.camel.Consumer;
021    import org.apache.camel.Processor;
022    import org.apache.camel.Producer;
023    import org.apache.camel.impl.ScheduledPollEndpoint;
024    import org.springframework.integration.core.MessageChannel;
025    
026    /**
027     * Defines the <a href="http://camel.apache.org/springIntergration.html">Spring Intergration Endpoint</a>
028     *
029     * @version $Revision: 835240 $
030     */
031    public class SpringIntegrationEndpoint extends ScheduledPollEndpoint {
032        private String inputChannel;
033        private String outputChannel;
034        private String defaultChannel;
035        private MessageChannel messageChannel;
036        private boolean inOut;
037    
038        public SpringIntegrationEndpoint(String uri, String channel, SpringIntegrationComponent component) {
039            super(uri, component);
040            defaultChannel = channel;
041        }
042    
043        public SpringIntegrationEndpoint(String uri, MessageChannel channel, CamelContext context) {
044            super(uri, context);
045            messageChannel = channel;
046        }
047    
048        public SpringIntegrationEndpoint(String endpointUri, MessageChannel messageChannel) {
049            super(endpointUri);
050            this.messageChannel = messageChannel;
051        }
052    
053        public Producer createProducer() throws Exception {
054            return new SpringIntegrationProducer(this);
055        }
056    
057        public Consumer createConsumer(Processor processor) throws Exception {
058            return new SpringIntegrationConsumer(this, processor);
059        }
060    
061        public void setInputChannel(String input) {
062            inputChannel = input;
063        }
064    
065        public String getInputChannel() {
066            return inputChannel;
067        }
068    
069        public void setOutputChannel(String output) {
070            outputChannel = output;
071        }
072    
073        public String getOutputChannel() {
074            return outputChannel;
075        }
076    
077        public String getDefaultChannel() {
078            return defaultChannel;
079        }
080    
081        public MessageChannel getMessageChannel() {
082            return messageChannel;
083        }
084    
085        public boolean isSingleton() {
086            return false;
087        }
088    
089        public void setInOut(boolean inOut) {
090            this.inOut = inOut;
091        }
092    
093        public boolean isInOut() {
094            return this.inOut;
095        }
096    
097    }