public class TopiaServiceSupportImpl extends Object implements TopiaServiceSupport
TopiaServiceSupport implementation.
It will look in TopiaApplicationContext.getConfiguration()
to find services declarations and associated configuration. All of those properties match
the topia.service.* prefix.
A service is declared by giving it a name and the implementation class FQN by following the
pattern.
topia.service.myServiceName=com.my.company.my.app.MyServiceImplHere,
myServiceName is the name of the service, you can choose any String. Value
must be the FQN of class that provide an empty constructor and implements
TopiaService.
To passes configuration to a service, you can do as follow:
topia.service.myServiceName=com.my.company.my.app.MyServiceImpl topia.service.myServiceName.myConfigurationDirective=myConfigurationValueWhen
TopiaService.initTopiaService(org.nuiton.topia.persistence.TopiaApplicationContext, java.util.Map) will be
called, the given map will contain a single entry which key is "myConfigurationDirective" and value
is "myConfigurationValue".| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.collect.ImmutableMap<String,TopiaService> |
services |
protected static String |
TOPIA_SERVICE_CONFIGURATION_PREFIX |
| Constructor and Description |
|---|
TopiaServiceSupportImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
callInitOnAllTopiaServices(TopiaApplicationContext topiaApplicationContext,
Map<String,TopiaService> services,
Map<String,Map<String,String>> servicesConfigurations) |
Map<String,TopiaService> |
getServices()
The list of registered services.
|
<T extends TopiaService> |
getServices(Class<T> interfaceService)
Same as
TopiaServiceSupport.getServices() but returns only services that implements
given contract (or is instance of given class). |
void |
initServices(TopiaApplicationContext topiaApplicationContext) |
protected void |
loadServices(com.google.common.collect.ImmutableMap<String,String> topiaApplicationContextConfiguration,
Map<String,TopiaService> services,
Map<String,Map<String,String>> servicesConfigurations)
Read topiaApplicationContextConfiguration and fill both services and servicesConfigurations maps.
|
protected static final String TOPIA_SERVICE_CONFIGURATION_PREFIX
protected com.google.common.collect.ImmutableMap<String,TopiaService> services
public void initServices(TopiaApplicationContext topiaApplicationContext)
protected void loadServices(com.google.common.collect.ImmutableMap<String,String> topiaApplicationContextConfiguration, Map<String,TopiaService> services, Map<String,Map<String,String>> servicesConfigurations)
protected void callInitOnAllTopiaServices(TopiaApplicationContext topiaApplicationContext, Map<String,TopiaService> services, Map<String,Map<String,String>> servicesConfigurations)
public Map<String,TopiaService> getServices()
TopiaServiceSupportgetServices in interface TopiaServiceSupportpublic <T extends TopiaService> Map<String,T> getServices(Class<T> interfaceService)
TopiaServiceSupportTopiaServiceSupport.getServices() but returns only services that implements
given contract (or is instance of given class).getServices in interface TopiaServiceSupportCopyright © 2004–2014 CodeLutin. All rights reserved.