Class DfltLoaderMgr

  • All Implemented Interfaces:
    IQBPLoaderMgr

    public class DfltLoaderMgr
    extends java.lang.Object
    implements IQBPLoaderMgr
    Default implementation of the QBP loader manager interface. By Default this returns the standard loader for the current thread. Optionally it can be configured to provide a loader to load a specific class file as long as it is under a specific directory.
    • Constructor Summary

      Constructors 
      Constructor Description
      DfltLoaderMgr()
      Default constructor: only loads from standard class path.
      DfltLoaderMgr​(java.io.File loader_dir)
      Load from standard class path, or from directories under a specified directory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.ClassLoader getLoaderFor​(java.lang.String class_name, java.lang.String class_source)
      Get a class loader for a particular class and source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DfltLoaderMgr

        public DfltLoaderMgr()
                      throws java.lang.SecurityException
        Default constructor: only loads from standard class path. This creates a class loader manager that only loads classes from the default class path; i.e. from the default loader for the current thread.
        Throws:
        java.lang.SecurityException - if loading classes is not allowed for this thread.
      • DfltLoaderMgr

        public DfltLoaderMgr​(java.io.File loader_dir)
                      throws java.lang.SecurityException,
                             java.lang.IllegalArgumentException
        Load from standard class path, or from directories under a specified directory. This creates a class loader manager that loads classes from the default class path; i.e. from the default loader for the current thread, or from class files located under the specified directory.
        Parameters:
        loader_dir - the directory we can load from.
        Throws:
        java.lang.SecurityException - if loading classes is not allowed for this thread.
        java.lang.IllegalArgumentException - if loader_dir is null, or not a valid path.
    • Method Detail

      • getLoaderFor

        public java.lang.ClassLoader getLoaderFor​(java.lang.String class_name,
                                                  java.lang.String class_source)
                                           throws java.lang.UnsupportedOperationException,
                                                  java.lang.IllegalArgumentException,
                                                  java.lang.Exception
        Get a class loader for a particular class and source.
        Specified by:
        getLoaderFor in interface IQBPLoaderMgr
        Parameters:
        class_name - the fully qualified class name
        class_source - this identifies a source for the class. This may be left null, in which case this uses the default loader for this thread. If non-null this is a path to the class file.
        Returns:
        a QBPClasssLoader object to use to load the identified class.
        Throws:
        java.lang.UnsupportedOperationException - if class_source is non-null and loading from that source is not allowed.
        java.lang.IllegalArgumentException - if class_name is null, or loading of that class is not allowed.
        java.lang.Exception - on other errors.