Package com.sun.ejb

Class EJBUtils


  • public class EJBUtils
    extends 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 Detail

      • EJBUtils

        public EJBUtils()
    • Method Detail

      • serializeObject

        public static final byte[] serializeObject​(Object obj,
                                                   boolean replaceObject)
                                            throws 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:
        IOException
      • deserializeObject

        public static final Object deserializeObject​(byte[] data,
                                                     ClassLoader loader,
                                                     boolean resolveObject,
                                                     long appUniqueId)
                                              throws 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.
        Parameters:
        data -
        loader -
        resolveObject -
        appUniqueId -
        Returns:
        object
        Throws:
        Exception
      • useStaticCodegen

        public static boolean useStaticCodegen()
      • getGeneratedOptionalInterfaceName

        public static String getGeneratedOptionalInterfaceName​(String ejbClassName)
      • getGeneratedSerializableClassName

        public static String getGeneratedSerializableClassName​(String beanClass)
      • getGeneratedRemoteIntfName

        public static String getGeneratedRemoteIntfName​(String businessIntf)
      • getGeneratedRemoteWrapperName

        public static String getGeneratedRemoteWrapperName​(String businessIntf)
      • getGenericEJBHomeClassName

        public static String getGenericEJBHomeClassName()
      • getRemoteEjbJndiName

        public static 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 String getRemote30HomeJndiName​(String jndiName)
      • getRemoteEjbJndiName

        public static String getRemoteEjbJndiName​(boolean businessView,
                                                  String interfaceName,
                                                  String jndiName)
      • loadGeneratedRemoteBusinessClasses

        public static void loadGeneratedRemoteBusinessClasses​(String businessInterfaceName)
                                                       throws Exception
        Throws:
        Exception
      • loadGeneratedRemoteBusinessClasses

        public static void loadGeneratedRemoteBusinessClasses​(ClassLoader appClassLoader,
                                                              String businessInterfaceName)
                                                       throws Exception
        Throws:
        Exception