1. /*
  2. * Copyright 2002-2004 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.springframework.remoting.support;
  17. import java.io.Serializable;
  18. import org.aopalliance.intercept.MethodInvocation;
  19. /**
  20. * JavaBean that encapsulates a remote invocation.
  21. * Provides the core method invocation properties.
  22. * Currently just used for RMI invokers, but not restricted to RMI.
  23. *
  24. * <p>This is an SPI class, typically not used directly by applications.
  25. * Can be subclassed for additional invocation parameters.
  26. *
  27. * @author Juergen Hoeller
  28. * @since 25.02.2004
  29. * @see org.springframework.remoting.rmi.RmiInvocationHandler
  30. */
  31. public class RemoteInvocation implements Serializable {
  32. private String methodName;
  33. private Class[] parameterTypes;
  34. private Object[] arguments;
  35. /**
  36. * Create a new RemoteInvocation for use as JavaBean.
  37. */
  38. public RemoteInvocation() {
  39. }
  40. /**
  41. * Create a new RemoteInvocation for the given parameters.
  42. * @param methodName the name of the method to invoke
  43. * @param argumentTypes the argument types of the method
  44. * @param arguments the arguments for the invocation
  45. */
  46. public RemoteInvocation(String methodName, Class[] argumentTypes, Object[] arguments) {
  47. this.methodName = methodName;
  48. this.parameterTypes = argumentTypes;
  49. this.arguments = arguments;
  50. }
  51. /**
  52. * Create a new RemoteInvocation for the given AOP method invocation.
  53. * @param methodInvocation the AOP invocation to convert
  54. */
  55. public RemoteInvocation(MethodInvocation methodInvocation) {
  56. this.methodName = methodInvocation.getMethod().getName();
  57. this.parameterTypes = methodInvocation.getMethod().getParameterTypes();
  58. this.arguments = methodInvocation.getArguments();
  59. }
  60. public void setMethodName(String methodName) {
  61. this.methodName = methodName;
  62. }
  63. public String getMethodName() {
  64. return methodName;
  65. }
  66. public void setParameterTypes(Class[] parameterTypes) {
  67. this.parameterTypes = parameterTypes;
  68. }
  69. public Class[] getParameterTypes() {
  70. return parameterTypes;
  71. }
  72. public void setArguments(Object[] arguments) {
  73. this.arguments = arguments;
  74. }
  75. public Object[] getArguments() {
  76. return arguments;
  77. }
  78. }