org.apache.commons.discovery.tools
Class Service

java.lang.Object
  extended by org.apache.commons.discovery.tools.Service

public class Service
extends Object

[this was ServiceDiscovery12... the 1.1 versus 1.2 issue has been abstracted to org.apache.commons.discover.jdk.JDKHooks]

Implement the JDK1.3 'Service Provider' specification. ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )

This class supports any VM, including JDK1.1, via org.apache.commons.discover.jdk.JDKHooks. The caller will first configure the discoverer by adding ( in the desired order ) all the places to look for the META-INF/services. Currently we support loaders. The findResources() method will check every loader.


Constructor Summary
protected Service()
          Construct a new service discoverer
 
Method Summary
static
<T,S extends T>
Enumeration<S>
providers(Class<T> spiClass)
          as described in sun/jdk1.3.1/docs/guide/jar/jar.html#Service Provider, Except this uses Enumeration instead of Interator.
static
<T,S extends T>
Enumeration<S>
providers(SPInterface<T> spi, ClassLoaders loaders)
          This version lets you specify constructor arguments..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Service

protected Service()
Construct a new service discoverer

Method Detail

providers

public static <T,S extends T> Enumeration<S> providers(Class<T> spiClass)
as described in sun/jdk1.3.1/docs/guide/jar/jar.html#Service Provider, Except this uses Enumeration instead of Interator.

Type Parameters:
T - Service Provider Interface type
S - Any type extends the SPI type
Parameters:
spiClass - Service Provider Interface Class
Returns:
Enumeration of class instances (S)

providers

public static <T,S extends T> Enumeration<S> providers(SPInterface<T> spi,
                                                       ClassLoaders loaders)
This version lets you specify constructor arguments..

Type Parameters:
T - Service Provider Interface type
S - Any type extends the SPI type
Parameters:
spi - SPI to look for and load.
loaders - loaders to use in search. If null then use ClassLoaders.getAppLoaders().
Returns:
Enumeration of class instances (S)


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