|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.freecompany.util.services.ServiceDiscovery
public class ServiceDiscovery
The discovery class provides factory methods for creating instances of service information objects and a caching mechanism. All methods of this class are thread safe.
These service objects can be used to find concrete implementations of service provider interfaces. The service discovery factory also provides caching for these information objects.
For example, to find the first known concrete provider for the interface ServiceInterface
:
ServiceInterface service = ServiceDiscovery.getInstance().findService( ServiceInterface.class);
Field Summary | |
---|---|
protected static java.util.Map<java.lang.String,ServiceInfo> |
cache
|
Constructor Summary | |
---|---|
ServiceDiscovery()
|
Method Summary | |
---|---|
static void |
disableCaching()
Disables ServiceInfo caching within this helper. |
static void |
enableCaching()
Enables ServiceInfo caching within this helper. |
static ServiceInfo |
getInstance()
Returns a ServiceInfo instance that can access service providers
specified as a system property or through the class path using the standard
JAR services mechanism. |
static ServiceInfo |
getInstance(java.lang.String system)
Returns a ServiceInfo instance that can access service providers
set as a system wide preference, specified as a system property, or through
the class path using the standard JAR services mechanism. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.Map<java.lang.String,ServiceInfo> cache
Constructor Detail |
---|
public ServiceDiscovery()
Method Detail |
---|
public static void enableCaching()
ServiceInfo
caching within this helper. With caching enabled,
ServiceInfo
instances are cached for each system identifier to eliminate
the need to reparse configuration properties.
Caching is disabled by default.
public static void disableCaching()
ServiceInfo
caching within this helper. With caching disabled,
a new ServiceInfo
instance is created for each getInstance()
call,
which may require reparsing properties files.
Caching is disabled by default.
public static ServiceInfo getInstance()
ServiceInfo
instance that can access service providers
specified as a system property or through the class path using the standard
JAR services mechanism.
ServiceInfo
object that can be used to locate service providers.public static ServiceInfo getInstance(java.lang.String system)
ServiceInfo
instance that can access service providers
set as a system wide preference, specified as a system property, or through
the class path using the standard JAR services mechanism.
ServiceInfo
object that can be used to locate service providers.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |