Class ClasspathDescriptorFileFinder

java.lang.Object
org.glassfish.hk2.utilities.ClasspathDescriptorFileFinder
All Implemented Interfaces:
DescriptorFileFinder, DescriptorFileFinderInformation

public class ClasspathDescriptorFileFinder extends Object implements DescriptorFileFinder, DescriptorFileFinderInformation
This is an implementation of DescriptorFileFinder that uses a particular classloader in order to find descriptor files.
Author:
jwells
  • Constructor Details

    • ClasspathDescriptorFileFinder

      public ClasspathDescriptorFileFinder()
      If this constructor is used then HK2 descriptor files will be found by looking in the classpath of the process. The classloader used will be the classloader for this class itself. The names of the files found will be META-INF/hk2-locator/default.

      This is most commonly used when using HK2 from a stand-alone client in which all the JAR files are on a single classpath

    • ClasspathDescriptorFileFinder

      public ClasspathDescriptorFileFinder(ClassLoader cl)
      This constructor can be used to select the particular classloader to search for HK2 descriptor files. The names of the the files found in this classloader will be META-INF/hk2-locator/default.

      This is commonly used in more complex classloading scenarios where the HK2 descriptor files are not necessarily on the system classpath.

      Parameters:
      cl - May not be null and must be the classloader to use when searching for HK2 descriptor files
    • ClasspathDescriptorFileFinder

      public ClasspathDescriptorFileFinder(ClassLoader cl, String... names)
      This constructor can be used to select the particular classloader to search for HK2 descriptor files. The names of the the files found in this classloader will be META-INF/hk2-locator/name.
      Parameters:
      cl - May not be null and must be the classloader to use when searching for HK2 descriptor files
      names - May not be null and must be the name of the files to search for in the META-INF/hk2-locator directory
    • ClasspathDescriptorFileFinder

      public ClasspathDescriptorFileFinder(String resourceBase, ClassLoader cl)
      This constructor can be used to select the particular classloader to search for all files from the given locator directory. By using this constructor, all files in the given directory are assumed to be HK2 descriptor files.
      Parameters:
      resourceBase - The directory of locator files, the class loader will search from
      cl - May not be null and must be the classloader to use when searching for HK2 descriptor files
  • Method Details