1. /*
  2. * @(#)DynamicMethodMarshaller.java 1.10 04/06/21
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.spi.presentation.rmi ;
  8. import org.omg.CORBA_2_3.portable.InputStream ;
  9. import org.omg.CORBA_2_3.portable.OutputStream ;
  10. import org.omg.CORBA.portable.ApplicationException ;
  11. import java.lang.reflect.Method ;
  12. import java.rmi.RemoteException ;
  13. import com.sun.corba.se.spi.orb.ORB ;
  14. /** Used to read and write arguments and results for a particular method.
  15. *
  16. */
  17. public interface DynamicMethodMarshaller
  18. {
  19. /** Returns the method used to create this DynamicMethodMarshaller.
  20. */
  21. Method getMethod() ;
  22. /** Copy the arguments as needed for this particular method.
  23. * Can be optimized so that as little copying as possible is
  24. * performed.
  25. */
  26. Object[] copyArguments( Object[] args, ORB orb ) throws RemoteException ;
  27. /** Read the arguments for this method from the InputStream.
  28. * Returns null if there are no arguments.
  29. */
  30. Object[] readArguments( InputStream is ) ;
  31. /** Write arguments for this method to the OutputStream.
  32. * Does nothing if there are no arguments.
  33. */
  34. void writeArguments( OutputStream os, Object[] args ) ;
  35. /** Copy the result as needed for this particular method.
  36. * Can be optimized so that as little copying as possible is
  37. * performed.
  38. */
  39. Object copyResult( Object result, ORB orb ) throws RemoteException ;
  40. /** Read the result from the InputStream. Returns null
  41. * if the result type is null.
  42. */
  43. Object readResult( InputStream is ) ;
  44. /** Write the result to the OutputStream. Does nothing if
  45. * the result type is null.
  46. */
  47. void writeResult( OutputStream os, Object result ) ;
  48. /** Returns true iff thr's class is a declared exception (or a subclass of
  49. * a declared exception) for this DynamicMethodMarshaller's method.
  50. */
  51. boolean isDeclaredException( Throwable thr ) ;
  52. /** Write the repository ID of the exception and the value of the
  53. * exception to the OutputStream. ex should be a declared exception
  54. * for this DynamicMethodMarshaller's method.
  55. */
  56. void writeException( OutputStream os, Exception ex ) ;
  57. /** Reads an exception ID and the corresponding exception from
  58. * the input stream. This should be an exception declared in
  59. * this method.
  60. */
  61. Exception readException( ApplicationException ae ) ;
  62. }