User: reverbel
Date: 02/02/13 12:21:46
Added: iiop/src/main/org/jboss/proxy/compiler IIOPStubCompiler.java
Util.java
Log:
Moving IIOP stub compiler classes from the org.jboss.proxy package:
org.jboss.proxy.IIOPStubCompiler - org.jboss.proxy.compiler.IIOPStubCompiler
org.jboss.proxy.Util - org.jboss.proxy.compiler.Util
Revision ChangesPath
1.1
contrib/iiop/src/main/org/jboss/proxy/compiler/IIOPStubCompiler.java
Index: IIOPStubCompiler.java
===
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.proxy.compiler; // IIOPStubCompiler is in this package
// because it calls some ProxyAssembler
// methods that currently are package
// accessible
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.rmi.RemoteException;
import org.jboss.iiop.rmi.AttributeAnalysis;
import org.jboss.iiop.rmi.ExceptionAnalysis;
import org.jboss.iiop.rmi.InterfaceAnalysis;
import org.jboss.iiop.rmi.OperationAnalysis;
import org.jboss.iiop.rmi.RMIIIOPViolationException;
import org.jboss.ejb.plugins.iiop.CDRStream;
import org.jboss.ejb.plugins.iiop.client.DynamicStub;
import org.jboss.ejb.plugins.iiop.client.StubStrategy;
/**
* Utility class responsible for the dynamic generation of bytecodes of
* IIOP stub classes.
*
* @author Unknown
* @author a href=mailto:[EMAIL PROTECTED];Francisco Reverbel/a
* @version $Revision: 1.1 $
*/
public class IIOPStubCompiler
{
// Constants --
/**
* Parameter type array for codeStubStrategy.forMethod()/code
* invocations.
*/
private static final Class[] stubStrategyParams = {
String[].class, String[].class, String[].class, String.class,
ClassLoader.class
};
/**
* Parameter type array for codeDynamicStub.invoke()/code invocations.
*/
private static final Class[] invokeParams = {
String.class, StubStrategy.class, Object[].class
};
/**
* Parameter type array for
* codeorg.omg.CORBA.ORB.object_to_string()/code invocations.
*/
private static final Class[] corbaObjectParam = {
org.omg.CORBA.Object.class
};
/**
* Parameter type array for a method that takes a single string parameter.
*/
private static final Class[] stringParam = {
String.class
};
/**
* Parameter type array for a method that takes no parameters.
*/
private static final Class[] noParams = { };
// Private methods
/**
* Returns the name of the stub strategy field associated with the method
* whose index is codemethodIndex/code.
*/
private static String strategy(int methodIndex) {
return $s + methodIndex;
}
/**
* Returns the name of static initializer method associated with the method
* whose index is codemethodIndex/code.
*/
private static String init(int methodIndex) {
return $i + methodIndex;
}
/**
* Generates the code of a given method within a stub class.
*
* @param asm the codeProxyAssembler/code used to assemble
* the method code
* @param superclassthe superclass of the stub class within which the
* method will be generated
* @param m a codeMethod/code instance describing the
* method declaration by an RMI/IDL interface
* @param idlName a string with the method name mapped to IDL
* @param strategyField a string with the name of the strategy field that
* will be associated with the generated method
* @param initMethoda string with the name of the static initialization
* method that will be associated with the generated
* method.
*/
private static void generateMethodCode(ProxyAssembler asm,
Class superclass,
Method m,
String idlName,
String strategyField,
String initMethod)
{
String methodName = m.getName();
Class returnType = m.getReturnType();
Class[] paramTypes = m.getParameterTypes();
Class[] exceptions = m.getExceptionTypes();
//