org.apache.tika.config
Class ServiceLoader

java.lang.Object
  extended by org.apache.tika.config.ServiceLoader

public class ServiceLoader
extends Object

Internal utility class that Tika uses to look up service providers.

Since:
Apache Tika 0.9

Constructor Summary
ServiceLoader()
           
ServiceLoader(ClassLoader loader)
           
ServiceLoader(ClassLoader loader, LoadErrorHandler handler)
           
ServiceLoader(ClassLoader loader, LoadErrorHandler handler, boolean dynamic)
           
 
Method Summary
 Enumeration<URL> findServiceResources(String filePattern)
          Returns all the available service resources matching the given pattern, such as all instances of tika-mimetypes.xml on the classpath, or all org.apache.tika.parser.Parser service files.
<T> List<T>
loadServiceProviders(Class<T> iface)
          Returns all the available service providers of the given type.
static void setContextClassLoader(ClassLoader loader)
          Sets the context class loader to use for all threads that access this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceLoader

public ServiceLoader(ClassLoader loader,
                     LoadErrorHandler handler,
                     boolean dynamic)

ServiceLoader

public ServiceLoader(ClassLoader loader,
                     LoadErrorHandler handler)

ServiceLoader

public ServiceLoader(ClassLoader loader)

ServiceLoader

public ServiceLoader()
Method Detail

setContextClassLoader

public static void setContextClassLoader(ClassLoader loader)
Sets the context class loader to use for all threads that access this class. Used for example in an OSGi environment to avoid problems with the default context class loader.

Parameters:
loader - default context class loader, or null to automatically pick the loader

findServiceResources

public Enumeration<URL> findServiceResources(String filePattern)
Returns all the available service resources matching the given pattern, such as all instances of tika-mimetypes.xml on the classpath, or all org.apache.tika.parser.Parser service files.


loadServiceProviders

public <T> List<T> loadServiceProviders(Class<T> iface)
Returns all the available service providers of the given type.

Parameters:
iface - service provider interface
Returns:
available service providers


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.