Module com.sun.xml.ws.policy
Class PolicyUtils.ServiceProvider
- java.lang.Object
-
- com.sun.xml.ws.policy.privateutil.PolicyUtils.ServiceProvider
-
- Enclosing class:
- PolicyUtils
public static class PolicyUtils.ServiceProvider extends Object
Wrapper for ServiceFinder class which is not part of the Java SE yet.
-
-
Constructor Summary
Constructors Constructor Description ServiceProvider()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T[]load(Class<T> serviceClass)Locates and incrementally instantiates the available providers of a given service using the context class loader.static <T> T[]load(Class<T> serviceClass, ClassLoader loader)Locates and incrementally instantiates the available providers of a given service using the given class loader.
-
-
-
Method Detail
-
load
public static <T> T[] load(Class<T> serviceClass, ClassLoader loader)
Locates and incrementally instantiates the available providers of a given service using the given class loader.This method transforms the name of the given service class into a provider-configuration filename as described above and then uses the
getResourcesmethod of the given class loader to find all available files with that name. These files are then read and parsed to produce a list of provider-class names. Eventually each provider class is instantiated and array of those instances is returned.Because it is possible for extensions to be installed into a running Java virtual machine, this method may return different results each time it is invoked.
- Parameters:
serviceClass- The service's abstract service class. Must not benull.loader- The class loader to be used to load provider-configuration files and instantiate provider classes, ornullif the system class loader (or, failing that the bootstrap class loader) is to be used- Throws:
NullPointerException- in caseserviceinput parameter isnull.ServiceConfigurationError- If a provider-configuration file violates the specified format or names a provider class that cannot be found and instantiated- See Also:
load(Class)
-
load
public static <T> T[] load(Class<T> serviceClass)
Locates and incrementally instantiates the available providers of a given service using the context class loader. This convenience method is equivalent toClassLoader cl = Thread.currentThread().getContextClassLoader(); return PolicyUtils.ServiceProvider.load(service, cl);
- Parameters:
serviceClass- The service's abstract service class. Must not benull.- Throws:
NullPointerException- in caseserviceinput parameter isnull.ServiceConfigurationError- If a provider-configuration file violates the specified format or names a provider class that cannot be found and instantiated- See Also:
load(Class, ClassLoader)
-
-