001/* 002 * Copyright 2002-2007 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.remoting.support; 018 019import java.lang.reflect.InvocationTargetException; 020 021/** 022 * Strategy interface for executing a {@link RemoteInvocation} on a target object. 023 * 024 * <p>Used by {@link org.springframework.remoting.rmi.RmiServiceExporter} (for RMI invokers) 025 * and by {@link org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter}. 026 * 027 * @author Juergen Hoeller 028 * @since 1.1 029 * @see DefaultRemoteInvocationFactory 030 * @see org.springframework.remoting.rmi.RmiServiceExporter#setRemoteInvocationExecutor 031 * @see org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter#setRemoteInvocationExecutor 032 */ 033public interface RemoteInvocationExecutor { 034 035 /** 036 * Perform this invocation on the given target object. 037 * Typically called when a RemoteInvocation is received on the server. 038 * @param invocation the RemoteInvocation 039 * @param targetObject the target object to apply the invocation to 040 * @return the invocation result 041 * @throws NoSuchMethodException if the method name could not be resolved 042 * @throws IllegalAccessException if the method could not be accessed 043 * @throws InvocationTargetException if the method invocation resulted in an exception 044 * @see java.lang.reflect.Method#invoke 045 */ 046 Object invoke(RemoteInvocation invocation, Object targetObject) 047 throws NoSuchMethodException, IllegalAccessException, InvocationTargetException; 048 049}