T - the type of JUnit test this ServiceLocatorTestRule is related to; consider making it an
instance of Binderpublic class ServiceLocatorTestRule<T> extends org.junit.rules.ExternalResource implements Binder
ExternalResource (and a Binder) that sets up and
tears down an HK2 ServiceLocator on a per-test-class or
per-test-method basis.ExternalResource,
Binder| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceLocatorTestRule.ServiceLocatorIsolation
An
enum describing possible ServiceLocator
isolation levels for JUnit tests. |
private static class |
ServiceLocatorTestRule.Visitor
A very, very special-purpose
ClassVisitorImpl suitable
only for use by the ServiceLocatorTestRule class to
determine efficiently whether a given Class is annotated
with Service or not. |
| Modifier and Type | Field and Description |
|---|---|
private org.junit.runner.Description |
description
The
Description describing the JUnit test method
currently executing. |
private ServiceLocatorTestRule.ServiceLocatorIsolation |
isolation
The
ServiceLocatorTestRule.ServiceLocatorIsolation designating whether the
ServiceLocator associated with this ServiceLocatorTestRule is set up for each test method or shared
among them. |
private ServiceLocator |
serviceLocator
The
ServiceLocator in effect for the currently executing
JUnit test method. |
private T |
test
The test instance instantiating this
ServiceLocatorTestRule. |
private boolean |
verbose
A
boolean indicating whether this ServiceLocatorTestRule is configured to output additional
information to System.out. |
| Constructor and Description |
|---|
ServiceLocatorTestRule(T test)
Creates a new
ServiceLocatorTestRule on behalf of the
supplied JUnit test in ServiceLocatorTestRule.ServiceLocatorIsolation.PER_TEST
isolation in non-verbose mode. |
ServiceLocatorTestRule(T test,
boolean verbose)
Creates a new
ServiceLocatorTestRule on behalf of the
supplied JUnit test in ServiceLocatorTestRule.ServiceLocatorIsolation.PER_TEST
isolation with the supplied verbosity. |
ServiceLocatorTestRule(T test,
ServiceLocatorTestRule.ServiceLocatorIsolation isolation)
Creates a new
ServiceLocatorTestRule on behalf of the
supplied JUnit test in the given ServiceLocatorTestRule.ServiceLocatorIsolation
in non-verbose mode. |
ServiceLocatorTestRule(T test,
ServiceLocatorTestRule.ServiceLocatorIsolation isolation,
boolean verbose)
Creates a new
ServiceLocatorTestRule on behalf of the
supplied JUnit test in the given ServiceLocatorTestRule.ServiceLocatorIsolation. |
| Modifier and Type | Method and Description |
|---|---|
void |
after()
Shuts down and cleans up the
ServiceLocator created by
this ServiceLocatorTestRule. |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description)
Overrides the
ExternalResource.apply(Statement,
Description) method to save the supplied Description so
that other methods in this class can refer to it. |
void |
before()
When necessary, calls the
createServiceLocator(Description), configureServiceLocator(ServiceLocator, Description) and performDependencyInjection(ServiceLocator, Object) methods in
order to set up a ServiceLocator appropriate for the
current JUnit test. |
void |
bind(DynamicConfiguration dynamicConfiguration)
Called at the appropriate time by the
configureServiceLocator(ServiceLocator, Description) method in
case subclasses wish to add services to the ServiceLocator being configured. |
private void |
bind(DynamicConfiguration configuration,
java.lang.reflect.AnnotatedElement element)
Retrieves any
Annotations found on the supplied
AnnotatedElement and calls the bind(DynamicConfiguration, Collection) method supplying them as
the second parameter. |
private static void |
bind(DynamicConfiguration configuration,
java.io.BufferedReader reader)
Reads the
HK2 locator file represented by the supplied
BufferedReader and binds the
Descriptors it represents. |
private void |
bind(DynamicConfiguration configuration,
Classes classes)
Binds all
Classes "reachable" from the supplied Classes annotation. |
private void |
bind(DynamicConfiguration configuration,
java.util.Collection<? extends java.lang.annotation.Annotation> annotations)
Recursively examines the
Annotations supplied looking for
instances of the Classes, InhabitantFiles and
Packages annotations, and, using the binding methods on
the supplied DynamicConfiguration binds Descriptors for those "reachable" classes into the
configuration. |
private static void |
bind(DynamicConfiguration configuration,
InhabitantFiles inhabitantFiles)
Gathers all classpath resource names found in the supplied
InhabitantFiles annotation representing HK2 locator files and
calls the bind(DynamicConfiguration, String) method for
each such entry found. |
private void |
bind(DynamicConfiguration configuration,
Packages packages)
Binds all
Classes "reachable" from packages described by
the supplied Packages annotation. |
private void |
bind(DynamicConfiguration configuration,
java.util.Set<java.lang.String> packageNames)
Binds all
Classes "reachable" from the supplied packages. |
private static void |
bind(DynamicConfiguration configuration,
java.lang.String locatorResourceName)
Using the context
ClassLoader, gets all classpath resources
with the supplied locatorResourceName, and iterates
through them, calling the bind(DynamicConfiguration,
URL) method for each one. |
private static void |
bind(DynamicConfiguration configuration,
java.net.URL locatorResource)
Opens an
InputStream
to the supplied URL, wraps a BufferedReader
around it, and calls the bind(DynamicConfiguration,
BufferedReader) method. |
protected void |
configureServiceLocator(ServiceLocator serviceLocator,
org.junit.runner.Description testDescription)
Configures the supplied
ServiceLocator for use by the
test described by the supplied Description. |
protected ServiceLocator |
createServiceLocator(org.junit.runner.Description testDescription)
Creates and returns a
ServiceLocator suitable for the
JUnit test described by the supplied Description. |
private static java.util.Set<java.lang.Class<?>> |
getClassesFromDirectory(java.util.Set<java.lang.String> packageNames,
java.io.File directory,
boolean verbose)
Given a
Set of package names and a File
designating an existing directory
in the classpath that can be read,
returns a Set of Service-annotated Classes that can be found there that belong to one of the
supplied package names. |
private java.util.Set<java.lang.Class<?>> |
getClassesFromPackages(java.util.Set<java.lang.String> packageNames)
Given a
Set of package names, returns a Set of
Service-annotated Classes found in those
packages, whether they are located in ZipFiles or
directories on the classpath. |
private java.util.Set<java.lang.Class<?>> |
getClassesFromZipFile(java.util.Set<java.lang.String> packageNames,
java.util.zip.ZipFile zipFile)
Given a
ZipFile (which is usually a .jar file)
containing class files and a Set of package names,
searches it to find Service-annotated Classes
inside it that belong to one of the supplied package names and
returns a Set of such Classes. |
protected java.lang.String |
getClasspath()
Returns a
String representing the classpath to use to
search for classes. |
private org.junit.runner.Description |
getDescription()
Returns the
Description describing the currently
executing JUnit test method. |
ServiceLocatorTestRule.ServiceLocatorIsolation |
getServiceLocatorIsolation()
Returns the
ServiceLocatorTestRule.ServiceLocatorIsolation for this ServiceLocatorTestRule. |
protected java.lang.String |
getServiceLocatorName(org.junit.runner.Description testDescription)
Returns a name for a
ServiceLocator that is appropriate
for the supplied Description. |
private static boolean |
isBlacklisted(java.lang.annotation.Annotation annotation)
Returns
true if the supplied Annotation is null or designates an annotation type that should be excluded
from recursive annotation scanning performed by the bind(DynamicConfiguration, AnnotatedElement) method. |
private static boolean |
isBlacklisted(java.lang.Class<? extends java.lang.annotation.Annotation> c)
Returns
true if the supplied Class is null or designates an annotation type that should be excluded
from recursive annotation scanning performed by the bind(DynamicConfiguration, AnnotatedElement) method. |
boolean |
isVerbose()
|
protected void |
performDependencyInjection(ServiceLocator serviceLocator,
T test)
Performs HK2 dependency injection on this
ServiceLocatorTestRule and the supplied test instance, using the
supplied ServiceLocator as needed. |
void |
shutdownAndDestroyServiceLocator(org.junit.runner.Description testDescription)
Blindly calls the
ServiceLocator.shutdown() and ServiceLocatorFactory.destroy(ServiceLocator) methods on this
ServiceLocatorTestRule's associated ServiceLocator if it is discovered to be non-null. |
private final T test
ServiceLocatorTestRule.
This field is never null.
private final ServiceLocatorTestRule.ServiceLocatorIsolation isolation
ServiceLocatorTestRule.ServiceLocatorIsolation designating whether the
ServiceLocator associated with this ServiceLocatorTestRule is set up for each test method or shared
among them.
This field is never null.
private final boolean verbose
boolean indicating whether this ServiceLocatorTestRule is configured to output additional
information to System.out.isVerbose()private org.junit.runner.Description description
Description describing the JUnit test method
currently executing.
This field may be null.
apply(Statement, Description)private ServiceLocator serviceLocator
ServiceLocator in effect for the currently executing
JUnit test method.
This field may be null.
public ServiceLocatorTestRule(T test)
ServiceLocatorTestRule on behalf of the
supplied JUnit test in ServiceLocatorTestRule.ServiceLocatorIsolation.PER_TEST
isolation in non-verbose mode.test - the JUnit test; must not be nulljava.lang.AssertionError - if test is nullServiceLocatorTestRule(Object, ServiceLocatorIsolation,
boolean)public ServiceLocatorTestRule(T test, boolean verbose)
ServiceLocatorTestRule on behalf of the
supplied JUnit test in ServiceLocatorTestRule.ServiceLocatorIsolation.PER_TEST
isolation with the supplied verbosity.test - the JUnit test; must not be nullverbose - whether this ServiceLocatorTestRule should
output additional information to System.outjava.lang.AssertionError - if test is nullServiceLocatorTestRule(Object, ServiceLocatorIsolation,
boolean)public ServiceLocatorTestRule(T test, ServiceLocatorTestRule.ServiceLocatorIsolation isolation)
ServiceLocatorTestRule on behalf of the
supplied JUnit test in the given ServiceLocatorTestRule.ServiceLocatorIsolation
in non-verbose mode.test - the JUnit test; must not be nullisolation - the ServiceLocatorTestRule.ServiceLocatorIsolation; if null then ServiceLocatorTestRule.ServiceLocatorIsolation.PER_TEST will be used
insteadjava.lang.AssertionError - if test is nullServiceLocatorTestRule(Object, ServiceLocatorIsolation,
boolean)public ServiceLocatorTestRule(T test, ServiceLocatorTestRule.ServiceLocatorIsolation isolation, boolean verbose)
ServiceLocatorTestRule on behalf of the
supplied JUnit test in the given ServiceLocatorTestRule.ServiceLocatorIsolation.test - the JUnit test; must not be nullisolation - the ServiceLocatorTestRule.ServiceLocatorIsolation; if null then ServiceLocatorTestRule.ServiceLocatorIsolation.PER_TEST will be used
insteadverbose - whether this ServiceLocatorTestRule should
output additional information to System.outjava.lang.AssertionError - if test is nullpublic final ServiceLocatorTestRule.ServiceLocatorIsolation getServiceLocatorIsolation()
ServiceLocatorTestRule.ServiceLocatorIsolation for this ServiceLocatorTestRule.
This method never returns null.
ServiceLocatorTestRule.ServiceLocatorIsolation for this ServiceLocatorTestRule; never nullprivate final org.junit.runner.Description getDescription()
Description describing the currently
executing JUnit test method.
This method may return null.
Description describing the currently
executing JUnit test method, or nullpublic final boolean isVerbose()
true if this ServiceLocatorTestRule
should be verbose; false otherwiseServiceLocatorUtilities.dumpAllDescriptors(ServiceLocator,
PrintStream)public void before()
throws java.io.IOException
createServiceLocator(Description), configureServiceLocator(ServiceLocator, Description) and performDependencyInjection(ServiceLocator, Object) methods in
order to set up a ServiceLocator appropriate for the
current JUnit test.before in class org.junit.rules.ExternalResourcejava.io.IOException - if the configureServiceLocator(ServiceLocator, Description) method
threw an IOExceptioncreateServiceLocator(Description),
configureServiceLocator(ServiceLocator, Description),
performDependencyInjection(ServiceLocator, Object)protected void configureServiceLocator(ServiceLocator serviceLocator, org.junit.runner.Description testDescription) throws java.io.IOException
ServiceLocator for use by the
test described by the supplied Description.
This implementation:
ErrorServiceImpl class to the supplied
ServiceLocator so that exceptions will be thrown from
testsDynamicConfiguration.addUnbindFilter(Filter), all Descriptors that have Description.class as
one of their contractsSingleton scope with a name equal to the return value of the
Description.getDisplayName() method for the supplied
Description so that the current test can inject the
Description for the current method if it wishesClasses annotation
decorating the test class—if they are assignable to Factory.class then they are added as
factoriesPackages annotation decorating the test class, provided
they are annotated with ServiceInhabitantFiles annotation decorating the test class and adds
the services listed thereinbind(DynamicConfiguration) methodBinder.bind(DynamicConfiguration) method on
the test if it is in fact an instance of BinderserviceLocator - the ServiceLocator to configure;
must not be nulltestDescription - the Description describing the
particular test being run; must not be nulljava.lang.AssertionError - if either serviceLocator or
testDescription is nulljava.io.IOException - if there was an error looking for classes
in packages or finding or reading locator filespublic void bind(DynamicConfiguration dynamicConfiguration)
configureServiceLocator(ServiceLocator, Description) method in
case subclasses wish to add services to the ServiceLocator being configured.
Overrides of this method must not invoke the DynamicConfiguration.commit() method.
The default implementation of this method does nothing.
bind in interface BinderdynamicConfiguration - the DynamicConfiguration to
manipulate in order to add or remove services from the ServiceLocator being configured; must not be nullprivate final java.util.Set<java.lang.Class<?>> getClassesFromPackages(java.util.Set<java.lang.String> packageNames)
throws java.io.IOException
Set of package names, returns a Set of
Service-annotated Classes found in those
packages, whether they are located in ZipFiles or
directories on the classpath.
This method never returns null.
packageNames - the names of packages to search; may be
null in which case an empty Set will be returnednull Set of Classesjava.io.IOException - if there was any kind of error during
package searching or file readinggetClassesFromDirectory(Set, File, boolean),
getClassesFromZipFile(Set, ZipFile)private final java.util.Set<java.lang.Class<?>> getClassesFromZipFile(java.util.Set<java.lang.String> packageNames,
java.util.zip.ZipFile zipFile)
throws java.io.IOException
ZipFile (which is usually a .jar file)
containing class files and a Set of package names,
searches it to find Service-annotated Classes
inside it that belong to one of the supplied package names and
returns a Set of such Classes.packageNames - a Set of package names; may be null in which case an empty
Set will be returnedzipFile - a ZipFile hopefully containing class
files; may be null in which case an empty Set will be returnednull Set of Service-annotated Classesjava.io.IOException - if an error occurred reading the ZipFileprotected java.lang.String getClasspath()
String representing the classpath to use to
search for classes.
This method never returns null.
Overrides of this method are permitted to return null.
The default implementation of this method returns the value of
the java.class.path system property, or in the
almost certainly catastrophic case where this is not set, the
empty string.
String representing the classpath, or nullprivate final void bind(DynamicConfiguration configuration, java.lang.reflect.AnnotatedElement element) throws java.io.IOException
Annotations found on the supplied
AnnotatedElement and calls the bind(DynamicConfiguration, Collection) method supplying them as
the second parameter.configuration - a DynamicConfiguration that will
perform the binding; must not be nullelement - the AnnotatedElement that has annotations; may be null in which case no action is performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading class or
locator filesbind(DynamicConfiguration, Collection)private final void bind(DynamicConfiguration configuration, java.util.Collection<? extends java.lang.annotation.Annotation> annotations) throws java.io.IOException
Annotations supplied looking for
instances of the Classes, InhabitantFiles and
Packages annotations, and, using the binding methods on
the supplied DynamicConfiguration binds Descriptors for those "reachable" classes into the
configuration.
Recursively means that a user-defined Annotation might itself be annotated with Classes; in
such a case the Classes annotation's contents will be
found and processed. This effectively allows stereotyping the
Classes, InhabitantFiles and Packages
annotations.
configuration - a DynamicConfiguration that will
perform the binding; must not be nullannotations - a Collection of Annotations;
may be null in which case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading class or
locator filesbind(DynamicConfiguration, Classes),
bind(DynamicConfiguration, InhabitantFiles),
bind(DynamicConfiguration, Packages)private final void bind(DynamicConfiguration configuration, Classes classes) throws java.io.IOException
Classes "reachable" from the supplied Classes annotation.
Each Class found as a member of the return value of
the Classes.value() method is bound
(even if
it is an implementation of Factory) and in turn
is
examined for Annotations on itself.
configuration - a DynamicConfiguration that will
perform the binding; must not be nullclasses - a Classes; may be null in which
case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading class files
or locator filesDynamicConfiguration.addActiveDescriptor(Class),
DynamicConfiguration.addActiveFactoryDescriptor(Class)private final void bind(DynamicConfiguration configuration, Packages packages) throws java.io.IOException
Classes "reachable" from packages described by
the supplied Packages annotation.
This method calls the bind(DynamicConfiguration, Set)
method, passing it a Set formed from the supplied Packages annotation's list of
package names as the second parameter.
configuration - a DynamicConfiguration that will
perform the binding; must not be nullpackages - a Packages; may be null in which
case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading class files
or locator filesbind(DynamicConfiguration, Set)private final void bind(DynamicConfiguration configuration, java.util.Set<java.lang.String> packageNames) throws java.io.IOException
Classes "reachable" from the supplied packages.
This method calls the getClassesFromPackages(Set)
method, and, for each Class returned, if it is an
implementation of Factory then two Descriptors are added to the
DynamicConfiguration in the form of a
FactoryDescriptors addition by way of the DynamicConfiguration.addActiveFactoryDescriptor(Class) method,
or, if not, then a single
Descriptor is added to the DynamicConfiguration.
configuration - a DynamicConfiguration that will
perform the binding; must not be nullpackageNames - a Set of package names; may be null in which case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading class files
or locator filesgetClassesFromPackages(Set),
DynamicConfiguration.addActiveDescriptor(Class),
DynamicConfiguration.addActiveFactoryDescriptor(Class)protected void performDependencyInjection(ServiceLocator serviceLocator, T test)
ServiceLocatorTestRule and the supplied test instance, using the
supplied ServiceLocator as needed.
The default implementation of this method does the following:
ServiceLocator.inject(Object) on the supplied
ServiceLocator, if it is non-null, passing it
this ServiceLocatorTestRuleServiceLocator.postConstruct(Object) on the
supplied ServiceLocator, if it is non-null,
passing it this ServiceLocatorTestRuleServiceLocator.inject(Object) on the supplied
ServiceLocator, if it is non-null, passing it the
supplied test instance, if it is non-nullServiceLocator.postConstruct(Object) on the
supplied ServiceLocator, if it is non-null,
passing it the supplied test instance, if it is
non-nullThis method is guaranteed to be called after the configureServiceLocator(ServiceLocator, Description) method
with the same ServiceLocator.
serviceLocator - the ServiceLocator to use to
perform injection; may be null in which case no action
will be takentest - the test instance to inject; may be nullbind(DynamicConfiguration),
configureServiceLocator(ServiceLocator, Description)protected ServiceLocator createServiceLocator(org.junit.runner.Description testDescription)
ServiceLocator suitable for the
JUnit test described by the supplied Description.
This method never returns null.
Overrides of this method must not return null.
testDescription - the Description describing the
currently executing JUnit test; must not be nullnull ServiceLocatorjava.lang.AssertionError - if testDescription is nullprotected java.lang.String getServiceLocatorName(org.junit.runner.Description testDescription)
ServiceLocator that is appropriate
for the supplied Description.
This method never returns null.
Overrides of this method must not return null.
testDescription - the Description describing the
currently executing JUnit test; must not be nullnull String that will be used as a
name for a ServiceLocatorjava.lang.AssertionError - if testDescription is null, or if its getClassName() method returns null or if its getMethodName() method returns
nullpublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description)
ExternalResource.apply(Statement,
Description) method to save the supplied Description so
that other methods in this class can refer to it.
This method never returns null.
Overrides of this method must not return null.
apply in interface org.junit.rules.TestRuleapply in class org.junit.rules.ExternalResourcestatement - the Statement this ServiceLocatorTestRule will modify; passed unchanged to the
ExternalResource.apply(Statement, Description) methoddescription - the Description describing the current
JUnit test; must not be null; passed unchanged to the
ExternalResource.apply(Statement, Description) methodExternalResource.apply(Statement, Description) method; never
nullpublic void after()
ServiceLocator created by
this ServiceLocatorTestRule.
This method performs the following actions in order:
ServiceLocator.preDestroy(Object) method on
the existing ServiceLocator, passing it the test instance supplied at
construction timeServiceLocator.preDestroy(Object) method on
the existing ServiceLocator, passing it this ServiceLocatorTestRuleServiceLocator isolation level is PER_TEST, calls the shutdownAndDestroyServiceLocator(Description) method with a
Description instance that describes the JUnit test method
that just executedafter in class org.junit.rules.ExternalResourceshutdownAndDestroyServiceLocator(Description)public void shutdownAndDestroyServiceLocator(org.junit.runner.Description testDescription)
ServiceLocator.shutdown() and ServiceLocatorFactory.destroy(ServiceLocator) methods on this
ServiceLocatorTestRule's associated ServiceLocator if it is discovered to be non-null.testDescription - a Description describing the
currently executing JUnit test, if any; ignored by this method's
default implementation; may be nullprivate static final java.util.Set<java.lang.Class<?>> getClassesFromDirectory(java.util.Set<java.lang.String> packageNames,
java.io.File directory,
boolean verbose)
throws java.io.IOException
Set of package names and a File
designating an existing directory
in the classpath that can be read,
returns a Set of Service-annotated Classes that can be found there that belong to one of the
supplied package names.
This method never returns null.
packageNames - a Set of package names; may be null in which case an empty
Set will be returneddirectory - a File designating a directory; an
empty Set will be
returned unless the directory so designated exists and is
readableverbose - whether additional information should be outputnull Set of Service-annotated Classesjava.io.IOException - if there was a problem reading filesprivate static final boolean isBlacklisted(java.lang.annotation.Annotation annotation)
true if the supplied Annotation is null or designates an annotation type that should be excluded
from recursive annotation scanning performed by the bind(DynamicConfiguration, AnnotatedElement) method.annotation - the Annotation to consider; may be
null in which case true will be returnedtrue if the supplied Annotation is null or designates an annotation type that should be excluded
from recursive annotation scanning performed by the bind(DynamicConfiguration, AnnotatedElement) methodisBlacklisted(Class)private static final boolean isBlacklisted(java.lang.Class<? extends java.lang.annotation.Annotation> c)
true if the supplied Class is null or designates an annotation type that should be excluded
from recursive annotation scanning performed by the bind(DynamicConfiguration, AnnotatedElement) method.c - the Class to consider; may be null in
which case true will be returnedtrue if the supplied Class is null or designates an annotation type that should be excluded
from recursive annotation scanning performed by the bind(DynamicConfiguration, AnnotatedElement) method; false otherwiseprivate static final void bind(DynamicConfiguration configuration, InhabitantFiles inhabitantFiles) throws java.io.IOException
InhabitantFiles annotation representing HK2 locator files and
calls the bind(DynamicConfiguration, String) method for
each such entry found.configuration - a DynamicConfiguration that will
perform the binding; must not be nullinhabitantFiles - an InhabitantFiles; may be null in which case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading locator
filesbind(DynamicConfiguration, String)private static final void bind(DynamicConfiguration configuration, java.lang.String locatorResourceName) throws java.io.IOException
ClassLoader, gets all classpath resources
with the supplied locatorResourceName, and iterates
through them, calling the bind(DynamicConfiguration,
URL) method for each one.configuration - a DynamicConfiguration that will
perform the binding; must not be nulllocatorResourceName - the name of a classpath resource
identifying one or more HK2 locator files; may be null in
which case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading locator
filesClassLoader.getResources(String),
Thread.getContextClassLoader(),
bind(DynamicConfiguration, URL)private static final void bind(DynamicConfiguration configuration, java.net.URL locatorResource) throws java.io.IOException
InputStream
to the supplied URL, wraps a BufferedReader
around it, and calls the bind(DynamicConfiguration,
BufferedReader) method.configuration - a DynamicConfiguration that will
perform the binding; must not be nulllocatorResource - a URL to an HK2 locator resource;
may be null in which case no action will be takenjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading locator
filesbind(DynamicConfiguration, BufferedReader)private static final void bind(DynamicConfiguration configuration, java.io.BufferedReader reader) throws java.io.IOException
BufferedReader and binds the
Descriptors it represents.configuration - a DynamicConfiguration that will
perform the binding; must not be nullreader - a BufferedReader reading a stream of
descriptor information as parseable by the DescriptorImpl.readObject(BufferedReader) method; may be null in which case no action will be performedjava.lang.AssertionError - if configuration is nulljava.io.IOException - if there was a problem reading locator
filesDescriptorImpl.readObject(BufferedReader),
DynamicConfiguration.bind(Descriptor)