com.sun.ejb
Class EJBUtils

java.lang.Object
  extended by com.sun.ejb.EJBUtils

public class EJBUtils
extends java.lang.Object

A handy class with static utility methods. Note that much of this code has to execute in the client so it needs to be careful about which server-only resources it uses and in which code paths.


Constructor Summary
EJBUtils()
           
 
Method Summary
static RemoteBusinessWrapperBase createRemoteBusinessObject(java.lang.ClassLoader loader, java.lang.String businessInterface, java.rmi.Remote delegate)
           
static RemoteBusinessWrapperBase createRemoteBusinessObject(java.lang.String businessInterface, java.rmi.Remote delegate)
           
static java.lang.Object deserializeObject(byte[] data, java.lang.ClassLoader loader)
           
static java.lang.Object deserializeObject(byte[] data, java.lang.ClassLoader loader, boolean resolveObject)
          Utility method for deserializing EJBs, primary keys and container-managed fields, all of which may include Remote EJB references, Local refs, JNDI Contexts etc which are not Serializable.
static void deserializeObjectFields(java.lang.Object instance, java.io.ObjectInputStream ois)
           
static java.lang.Class generateSEI(ClassGeneratorFactory cgf, java.lang.String seiClassName, java.lang.ClassLoader loader, java.lang.Class beanClass)
           
static java.lang.String getGeneratedOptionalInterfaceName(java.lang.String ejbClassName)
           
static java.lang.String getGeneratedRemoteIntfName(java.lang.String businessIntf)
           
static java.lang.String getGeneratedRemoteWrapperName(java.lang.String businessIntf)
           
static java.lang.String getGeneratedSerializableClassName(java.lang.String beanClass)
           
static java.lang.String getGenericEJBHomeClassName()
           
static java.lang.String getRemote30HomeJndiName(java.lang.String jndiName)
           
static java.lang.String getRemoteEjbJndiName(boolean businessView, java.lang.String interfaceName, java.lang.String jndiName)
           
static java.lang.String getRemoteEjbJndiName(EjbReferenceDescriptor refDesc)
          Actual jndi-name under which Remote ejb factory lives depends on whether it's a Remote Home view or Remote Business view.
static java.lang.Class loadGeneratedGenericEJBHomeClass(java.lang.ClassLoader appClassLoader)
           
static void loadGeneratedRemoteBusinessClasses(java.lang.ClassLoader appClassLoader, java.lang.String businessInterfaceName)
           
static void loadGeneratedRemoteBusinessClasses(java.lang.String businessInterfaceName)
           
static java.lang.Class loadGeneratedSerializableClass(java.lang.ClassLoader loader, java.lang.String className)
           
static java.lang.Object lookupRemote30BusinessObject(java.lang.Object jndiObj, java.lang.String businessInterface)
           
static java.lang.Object resolveEjbRefObject(EjbReferenceDescriptor refDesc, java.lang.Object jndiObj)
           
static byte[] serializeObject(java.lang.Object obj)
           
static byte[] serializeObject(java.lang.Object obj, boolean replaceObject)
          Utility methods for serializing EJBs, primary keys and container-managed fields, all of which may include Remote EJB references, Local refs, JNDI Contexts etc which are not Serializable.
static void serializeObjectFields(java.lang.Object instance, java.io.ObjectOutputStream oos)
           
static boolean useStaticCodegen()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJBUtils

public EJBUtils()
Method Detail

serializeObject

public static final byte[] serializeObject(java.lang.Object obj,
                                           boolean replaceObject)
                                    throws java.io.IOException
Utility methods for serializing EJBs, primary keys and container-managed fields, all of which may include Remote EJB references, Local refs, JNDI Contexts etc which are not Serializable. This is not used for normal RMI-IIOP serialization. It has boolean replaceObject control, whether to call replaceObject or not

Throws:
java.io.IOException

serializeObject

public static final byte[] serializeObject(java.lang.Object obj)
                                    throws java.io.IOException
Throws:
java.io.IOException

deserializeObject

public static final java.lang.Object deserializeObject(byte[] data,
                                                       java.lang.ClassLoader loader,
                                                       boolean resolveObject)
                                                throws java.lang.Exception
Utility method for deserializing EJBs, primary keys and container-managed fields, all of which may include Remote EJB references, Local refs, JNDI Contexts etc which are not Serializable.

Throws:
java.lang.Exception

deserializeObject

public static final java.lang.Object deserializeObject(byte[] data,
                                                       java.lang.ClassLoader loader)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

useStaticCodegen

public static boolean useStaticCodegen()

getGeneratedOptionalInterfaceName

public static java.lang.String getGeneratedOptionalInterfaceName(java.lang.String ejbClassName)

getGeneratedSerializableClassName

public static java.lang.String getGeneratedSerializableClassName(java.lang.String beanClass)

getGeneratedRemoteIntfName

public static java.lang.String getGeneratedRemoteIntfName(java.lang.String businessIntf)

getGeneratedRemoteWrapperName

public static java.lang.String getGeneratedRemoteWrapperName(java.lang.String businessIntf)

getGenericEJBHomeClassName

public static java.lang.String getGenericEJBHomeClassName()

getRemoteEjbJndiName

public static java.lang.String getRemoteEjbJndiName(EjbReferenceDescriptor refDesc)
Actual jndi-name under which Remote ejb factory lives depends on whether it's a Remote Home view or Remote Business view. This is necessary since a single session bean can expose both views and the resulting factory objects are different. These semantics are not exposed to the developer-view to keep things simpler. The developer can simply deal with a single physical jndi-name. If the target bean exposes both a Remote Home view and a Remote Business view, the developer can still use the single physical jndi-name to resolve remote ejb-refs, and we will handle the distinction internally. Of course, this is based on the assumption that the internal name is generated in a way that will not clash with a separate top-level physical jndi-name chosen by the developer. Note that it's better to delay this final jndi name translation as much as possible and do it right before the NamingManager lookup, as opposed to changing the jndi-name within the descriptor objects themselves. This way, the extra indirection will not be exposed if the descriptors are written out and they won't complicate any jndi-name equality logic.


getRemote30HomeJndiName

public static java.lang.String getRemote30HomeJndiName(java.lang.String jndiName)

getRemoteEjbJndiName

public static java.lang.String getRemoteEjbJndiName(boolean businessView,
                                                    java.lang.String interfaceName,
                                                    java.lang.String jndiName)

resolveEjbRefObject

public static java.lang.Object resolveEjbRefObject(EjbReferenceDescriptor refDesc,
                                                   java.lang.Object jndiObj)
                                            throws javax.naming.NamingException
Throws:
javax.naming.NamingException

lookupRemote30BusinessObject

public static java.lang.Object lookupRemote30BusinessObject(java.lang.Object jndiObj,
                                                            java.lang.String businessInterface)
                                                     throws javax.naming.NamingException
Throws:
javax.naming.NamingException

loadGeneratedSerializableClass

public static java.lang.Class loadGeneratedSerializableClass(java.lang.ClassLoader loader,
                                                             java.lang.String className)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

loadGeneratedRemoteBusinessClasses

public static void loadGeneratedRemoteBusinessClasses(java.lang.String businessInterfaceName)
                                               throws java.lang.Exception
Throws:
java.lang.Exception

loadGeneratedRemoteBusinessClasses

public static void loadGeneratedRemoteBusinessClasses(java.lang.ClassLoader appClassLoader,
                                                      java.lang.String businessInterfaceName)
                                               throws java.lang.Exception
Throws:
java.lang.Exception

loadGeneratedGenericEJBHomeClass

public static java.lang.Class loadGeneratedGenericEJBHomeClass(java.lang.ClassLoader appClassLoader)
                                                        throws java.lang.Exception
Throws:
java.lang.Exception

generateSEI

public static java.lang.Class generateSEI(ClassGeneratorFactory cgf,
                                          java.lang.String seiClassName,
                                          java.lang.ClassLoader loader,
                                          java.lang.Class beanClass)

createRemoteBusinessObject

public static RemoteBusinessWrapperBase createRemoteBusinessObject(java.lang.String businessInterface,
                                                                   java.rmi.Remote delegate)
                                                            throws java.lang.Exception
Throws:
java.lang.Exception

createRemoteBusinessObject

public static RemoteBusinessWrapperBase createRemoteBusinessObject(java.lang.ClassLoader loader,
                                                                   java.lang.String businessInterface,
                                                                   java.rmi.Remote delegate)
                                                            throws java.lang.Exception
Throws:
java.lang.Exception

serializeObjectFields

public static void serializeObjectFields(java.lang.Object instance,
                                         java.io.ObjectOutputStream oos)
                                  throws java.io.IOException
Throws:
java.io.IOException

deserializeObjectFields

public static void deserializeObjectFields(java.lang.Object instance,
                                           java.io.ObjectInputStream ois)
                                    throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.