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 org.aopalliance.intercept.MethodInvocation;
020
021/**
022 * Strategy interface for creating a {@link RemoteInvocation} from an AOP Alliance
023 * {@link org.aopalliance.intercept.MethodInvocation}.
024 *
025 * <p>Used by {@link org.springframework.remoting.rmi.RmiClientInterceptor} (for RMI invokers)
026 * and by {@link org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor}.
027 *
028 * @author Juergen Hoeller
029 * @since 1.1
030 * @see DefaultRemoteInvocationFactory
031 * @see org.springframework.remoting.rmi.RmiClientInterceptor#setRemoteInvocationFactory
032 * @see org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor#setRemoteInvocationFactory
033 */
034public interface RemoteInvocationFactory {
035
036        /**
037         * Create a serializable RemoteInvocation object from the given AOP
038         * MethodInvocation.
039         * <p>Can be implemented to add custom context information to the
040         * remote invocation, for example user credentials.
041         * @param methodInvocation the original AOP MethodInvocation object
042         * @return the RemoteInvocation object
043         */
044        RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation);
045
046}