org.jppf.utils
Class ServiceFinder

java.lang.Object
  extended by org.jppf.utils.ServiceFinder

public class ServiceFinder
extends Object

Instances of this class look for and find services implemented via the Service Provider Interface (SPI). This class is an alternative for the static methods found in ServiceRegistry.

Author:
Laurent Cohen

Constructor Summary
ServiceFinder()
           
 
Method Summary
<T> List<T>
findProviders(Class<T> providerClass)
          Find all providers implementing or extending the specified provider interface or class, using the context class loader.
<T> List<T>
findProviders(Class<T> providerClass, ClassLoader cl)
          Find all providers implementing or extending the specified provider interface or class, using the specified class loader.
 List<String> findServiceDefinitions(String path, ClassLoader cl)
          Find all service definitions in the classpath, that match the specified path.
static
<T> Iterator<T>
lookupProviders(Class<T> providerClass)
          Find all providers implementing or extending the specified provider interface or class, using the context class loader.
static
<T> Iterator<T>
lookupProviders(Class<T> providerClass, ClassLoader cl)
          Find all providers implementing or extending the specified provider interface or class, using the specified class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceFinder

public ServiceFinder()
Method Detail

findProviders

public <T> List<T> findProviders(Class<T> providerClass,
                                 ClassLoader cl)
Find all providers implementing or extending the specified provider interface or class, using the specified class loader.

Type Parameters:
T - The type of provider implementations to find.
Parameters:
providerClass - the provider class.
cl - the class loader to user for the lookup.
Returns:
a list of concrete providers of the specified type.

findProviders

public <T> List<T> findProviders(Class<T> providerClass)
Find all providers implementing or extending the specified provider interface or class, using the context class loader.

Type Parameters:
T - The type of provider implementations to find.
Parameters:
providerClass - the provider class.
Returns:
a list of concrete providers of the specified type.

findServiceDefinitions

public List<String> findServiceDefinitions(String path,
                                           ClassLoader cl)
Find all service definitions in the classpath, that match the specified path.

Parameters:
path - the path to the definition files to find.
cl - the class loader to use for classpath lookup.
Returns:
the defintions found as a list of strings.

lookupProviders

public static <T> Iterator<T> lookupProviders(Class<T> providerClass,
                                              ClassLoader cl)
Find all providers implementing or extending the specified provider interface or class, using the specified class loader.

Type Parameters:
T - The type of provider implementations to find.
Parameters:
providerClass - the provider class.
cl - the class loader to user for the lookup.
Returns:
an iterator over concrete providers of the specified type.

lookupProviders

public static <T> Iterator<T> lookupProviders(Class<T> providerClass)
Find all providers implementing or extending the specified provider interface or class, using the context class loader.

Type Parameters:
T - The type of provider implementations to find.
Parameters:
providerClass - the provider class.
Returns:
an iterator over concrete providers of the specified type.


Copyright © 2005-2010 JPPF Team.