org.jaitools.lookup
Class Lookup

java.lang.Object
  extended by org.jaitools.lookup.Lookup

public class Lookup
extends Object

This class offers minimal Service Provider Interface lookup functions. Within JAITools it is used to find implementations of non-operator interfaces such as org.jaitools.numeric.Processor. Class names are read from registry files in the META-INF/services folder. Each registry file name corresponds to a fully qualified interface name. File format is one class name per line. Comment lines are prefixed with a hash (#) character. Blank lines are permitted.

Each time a registry file is read its contents are cached (weakly) for subsequent lookups.

Discovery of image operators is done using the standard JAI mechanisms.

Since:
1.0
Version:
$Id$
Author:
Michael Bedward

Constructor Summary
Lookup()
           
 
Method Summary
static void clearCache()
          Clear any cached lookups.
static Map<String,List<Class>> getCachedProviders()
          Returns a copy of the cached lookups as a Map with service provider interface names as keys and lists of implementing classes as values.
static List<Class> getProviders(String spiName)
          Get classes that implement the given service provider interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Lookup

public Lookup()
Method Detail

getProviders

public static List<Class> getProviders(String spiName)
Get classes that implement the given service provider interface.

Parameters:
spiName - the fully qualified name of the interface
Returns:
list of implementing classes

clearCache

public static void clearCache()
Clear any cached lookups. This forces subsequent lookups to read the registry files.


getCachedProviders

public static Map<String,List<Class>> getCachedProviders()
Returns a copy of the cached lookups as a Map with service provider interface names as keys and lists of implementing classes as values.

This method was added for testing purposes.

Returns:
a copy of the cached lookups as a new Map (may be empty)


Copyright © 2009-2013. All Rights Reserved.