it.imolinfo.jbi4ejb.runtime.ejbproxy
Class EJBProxyUtils

java.lang.Object
  extended by it.imolinfo.jbi4ejb.runtime.ejbproxy.EJBProxyUtils

public final class EJBProxyUtils
extends java.lang.Object

EJBProxy helper methods.

Author:
Marco Piraccini

Method Summary
static EJBClasses createEJBClasses(java.io.File wsdlFile, java.util.Properties classesId, java.io.File tempDir, java.util.List<java.lang.String> jarFilesName, java.lang.String remoteInterfaceName, java.lang.String portTypeName)
          Creates the EJB classes.
static java.lang.String createEJBClasses(java.lang.String wsdlPath, java.lang.String remoteInterfaceClassName, java.lang.String portTypeName, java.util.Properties classesId, java.util.List<java.lang.String> jarFilesName)
          Creates the EJB classes, creating an external temp dir (for testing pourpouse).
static java.lang.Object createStatelessEJBFromCorbaName(java.lang.String corbaname, java.lang.String remoteInterfaceName, java.lang.ClassLoader ejbClassLoader, org.omg.CORBA.ORB orb)
          Creates the stateless EJB and the stub.
static java.lang.Object createStatelessEJBFromJNDI(java.lang.String jndiName, java.util.Properties jndiParams, java.lang.String remoteInterfaceName, java.lang.ClassLoader ejbClassLoader)
          Creates the stateless EJB, using JNDI to lookup the home object.
static java.lang.Object createStatelessEJBUsingRMIClassLoader(java.lang.String corbaname, java.lang.String remoteInterfaceName, java.lang.Class myRemoteInterfaceClass, org.omg.CORBA.ORB orb)
          Creates the stateless EJB and try to get a reference using the RMIClassLoader and trying to dinamically load the stub and the paramete/return classes.
static org.omg.CORBA.portable.ObjectImpl createStatelessHomeFromJNDI(java.lang.String jndiName, java.util.Properties jndiParams, java.lang.String remoteInterfaceName, java.lang.ClassLoader ejbClassLoader)
          Creates the stateless EJB, using JNDI to lookup the home object.
static java.lang.String findRemoteInterfaceCompleteClassName(java.lang.String sourcesDir, java.lang.String className)
          Retrieve the remote interface class name from the class name (without package).
static java.lang.Object getEJBFromCorbaHomeObject(org.omg.CORBA.Object home, org.omg.CORBA.ORB orb, java.lang.String remoteInterfaceName, java.lang.ClassLoader ejbClassLoader)
          Gets the EJB from corba home object.
static java.lang.Class getInterfaceClass(java.lang.String remoteInterfaceClassName, java.lang.String wsdlPath, java.util.List<java.lang.String> jarFilesName)
          Creates the Class interface (to narrow in the dynamic case).
static java.lang.String getInterfaceId(java.lang.String completeClassName)
          Gets the interface id.
static java.lang.String getInterfaceName(java.lang.String completeClassName)
          Gets the interface name.
static java.lang.reflect.Method getMethodFromName(java.lang.Object remoteBean, java.lang.String methodName, java.lang.Object[] params)
          Gets the Method from the name.
static java.lang.Object invokeMethod(java.lang.Object remoteBean, java.lang.reflect.Method method, java.lang.Object[] params, java.lang.ClassLoader ejbClassLoader, org.omg.CORBA.ORB orb)
          Invoke method on the object (the proxied EJB).
static java.lang.Object invokeMethod(java.lang.Object remoteBean, java.lang.String methodName, java.lang.Object[] params, java.lang.ClassLoader ejbClassLoader, org.omg.CORBA.ORB orb)
          Invoke method on the EJB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createEJBClasses

public static EJBClasses createEJBClasses(java.io.File wsdlFile,
                                          java.util.Properties classesId,
                                          java.io.File tempDir,
                                          java.util.List<java.lang.String> jarFilesName,
                                          java.lang.String remoteInterfaceName,
                                          java.lang.String portTypeName)
                                   throws EJBDeployException
Creates the EJB classes.

Parameters:
classesId - The Hashtable with the classes uids
jarFilesName - the jar list to compile the sources The jar list to compile the generated sources
wsdlFile - the wsdl File
tempDir - the temporary directory to use
remoteInterfaceName - the remote interface class name if null, retrives-it using the portTypeName
portTypeName - the poert-tpye name used to get the remote interface name (if not specified).
Returns:
the classes dir absolute path
Throws:
EJBDeployException - If some problem occurs

createEJBClasses

public static java.lang.String createEJBClasses(java.lang.String wsdlPath,
                                                java.lang.String remoteInterfaceClassName,
                                                java.lang.String portTypeName,
                                                java.util.Properties classesId,
                                                java.util.List<java.lang.String> jarFilesName)
                                         throws EJBDeployException
Creates the EJB classes, creating an external temp dir (for testing pourpouse).

Parameters:
wsdlPath - The complete path to the wsdl
classesId - The Hashtable with the classes uids
jarFilesName - the jar list to compile the sources The jar list to compile the generated sources
portTypeName - The port type name (to identify the remote interface)
remoteInterfaceClassName - The remote interface class name
Returns:
the classes dir absolute path
Throws:
EJBDeployException - If some problem occurs

createStatelessEJBFromCorbaName

public static java.lang.Object createStatelessEJBFromCorbaName(java.lang.String corbaname,
                                                               java.lang.String remoteInterfaceName,
                                                               java.lang.ClassLoader ejbClassLoader,
                                                               org.omg.CORBA.ORB orb)
                                                        throws EJBDeployException
Creates the stateless EJB and the stub.

Parameters:
corbaname - The corbaname to locate the EJBHome
remoteInterfaceName - The remote interface class name
ejbClassLoader - The classloader to use
orb - The ORB
Returns:
the object The stateless EJB remote stub
Throws:
EJBDeployException - If some problem occurs

createStatelessEJBFromJNDI

public static java.lang.Object createStatelessEJBFromJNDI(java.lang.String jndiName,
                                                          java.util.Properties jndiParams,
                                                          java.lang.String remoteInterfaceName,
                                                          java.lang.ClassLoader ejbClassLoader)
                                                   throws EJBDeployException
Creates the stateless EJB, using JNDI to lookup the home object.

Parameters:
remoteInterfaceName - The remote interface class name
jndiName - The Jndi name
jndiParams - The Jndi params
ejbClassLoader - The ejb class loader
Returns:
the object The stateless EJB remote stub
Throws:
EJBDeployException - If some problem occurs

createStatelessHomeFromJNDI

public static org.omg.CORBA.portable.ObjectImpl createStatelessHomeFromJNDI(java.lang.String jndiName,
                                                                            java.util.Properties jndiParams,
                                                                            java.lang.String remoteInterfaceName,
                                                                            java.lang.ClassLoader ejbClassLoader)
                                                                     throws EJBDeployException
Creates the stateless EJB, using JNDI to lookup the home object.

Parameters:
remoteInterfaceName - The remote interface class name
jndiName - The jndi name
jndiParams - The jndi params
ejbClassLoader - The classloader to use
Returns:
the object The stateless EJB remote stub
Throws:
EJBDeployException - If some problem occurs

getEJBFromCorbaHomeObject

public static java.lang.Object getEJBFromCorbaHomeObject(org.omg.CORBA.Object home,
                                                         org.omg.CORBA.ORB orb,
                                                         java.lang.String remoteInterfaceName,
                                                         java.lang.ClassLoader ejbClassLoader)
                                                  throws EJBDeployException
Gets the EJB from corba home object.

Parameters:
home - The CORBA home remote object
orb - The ORB
remoteInterfaceName - The remote interface name
ejbClassLoader - The classloader to use to get the remomte interface class
Returns:
the EJB from corba home object
Throws:
EJBDeployException - if some problem occurs

getInterfaceClass

public static java.lang.Class getInterfaceClass(java.lang.String remoteInterfaceClassName,
                                                java.lang.String wsdlPath,
                                                java.util.List<java.lang.String> jarFilesName)
                                         throws EJBDeployException
Creates the Class interface (to narrow in the dynamic case). NO STUB IS CREATED

Parameters:
wsdlPath - The complete path to the wsdl
jarFilesName - the jar list to compile the sources The jar list to compile the generated sources
remoteInterfaceClassName - the remote interface class name
Returns:
the string
Throws:
EJBDeployException - If some problem occurs

createStatelessEJBUsingRMIClassLoader

public static java.lang.Object createStatelessEJBUsingRMIClassLoader(java.lang.String corbaname,
                                                                     java.lang.String remoteInterfaceName,
                                                                     java.lang.Class myRemoteInterfaceClass,
                                                                     org.omg.CORBA.ORB orb)
                                                              throws EJBDeployException
Creates the stateless EJB and try to get a reference using the RMIClassLoader and trying to dinamically load the stub and the paramete/return classes.

Parameters:
corbaname - The corbaname to locate the EJBHome
remoteInterfaceName - The remote interface class name
myRemoteInterfaceClass - The remote interface class
orb - The ORB
Returns:
the object The stateless EJB remote stub
Throws:
EJBDeployException - If some problem occurs

getInterfaceId

public static java.lang.String getInterfaceId(java.lang.String completeClassName)
Gets the interface id.

Parameters:
completeClassName - The class name
Returns:
the interface id

getInterfaceName

public static java.lang.String getInterfaceName(java.lang.String completeClassName)
Gets the interface name.

Parameters:
completeClassName - The class name
Returns:
the interface name

invokeMethod

public static java.lang.Object invokeMethod(java.lang.Object remoteBean,
                                            java.lang.reflect.Method method,
                                            java.lang.Object[] params,
                                            java.lang.ClassLoader ejbClassLoader,
                                            org.omg.CORBA.ORB orb)
                                     throws EJBInvokeException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
Invoke method on the object (the proxied EJB).

Parameters:
remoteBean - The ejb remoteobject
method - The method to call
params - The method params
ejbClassLoader - The classloader to use
orb - The orb
Returns:
the object
Throws:
EJBInvokeException - if some problem in the EJB invocation occurs
java.lang.reflect.InvocationTargetException - If an exception is thrown in the invokation
java.lang.IllegalAccessException - If there are access problems

invokeMethod

public static java.lang.Object invokeMethod(java.lang.Object remoteBean,
                                            java.lang.String methodName,
                                            java.lang.Object[] params,
                                            java.lang.ClassLoader ejbClassLoader,
                                            org.omg.CORBA.ORB orb)
                                     throws EJBInvokeException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
Invoke method on the EJB.

Parameters:
methodName - The method to invoke
params - The params for the method invocation
remoteBean - The remote bean object
ejbClassLoader - The classloader to use
orb - The orb
Returns:
the object
Throws:
EJBInvokeException - If some problems occurs in method invocation
java.lang.reflect.InvocationTargetException - If the call throws an exception
java.lang.IllegalAccessException - Problem in accesing object

getMethodFromName

public static java.lang.reflect.Method getMethodFromName(java.lang.Object remoteBean,
                                                         java.lang.String methodName,
                                                         java.lang.Object[] params)
                                                  throws EJBInvokeException
Gets the Method from the name.

Parameters:
remoteBean - The object that defines the method
methodName - The method name
params - The method params
Returns:
the method from name
Throws:
EJBInvokeException - If some problem occurs in getting the method name

findRemoteInterfaceCompleteClassName

public static java.lang.String findRemoteInterfaceCompleteClassName(java.lang.String sourcesDir,
                                                                    java.lang.String className)
                                                             throws EJBDeployException
Retrieve the remote interface class name from the class name (without package). The class name must be unique for the whole package.

Parameters:
sourcesDir - Directory where to look for the class name
className - The class name
Returns:
The class name (without the package)
Throws:
EJBDeployException - If some proble occurs in classes search


Copyright © 2007-2008 Imola Informatica. All Rights Reserved.