Class RemoteClass

  • All Implemented Interfaces:
    Constants, RMIConstants, Constants, RuntimeConstants

    public class RemoteClass
    extends java.lang.Object
    implements RMIConstants
    A RemoteClass object encapsulates RMI-specific information about a remote implementation class, i.e. a class that implements one or more remote interfaces. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Field Detail

      • implClassDef

        private ClassDefinition implClassDef
        the remote implementation class this object corresponds to
      • remoteInterfaces

        private ClassDefinition[] remoteInterfaces
        remote interfaces implemented by this class
      • remoteMethods

        private RemoteClass.Method[] remoteMethods
        all the remote methods of this class
      • interfaceHash

        private long interfaceHash
        stub/skeleton "interface hash" for this class
      • defRemote

        private ClassDefinition defRemote
        cached definition for certain classes used in this environment
    • Constructor Detail

      • RemoteClass

        private RemoteClass​(BatchEnvironment env,
                            ClassDefinition implClassDef)
        Create a RemoteClass instance for the given class. The resulting object is not yet initialized.
    • Method Detail

      • forClass

        public static RemoteClass forClass​(BatchEnvironment env,
                                           ClassDefinition implClassDef)
        Create a RemoteClass object representing the remote meta-information of the given class. Returns true if successful. If the class is not a properly formed remote implementation class or if some other error occurs, the return value will be null, and errors will have been reported to the supplied BatchEnvironment.
      • getClassDefinition

        public ClassDefinition getClassDefinition()
        Return the ClassDefinition for this class.
      • getName

        public Identifier getName()
        Return the name of the class represented by this object.
      • getRemoteInterfaces

        public ClassDefinition[] getRemoteInterfaces()
        Return an array of ClassDefinitions representing all of the remote interfaces implemented by this class. A remote interface is any interface that extends Remote, directly or indirectly. The remote interfaces of a class are the interfaces directly listed in either the class's "implements" clause, or the "implements" clause of any of its superclasses, that are remote interfaces. The order of the array returned is arbitrary, and some elements may be superfluous (i.e., superinterfaces of other interfaces in the array).
      • getRemoteMethods

        public RemoteClass.Method[] getRemoteMethods()
        Return an array of RemoteClass.Method objects representing all of the remote methods implemented by this class, i.e. all of the methods in the class's remote interfaces. The methods in the array are ordered according to the comparison of the strings consisting of their method name followed by their type signature, so each method's index in the array corresponds to its "operation number" in the JDK 1.1 version of the stub/skeleton protocol.
      • getInterfaceHash

        public long getInterfaceHash()
        Return the "interface hash" used to match a stub/skeleton pair for this class in the JDK 1.1 version of the stub/skeleton protocol.
      • toString

        public java.lang.String toString()
        Return string representation of this object, consisting of the string "remote class " followed by the class name.
        Overrides:
        toString in class java.lang.Object
      • initialize

        private boolean initialize()
        Validate that the remote implementation class is properly formed and fill in the data structures required by the public interface.
      • collectRemoteMethods

        private boolean collectRemoteMethods​(ClassDefinition interfaceDef,
                                             java.util.Hashtable<java.lang.String,​RemoteClass.Method> table)
        Collect and validate all methods from given interface and all of its superinterfaces as remote methods. Remote methods are added to the supplied hashtable. Returns true if successful, or false if an error occurred.
      • computeInterfaceHash

        private long computeInterfaceHash()
        Compute the "interface hash" of the stub/skeleton pair for this remote implementation class. This is the 64-bit value used to enforce compatibility between a stub and a skeleton using the JDK 1.1 version of the stub/skeleton protocol. It is calculated using the first 64 bits of a SHA digest. The digest is from a stream consisting of the following data: (int) stub version number, always 1 for each remote method, in order of operation number: (UTF) method name (UTF) method type signature for each declared exception, in alphabetical name order: (UTF) name of exception class
      • sortClassDeclarations

        private void sortClassDeclarations​(ClassDeclaration[] decl)
        Sort array of class declarations alphabetically by their mangled fully-qualified class name. This is used to feed a method's exceptions in a canonical order into the digest stream for the interface hash computation.