|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.freecompany.util.services.ServiceInfo
public class ServiceInfo
A service information object provides an interface that can be used to query for provider instances defined in system properties, system wide JVM settings, or service descriptors in the class path.
| Field Summary | |
|---|---|
protected java.util.Properties |
properties
|
protected java.lang.String |
system
|
| Constructor Summary | |
|---|---|
protected |
ServiceInfo()
Constructs a service information object without an associated system identifier. |
protected |
ServiceInfo(java.lang.String system)
Constructs a service information object with the given system identifier. |
| Method Summary | ||
|---|---|---|
protected static java.lang.String |
clean(java.lang.String line)
Utility method to remove comments from service descriptors. |
|
protected static
|
createInstance(java.lang.ClassLoader loader,
java.lang.String name,
java.lang.Class<T> service)
Attempts to create an instance of the named class using the provided class loader. |
|
|
findService(java.lang.Class<T> service)
Finds the first known implementation of the given service class (or interface) using the current class loader. |
|
|
findService(java.lang.ClassLoader loader,
java.lang.Class<T> service)
Finds the first known implementation of the given service class (or interface) using the provided class loader. |
|
|
findServices(java.lang.Class<T> service)
Finds all known implementations of the given service class using the current class loader. |
|
|
findServices(java.lang.ClassLoader loader,
java.lang.Class<T> service)
Finds all known implementations of the given service class using the provided class loader. |
|
java.lang.String |
getSystem()
Gets the system name, used to find system wide service properties. |
|
protected static
|
searchClassPath(java.lang.ClassLoader loader,
java.lang.Class<T> service)
Finds all service descriptors that contain an implementation of the given service. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.Properties properties
protected final java.lang.String system
| Constructor Detail |
|---|
protected ServiceInfo()
protected ServiceInfo(java.lang.String system)
system - the identifier for the particular system, i.e. net, for
which properties should be parsed.ServiceDiscovery| Method Detail |
|---|
public java.lang.String getSystem()
null if none was set.public <T> T findService(java.lang.Class<T> service)
findService(ClassLoader,Class) with null
as the first parameter.
service - the service class (or interface) for which a compatible implementation will be returned.
null if none is found.
public <T> T findService(java.lang.ClassLoader loader,
java.lang.Class<T> service)
loader - the class loader to use when searching for service descriptor files, or null
to use the current class loader.service - the service class (or interface) for which compatible implementations will be returned.
null if none is found.
java.lang.ClassCastException - if a found provider class is not a subclass of service.public <T> java.lang.Iterable<T> findServices(java.lang.Class<T> service)
findServices(ClassLoader,Class) with null as the first parameter.
service - the service class (or interface) for which compatible implementations will be searched.
Collection of concrete instances, or the empty collection is none is found.
java.lang.ClassCastException - if a found provider class is not a subclass of service.
public <T> java.lang.Iterable<T> findServices(java.lang.ClassLoader loader,
java.lang.Class<T> service)
loader - the class loader to use when searching for service descriptor files, or null
to use the current class loader.service - the service class (or interface) for which compatible implementations will be searched.
Collection of concrete instances, or the empty collection is none is found.
java.lang.ClassCastException - if a found provider class is not a subclass of service.
protected static <T> java.util.Collection<T> searchClassPath(java.lang.ClassLoader loader,
java.lang.Class<T> service)
null is specified.
loader - the class loader within which to search for service descriptors.service - the service interface for which to find concrete implementations.
Collection of concrete instances of the service class (or interface), or an
empty collection if none could be found.
java.lang.ClassCastException - if a found provider class is not a subclass of service.
protected static <T> T createInstance(java.lang.ClassLoader loader,
java.lang.String name,
java.lang.Class<T> service)
null then the current class loader is used. This
method returns null if the class cannot be found or instantiated with a default constructor.
loader - the class loader to use to load the class definition, may be null.name - name of the class to load and instantiate.service - the service class of which the named class is expected to be a subclass.
name.
java.lang.ClassCastException - if the named class is not a subclass of service.protected static final java.lang.String clean(java.lang.String line)
# through the end of the line.
line - line including possible extra white space and comment.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||