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.
| Method from org.jboss.iiop.rmi.marshal.strategy.StubStrategy Detail: |
public Object convertLocalRetval(Object obj) {
if (retvalRemoteInterface == null)
return obj;
else
return PortableRemoteObject.narrow(obj, retvalRemoteInterface);
}
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). |
public static StubStrategy forMethod(String[] paramTypes,
String[] excepIds,
String[] excepTypes,
String retvalType,
ClassLoader cl) {
// This "factory method" exists just because I have found it easier
// to invoke a static method (rather than invoking operator new)
// from a stub class dynamically assembled by an instance of
// org.jboss.proxy.ProxyAssembler.
return new StubStrategy(paramTypes, excepIds,
excepTypes, retvalType, 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". |
public boolean isDeclaredException(Throwable t) {
Iterator iterator = exceptionList.iterator();
while (iterator.hasNext()) {
if (((Class)iterator.next()).isInstance(t)) {
return true;
}
}
return false;
}
Checks if a given Throwable instance corresponds to an
exception declared by this StubStrategy's method. |
public boolean isNonVoid() {
return (retvalReader != null);
}
Returns true if this StubStrategy's method is non void. |
public Exception readException(String id,
InputStream in) {
ExceptionReader exceptionReader = (ExceptionReader)exceptionMap.get(id);
if (exceptionReader == null) {
return new UnexpectedException(id);
}
else {
return exceptionReader.read(in);
}
}
Unmarshals from an input stream an exception thrown by the method. |
public Object readRetval(InputStream in) {
return retvalReader.read(in);
}
Unmarshals from an input stream the return value of the method. |
public void writeParams(OutputStream out,
Object[] params) {
int len = params.length;
if (len != paramWriters.length) {
throw new RuntimeException("Cannot marshal parameters: "
+ "unexpected number of parameters");
}
for (int i = 0; i < len; i++ ) {
paramWriters[i].write(out, params[i]);
}
}
Marshals the sequence of method parameters into an output stream. |