public class ClasspathDescriptorFileFinder extends java.lang.Object implements DescriptorFileFinder, DescriptorFileFinderInformation
DescriptorFileFinder
that
uses a particular classloader in order to find descriptor files.Modifier and Type | Field and Description |
---|---|
private java.lang.ClassLoader |
classLoader |
private static boolean |
DEBUG_DESCRIPTOR_FINDER |
private static java.lang.String |
DEBUG_DESCRIPTOR_FINDER_PROPERTY |
private static java.lang.String |
DEFAULT_NAME |
private java.util.ArrayList<java.lang.String> |
identifiers |
private java.lang.String[] |
names |
RESOURCE_BASE
Constructor and Description |
---|
ClasspathDescriptorFileFinder()
If this constructor is used then HK2 descriptor files will be found
by looking in the classpath of the process.
|
ClasspathDescriptorFileFinder(java.lang.ClassLoader cl)
This constructor can be used to select the particular classloader
to search for HK2 descriptor files.
|
ClasspathDescriptorFileFinder(java.lang.ClassLoader cl,
java.lang.String... names)
This constructor can be used to select the particular classloader
to search for HK2 descriptor files.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.io.InputStream> |
findDescriptorFiles()
Simple implementation of the findDescriptorFiles which does a
simple getResources on the classloader in order to find the
hk2 descriptor files
|
java.util.List<java.lang.String> |
getDescriptorFileInformation()
This list must have the same cardinality as
DescriptorFileFinder.findDescriptorFiles() . |
java.lang.String |
toString() |
private static final java.lang.String DEBUG_DESCRIPTOR_FINDER_PROPERTY
private static final boolean DEBUG_DESCRIPTOR_FINDER
private static final java.lang.String DEFAULT_NAME
private final java.lang.ClassLoader classLoader
private final java.lang.String[] names
private final java.util.ArrayList<java.lang.String> identifiers
public ClasspathDescriptorFileFinder()
This is most commonly used when using HK2 from a stand-alone client in which all the JAR files are on a single classpath
public ClasspathDescriptorFileFinder(java.lang.ClassLoader cl)
This is commonly used in more complex classloading scenarios where the HK2 descriptor files are not necessarily on the system classpath.
cl
- May not be null and must be the classloader to use when
searching for HK2 descriptor filespublic ClasspathDescriptorFileFinder(java.lang.ClassLoader cl, java.lang.String... names)
cl
- May not be null and must be the classloader to use when
searching for HK2 descriptor filesnames
- May not be null and must be the name of the files to
search for in the META-INF/hk2-locator directorypublic java.util.List<java.io.InputStream> findDescriptorFiles() throws java.io.IOException
findDescriptorFiles
in interface DescriptorFileFinder
java.io.IOException
- If there was an error finding the hk2 inhabitant filespublic java.util.List<java.lang.String> getDescriptorFileInformation()
DescriptorFileFinderInformation
DescriptorFileFinder.findDescriptorFiles()
.
The Strings returned from this list must give identifying
information about the InputStream with the same index.
For example, if the InputStream is from a URL
then the toString of the URL would be appropriate. If
the InputStream is from a File
then the
Absolute path to that file might be appropriategetDescriptorFileInformation
in interface DescriptorFileFinderInformation
DescriptorFileFinder.findDescriptorFiles()
correlated by indexpublic java.lang.String toString()
toString
in class java.lang.Object