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