Class RMIClassLoaderSpi

java.lang.Object
java.rmi.server.RMIClassLoaderSpi

public abstract classRMIClassLoaderSpiextendsObject
RMIClassLoaderSpi is the service provider interface forRMIClassLoader. In particular, anRMIClassLoaderSpi instance provides an implementation of the following static methods ofRMIClassLoader: When one of those methods is invoked, its behavior is to delegate to a corresponding method on an instance of this class. The details of how each method delegates to the provider instance is described in the documentation for each particular method. See the documentation forRMIClassLoader for a description of how a provider instance is chosen.
Since:
1.4
See Also:
  • Constructor Details

    • RMIClassLoaderSpi

      public RMIClassLoaderSpi()
      Constructor for subclasses to call.
  • Method Details

    • loadClass

      public abstract Class<?> loadClass(String codebase,String name,ClassLoader defaultLoader) throwsMalformedURLException,ClassNotFoundException
      Provides the implementation forRMIClassLoader.loadClass(URL,String),RMIClassLoader.loadClass(String,String), andRMIClassLoader.loadClass(String,String,ClassLoader). Loads a class from a codebase URL path, optionally using the supplied loader. Typically, a provider implementation will attempt to resolve the named class using the givendefaultLoader, if specified, before attempting to resolve the class from the codebase URL path.

      An implementation of this method must either return a class with the given name or throw an exception.

      Parameters:
      codebase - the list of URLs (separated by spaces) to load the class from, ornull
      name - the name of the class to load
      defaultLoader - additional contextual class loader to use, ornull
      Returns:
      theClass object representing the loaded class
      Throws:
      MalformedURLException - ifcodebase is non-null and contains an invalid URL, or ifcodebase isnull and a provider-specific URL used to load classes is invalid
      ClassNotFoundException - if a definition for the class could not be found at the specified location
    • loadProxyClass

      public abstract Class<?> loadProxyClass(String codebase,String[] interfaces,ClassLoader defaultLoader) throwsMalformedURLException,ClassNotFoundException
      Provides the implementation forRMIClassLoader.loadProxyClass(String,String[],ClassLoader). Loads a dynamic proxy class (seeProxy that implements a set of interfaces with the given names from a codebase URL path, optionally using the supplied loader.

      An implementation of this method must either return a proxy class that implements the named interfaces or throw an exception.

      Parameters:
      codebase - the list of URLs (space-separated) to load classes from, ornull
      interfaces - the names of the interfaces for the proxy class to implement
      defaultLoader - additional contextual class loader to use, ornull
      Returns:
      a dynamic proxy class that implements the named interfaces
      Throws:
      MalformedURLException - ifcodebase is non-null and contains an invalid URL, or ifcodebase isnull and a provider-specific URL used to load classes is invalid
      ClassNotFoundException - if a definition for one of the named interfaces could not be found at the specified location, or if creation of the dynamic proxy class failed (such as ifProxy.getProxyClass(ClassLoader,Class[]) would throw anIllegalArgumentException for the given interface list)
    • getClassLoader

      public abstract ClassLoader getClassLoader(String codebase) throwsMalformedURLException
      Provides the implementation forRMIClassLoader.getClassLoader(String). Returns a class loader that loads classes from the given codebase URL path.
      Parameters:
      codebase - the list of URLs (space-separated) from which the returned class loader will load classes from, ornull
      Returns:
      a class loader that loads classes from the given codebase URL path
      Throws:
      MalformedURLException - ifcodebase is non-null and contains an invalid URL, or ifcodebase isnull and a provider-specific URL used to identify the class loader is invalid
    • getClassAnnotation

      public abstract String getClassAnnotation(Class<?> cl)
      Provides the implementation forRMIClassLoader.getClassAnnotation(Class). Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.
      Parameters:
      cl - the class to obtain the annotation for
      Returns:
      a string to be used to annotate the given class when it gets marshalled, ornull
      Throws:
      NullPointerException - ifcl isnull