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.ibatis.strategy;
018
019 import java.util.List;
020
021 import org.apache.camel.Exchange;
022 import org.apache.camel.component.ibatis.IBatisEndpoint;
023 import org.apache.camel.component.ibatis.IBatisPollingConsumer;
024
025 /**
026 * Processing strategy for dealing with IBatis.
027 */
028 public interface IBatisProcessingStrategy {
029
030 /**
031 * Called when record is being queried.
032 *
033 * @param consumer The Ibatis Polling Consumer
034 * @param endpoint The Ibatis Endpoint
035 * @return Results of the query as a java.util.List
036 * @throws Exception can be thrown in case of error
037 */
038 List poll(IBatisPollingConsumer consumer, IBatisEndpoint endpoint) throws Exception;
039
040 /**
041 * Commit callback if there are a statements to be run after processing.
042 *
043 * @param endpoint The Ibatis Enpoint
044 * @param exchange The exchange after it has been processed
045 * @param data The original data delivered to the route
046 * @param consumeStatements Name of the statement(s) to run, will use SQL update. Use comma to provide multiple statements to run.
047 * @throws Exception can be thrown in case of error
048 */
049 void commit(IBatisEndpoint endpoint, Exchange exchange, Object data, String consumeStatements) throws Exception;
050 }