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