|
|||||||||
| Home >> All >> org >> dinopolis >> util >> [ servicediscovery overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dinopolis.util.servicediscovery
Class ServiceDiscovery

java.lang.Objectorg.dinopolis.util.servicediscovery.ServiceDiscovery
- public class ServiceDiscovery
- extends java.lang.Object
Implement the JDK1.3 'Service Provider' specification. ( http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html )
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 directory META-INF/services contains the following information: for every service a file exists that is named like the service interface/class/abstract class. This files contains names of classes that implement this interface or extend this class/abstract class.The findServices() method will check every class loader for the META-INF/services directory.
This class was inspired by the org.apache.commons.discovery.ServiceDiscovery classes.
- Version:
- $Revision: 1.2 $
| Field Summary | |
protected java.util.Vector |
class_loaders_
|
protected static java.lang.String |
SERVICE_HOME
|
| Constructor Summary | |
ServiceDiscovery()
Construct a new service discoverer |
|
ServiceDiscovery(boolean use_system_classloader)
Construct a new service discoverer. |
|
| Method Summary | |
void |
addClassLoader(java.lang.ClassLoader loader)
Specify a new class loader to be used in searching. |
ServiceInfo[] |
findServices(java.lang.String name)
Returns information about services found for the given class/interface name. |
java.lang.Object[] |
getServices(java.lang.Class clazz)
Returns instances of services found for the given class/interface name. |
java.lang.Object[] |
getServices(java.lang.String class_name)
Returns services found for the given class/interface name. |
java.lang.ClassLoader |
getThreadClassLoader()
Convenience method to find the thread class loader. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
SERVICE_HOME
protected static final java.lang.String SERVICE_HOME
- See Also:
- Constant Field Values
class_loaders_
protected java.util.Vector class_loaders_
| Constructor Detail |
ServiceDiscovery
public ServiceDiscovery()
- Construct a new service discoverer
ServiceDiscovery
public ServiceDiscovery(boolean use_system_classloader)
- Construct a new service discoverer.
| Method Detail |
addClassLoader
public void addClassLoader(java.lang.ClassLoader loader)
- Specify a new class loader to be used in searching.
The order of loaders determines the order of the result.
It is recommended to add the most specific loaders first.
getThreadClassLoader
public java.lang.ClassLoader getThreadClassLoader()
- Convenience method to find the thread class loader.
Usefull in jdk1.1, to avoid other introspection hacks.
findServices
public ServiceInfo[] findServices(java.lang.String name)
- Returns information about services found for the given
class/interface name.
getServices
public java.lang.Object[] getServices(java.lang.String class_name)
- Returns services found for the given class/interface name. If the
given class name is not a valid class, an empty array is returned.
getServices
public java.lang.Object[] getServices(java.lang.Class clazz)
- Returns instances of services found for the given class/interface name.
|
|||||||||
| Home >> All >> org >> dinopolis >> util >> [ servicediscovery overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.dinopolis.util.servicediscovery.ServiceDiscovery