Class CommonClassLoader

All Implemented Interfaces:
Closeable, AutoCloseable, LoggableClassLoader, ComponentLoader

public class CommonClassLoader extends CustomURLClassLoader implements ComponentLoader
The CommonClassLoader implements ComponentLoader interface and is created by the RioServiceDescriptor or org.jini.rio.boot.RioActivatableServiceDescriptor when starting a Rio service and contains common declared platform JARs to be made available to its children.

The CommonClassLoader enables a platform oriented framework conducive towards creating a layered product. The resulting capabilities allow the declaration of JARs that are added to the CommonClassLoader, making the classes accessible by all ClassLoader instances which delegate to the CommonClassLoader. In this fashion a platform can be declared, initialized and made available.

The ClassLoader hierarchy when starting a Rio service is as follows :

          AppCL
            |
    CommonClassLoader
            +
            |
    +-------+-------+----...---+
    |               |          |
  Service-1CL   Service-2CL  Service-nCL
  • Method Details

    • setDisableSmartGetUrl

      public void setDisableSmartGetUrl(boolean disableSmartGetUrl)
    • getInstance

      public static CommonClassLoader getInstance()
      Get an instance of the CommonCLassLoader
      Returns:
      The CommonClassLoader
    • getURLs

      public URL[] getURLs()
      Override getURLs to ensure when an Object is marshalled its annotation is correct
      Overrides:
      getURLs in class URLClassLoader
      Returns:
      Array of URLs
    • getSearchPath

      public URL[] getSearchPath()
      Description copied from class: CustomURLClassLoader
      Alternate method for getURLs (some implementations override it in a non-traceable fashion)
      Overrides:
      getSearchPath in class CustomURLClassLoader
      Returns:
    • testComponentExistence

      public boolean testComponentExistence(String name)
      Description copied from interface: ComponentLoader
      Test whether a named component (Class) exists.
      Specified by:
      testComponentExistence in interface ComponentLoader
      Parameters:
      name - The component name
      Returns:
      true If the requested component can be located, false otherwise.
      See Also:
    • addCommonJARs

      public void addCommonJARs(URL[] jars)
      Add common JARs
      Parameters:
      jars - Array of URLs
    • testResourceExistence

      public boolean testResourceExistence(String name)
      Description copied from interface: ComponentLoader
      Test whether a named resource exists. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

      The name of a resource is a '/ '-separated path name that identifies the resource.

      Specified by:
      testResourceExistence in interface ComponentLoader
      Parameters:
      name - The resource name
      Returns:
      true If the requested resource can be located, false otherwise.
      See Also:
    • addComponent

      public void addComponent(String name, URL[] urls)
      Description copied from interface: ComponentLoader
      Registers a class name, and the code source which is used as the search path to load the class.
      Specified by:
      addComponent in interface ComponentLoader
      Parameters:
      name - The name of the class
      urls - Codebase for the class identified by the name parameter
      See Also:
    • load

      Description copied from interface: ComponentLoader
      Creates an Object which has been added to the ComponentLoader using the addSystemComponent method, or is in the classpath of the ComponentLoader. The Object is loaded from the registered code source.
      Specified by:
      load in interface ComponentLoader
      Parameters:
      name - The name of the class. The resulting class will be loaded and a new instance of the class created using a zero-arg contructor.
      Throws:
      ClassNotFoundException - - If the class cannot be located by the class loader or it has not been registered
      IllegalAccessException - - If the Class or its nullary constructor is not accessible.
      InstantiationException - - If this Class represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
      See Also: