org.ehcache.spi
Class ServiceLocator

java.lang.Object
  extended by org.ehcache.spi.ServiceLocator
All Implemented Interfaces:
ServiceProvider

public final class ServiceLocator
extends java.lang.Object
implements ServiceProvider


Constructor Summary
ServiceLocator(Service... services)
           
 
Method Summary
 void addService(Service service)
           
static
<T> java.util.Collection<T>
findAmongst(java.lang.Class<T> clazz, java.lang.Object... instances)
           
static
<T> T
findSingletonAmongst(java.lang.Class<T> clazz, java.lang.Object... instances)
           
<T extends Service>
T
getOrCreateServiceFor(ServiceCreationConfiguration<T> config)
           
<T extends Service>
T
getService(java.lang.Class<T> serviceType)
          Will look up the Service of the serviceType.
 boolean knowsServiceFor(ServiceConfiguration serviceConfig)
           
 void loadDependenciesOf(java.lang.Class<?> clazz)
           
 void startAllServices()
           
 void stopAllServices()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceLocator

public ServiceLocator(Service... services)
Method Detail

addService

public void addService(Service service)

getOrCreateServiceFor

public <T extends Service> T getOrCreateServiceFor(ServiceCreationConfiguration<T> config)

getService

public <T extends Service> T getService(java.lang.Class<T> serviceType)
Description copied from interface: ServiceProvider
Will look up the Service of the serviceType. The returned service will be started or not depending on the started state of the ServiceProvider.

Specified by:
getService in interface ServiceProvider
Type Parameters:
T - The actual Service type
Parameters:
serviceType - the class of the service being looked up
Returns:
the service instance for T type, or null if it couldn't be located

findAmongst

public static <T> java.util.Collection<T> findAmongst(java.lang.Class<T> clazz,
                                                      java.lang.Object... instances)

findSingletonAmongst

public static <T> T findSingletonAmongst(java.lang.Class<T> clazz,
                                         java.lang.Object... instances)

startAllServices

public void startAllServices()
                      throws java.lang.Exception
Throws:
java.lang.Exception

stopAllServices

public void stopAllServices()
                     throws java.lang.Exception
Throws:
java.lang.Exception

loadDependenciesOf

public void loadDependenciesOf(java.lang.Class<?> clazz)

knowsServiceFor

public boolean knowsServiceFor(ServiceConfiguration serviceConfig)