com.sun.xml.ws.policy.privateutil
Class PolicyUtils.ServiceProvider

java.lang.Object
  extended by 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
PolicyUtils.ServiceProvider()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyUtils.ServiceProvider

public PolicyUtils.ServiceProvider()
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 getResources method 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 be null.
loader - The class loader to be used to load provider-configuration files and instantiate provider classes, or null if the system class loader (or, failing that the bootstrap class loader) is to be used
Throws:
NullPointerException - in case service input parameter is null.
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 to

   ClassLoader cl = Thread.currentThread().getContextClassLoader();
   return PolicyUtils.ServiceProvider.load(service, cl);
 

Parameters:
serviceClass - The service's abstract service class. Must not be null.
Throws:
NullPointerException - in case service input parameter is null.
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)


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.