1 /* 2 * Copyright 2008 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.openehealth.ipf.platform.camel.core.adapter; 17 18 import groovy.lang.Closure; 19 20 import org.apache.camel.Exchange; 21 import org.apache.camel.Expression; 22 23 /** 24 * Contract for classes that adapts the <i>modules API</i> to Apache Camel 25 * interfaces. 26 * 27 * @author Martin Krasser 28 */ 29 public interface Adapter { 30 31 /** 32 * Sets an {@link Expression} for obtaining input data from an 33 * {@link Exchange}. Input data are passed to adapted 34 * modules API implementations. 35 * 36 * @param inputExpression 37 * expression for obtaining input data. 38 * @return this object. 39 */ 40 public Adapter input(Expression inputExpression); 41 42 /** 43 * Sets an expression {@link Closure} for obtaining input data from an 44 * {@link Exchange}. Input data are passed to adapted 45 * modules API implementations. 46 * 47 * @param inputExpressionLogic 48 * expression for obtaining input data. 49 * @return this object. 50 */ 51 public Adapter input(Closure inputExpressionLogic); 52 53 /** 54 * Sets an {@link Expression} for obtaining input params from an 55 * {@link Exchange}. Input params are passed to adapted 56 * modules API implementations. 57 * 58 * @param paramsExpression 59 * expression for obtaining input params. 60 * @return this object. 61 */ 62 public Adapter params(Expression paramsExpression); 63 64 /** 65 * Sets an expression {@link Closure} for obtaining input params from an 66 * {@link Exchange}. Input params are passed to adapted 67 * modules API implementations. 68 * 69 * @param paramsExpressionLogic 70 * expression for obtaining input params. 71 * @return this object. 72 */ 73 public Adapter params(Closure paramsExpressionLogic); 74 75 /** 76 * Configures this adapter to use the given {@code params} 77 * independent of the {@link Exchange} to be processed. 78 * 79 * @param params 80 * expression for obtaining input params. 81 * @return this object. 82 */ 83 public Adapter staticParams(Object... params); 84 85 }