public class ServiceLocator extends Object implements Closeable
Modifier | Constructor and Description |
---|---|
protected |
ServiceLocator() |
protected |
ServiceLocator(String beanFactoryReferenceLocation,
String beanRefFactoryReferenceId) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
CacheService |
getCacheService()
Gets an instance of
CacheService . |
protected ApplicationContext |
getContext()
Gets the Spring ApplicationContext.
|
LocationService |
getLocationService()
Gets an instance of
LocationService . |
<S> S |
getService(String name,
Class<S> serviceType)
Get a service.
|
void |
init(String beanFactoryReferenceLocation)
Initializes the Spring application context from the given
beanFactoryReferenceLocation . |
void |
init(String beanFactoryReferenceLocation,
String beanRefFactoryReferenceId)
Initializes the Spring application context from the given
beanFactoryReferenceLocation . |
static ServiceLocator |
instance()
Gets the shared instance of this Class
|
boolean |
isOpen() |
static void |
setInstance(ServiceLocator newInstance)
replace the default shared instance of this Class
|
void |
shutdown()
Shuts down the ServiceLocator and releases any used resources.
|
protected ServiceLocator()
protected ServiceLocator(String beanFactoryReferenceLocation, String beanRefFactoryReferenceId)
public static void setInstance(ServiceLocator newInstance)
newInstance
- the new shared service locator instance.public static ServiceLocator instance()
public void init(String beanFactoryReferenceLocation, String beanRefFactoryReferenceId)
beanFactoryReferenceLocation
. If null
is
specified for the beanFactoryReferenceLocation
then the
default application context will be used.beanFactoryReferenceLocation
- the location of the beanRefFactory reference.public void init(String beanFactoryReferenceLocation)
beanFactoryReferenceLocation
. If null
is
specified for the beanFactoryReferenceLocation
then the
default application context will be used.beanFactoryReferenceLocation
- the location of the beanRefFactory reference.public void shutdown()
public <S> S getService(String name, Class<S> serviceType)
S
- type of the servicename
- name of the service (i.e name of the srping bean)serviceType
- type of servicepublic final LocationService getLocationService()
LocationService
.public final CacheService getCacheService()
CacheService
.public boolean isOpen()
true
if spring context is open, false
otherwise.protected ApplicationContext getContext()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2012–2014 IFREMER. All rights reserved.