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 */ 017package org.apache.camel.component.bean; 018 019import org.apache.camel.AsyncCallback; 020import org.apache.camel.AsyncProcessor; 021import org.apache.camel.CamelContext; 022import org.apache.camel.Exchange; 023import org.apache.camel.Processor; 024import org.apache.camel.support.ServiceSupport; 025 026public class BeanProcessor extends ServiceSupport implements AsyncProcessor { 027 028 private final DelegateBeanProcessor delegate; 029 030 public BeanProcessor(Object pojo, BeanInfo beanInfo) { 031 this.delegate = new DelegateBeanProcessor(pojo, beanInfo); 032 } 033 034 public BeanProcessor(Object pojo, CamelContext camelContext, ParameterMappingStrategy parameterMappingStrategy) { 035 this.delegate = new DelegateBeanProcessor(pojo, camelContext, parameterMappingStrategy); 036 } 037 038 public BeanProcessor(Object pojo, CamelContext camelContext) { 039 this.delegate = new DelegateBeanProcessor(pojo, camelContext); 040 } 041 042 public BeanProcessor(BeanHolder beanHolder) { 043 this.delegate = new DelegateBeanProcessor(beanHolder); 044 } 045 046 @Override 047 public void process(Exchange exchange) throws Exception { 048 delegate.process(exchange); 049 } 050 051 @Override 052 public boolean process(Exchange exchange, AsyncCallback callback) { 053 return delegate.process(exchange, callback); 054 } 055 056 public Processor getProcessor() { 057 return delegate.getProcessor(); 058 } 059 060 public BeanHolder getBeanHolder() { 061 return delegate.getBeanHolder(); 062 } 063 064 public Object getBean() { 065 return delegate.getBean(); 066 } 067 068 public String getMethod() { 069 return delegate.getMethod(); 070 } 071 072 public boolean isMultiParameterArray() { 073 return delegate.isMultiParameterArray(); 074 } 075 076 public void setMultiParameterArray(boolean mpArray) { 077 delegate.setMultiParameterArray(mpArray); 078 } 079 080 public Boolean getCache() { 081 return delegate.getCache(); 082 } 083 084 public void setCache(Boolean cache) { 085 delegate.setCache(cache); 086 } 087 088 public void setMethod(String method) { 089 delegate.setMethod(method); 090 } 091 092 public boolean isShorthandMethod() { 093 return delegate.isShorthandMethod(); 094 } 095 096 public void setShorthandMethod(boolean shorthandMethod) { 097 delegate.setShorthandMethod(shorthandMethod); 098 } 099 100 @Override 101 protected void doStart() throws Exception { 102 delegate.doStart(); 103 } 104 105 @Override 106 protected void doStop() throws Exception { 107 delegate.doStop(); 108 } 109 110 private static final class DelegateBeanProcessor extends AbstractBeanProcessor { 111 112 public DelegateBeanProcessor(Object pojo, BeanInfo beanInfo) { 113 super(pojo, beanInfo); 114 } 115 116 public DelegateBeanProcessor(Object pojo, CamelContext camelContext, ParameterMappingStrategy parameterMappingStrategy) { 117 super(pojo, camelContext, parameterMappingStrategy); 118 } 119 120 public DelegateBeanProcessor(Object pojo, CamelContext camelContext) { 121 super(pojo, camelContext); 122 } 123 124 public DelegateBeanProcessor(BeanHolder beanHolder) { 125 super(beanHolder); 126 } 127 } 128 129}