Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.iiop.rmi.marshal.strategy
Class StubStrategy

    java.lang.Object
      org.jboss.iiop.rmi.marshal.strategy.StubStrategy

public class StubStrategy
extends Object

An `StubStrategy` for a given method knows how to marshal the sequence of method parameters into a CDR output stream, how to unmarshal from a CDR input stream the return value of the method, and how to unmarshal from a CDR input stream an application exception thrown by the method.

Version:
  $Revision: 1.3 $
Author:
  Francisco Reverbel

Method Summary
`Object` | `convertLocalRetval(Object obj)` Converts the return value of a local invocation into the expected type.
`static StubStrategy` | `forMethod(String[] paramTypes, String[] excepIds, String[] excepTypes, String retvalType, ClassLoader cl)` Returns an `StubStrategy` for a method, given descriptions of the method parameters, exceptions, and return value.
`boolean` | `isDeclaredException(Throwable t)` Checks if a given `Throwable` instance corresponds to an exception declared by this `StubStrategy`'s method.
`boolean` | `isNonVoid()` Returns true if this `StubStrategy`'s method is non void.
`Exception` | `readException(String id, InputStream in)` Unmarshals from an input stream an exception thrown by the method.
`Object` | `readRetval(InputStream in)` Unmarshals from an input stream the return value of the method.
`void` | `writeParams(OutputStream out, Object[] params)` Marshals the sequence of method parameters into an output stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### forMethod

    public static StubStrategy forMethod(String[] paramTypes,
                                         String[] excepIds,
                                         String[] excepTypes,
                                         String retvalType,
                                         ClassLoader cl)

  Returns an `StubStrategy` for a method, given descriptions of the method parameters, exceptions, and return value. Parameter and return value descriptions are "marshaller abbreviated names".

  Parameters:
    `paramTypes` - a string array with marshaller abbreviated names for the method parameters
    `excepIds` - a string array with the CORBA repository ids of the exceptions thrown by the method
    `excepTypes` - a string array with the Java class names of the exceptions thrown by the method
    `retvalType` - marshaller abbreaviated name for the return value of the method
    `cl` - a `ClassLoader` to load value classes (if null, the current thread's context class loader will be used)
  Returns:
    an `StubStrategy` for the operation with the parameters, exceptions, and return value specified.
  See Also:
    `org.jboss.iiop.marshal.CDRStream#abbrevFor(Class clz)`

### writeParams

    public void writeParams(OutputStream out,
                            Object[] params)

  Marshals the sequence of method parameters into an output stream.

  Parameters:
    `out` - a CDR output stream
    `params` - an object array with the parameters.

### isNonVoid

    public boolean isNonVoid()

  Returns true if this `StubStrategy`'s method is non void.

### readRetval

    public Object readRetval(InputStream in)

  Unmarshals from an input stream the return value of the method.

  Parameters:
    `in` - a CDR input stream
  Returns:
    a value unmarshaled from the stream.

### readException

    public Exception readException(String id,
                                   InputStream in)

  Unmarshals from an input stream an exception thrown by the method.

  Parameters:
    `id` - the repository id of the exception to unmarshal
    `in` - a CDR input stream
  Returns:
    an exception unmarshaled from the stream.

### isDeclaredException

    public boolean isDeclaredException(Throwable t)

  Checks if a given `Throwable` instance corresponds to an exception declared by this `StubStrategy`'s method.

  Parameters:
    `t` - an exception class
  Returns:
    true if `t` is an instance of any of the exceptions declared by this `StubStrategy`'s method, false otherwise.

### convertLocalRetval

    public Object convertLocalRetval(Object obj)

  Converts the return value of a local invocation into the expected type. A conversion is needed if the return value is a remote interface (in this case `PortableRemoteObject.narrow()` must be called).

  Parameters:
    `obj` - the return value to be converted
  Returns:
    the converted value.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.