public class ClasspathDescriptorFileFinder extends Object implements DescriptorFileFinder, DescriptorFileFinderInformation
DescriptorFileFinder
that
uses a particular classloader in order to find descriptor files.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(ClassLoader cl)
This constructor can be used to select the particular classloader
to search for HK2 descriptor files.
|
ClasspathDescriptorFileFinder(ClassLoader cl,
String... names)
This constructor can be used to select the particular classloader
to search for HK2 descriptor files.
|
Modifier and Type | Method and Description |
---|---|
List<InputStream> |
findDescriptorFiles()
Simple implementation of the findDescriptorFiles which does a
simple getResources on the classloader in order to find the
hk2 descriptor files
|
List<String> |
getDescriptorFileInformation()
This list must have the same cardinality as
DescriptorFileFinder.findDescriptorFiles() . |
String |
toString() |
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(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(ClassLoader cl, 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 List<InputStream> findDescriptorFiles() throws IOException
findDescriptorFiles
in interface DescriptorFileFinder
IOException
- If there was an error finding the hk2 inhabitant filespublic List<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 indexCopyright © 2009–2019 Oracle Corporation. All rights reserved.