Class TopiaServiceSupportImpl
java.lang.Object
org.nuiton.topia.persistence.internal.support.TopiaServiceSupportImpl
- All Implemented Interfaces:
TopiaServiceSupport
This is the default
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".- Author:
- Arnaud Thimel (Code Lutin)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.google.common.collect.ImmutableMap<String,TopiaService> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends TopiaService>
Map<String,T> getServices(Class<T> interfaceService) voidinitServices(TopiaApplicationContext topiaApplicationContext)
-
Field Details
-
services
-
-
Constructor Details
-
TopiaServiceSupportImpl
public TopiaServiceSupportImpl()
-
-
Method Details
-
initServices
-
getServices
- Specified by:
getServicesin interfaceTopiaServiceSupport- Returns:
- The list of registered services. The map key is the service name, and the value is the service instance.
-
getServices
- Specified by:
getServicesin interfaceTopiaServiceSupport- Type Parameters:
T- type of service- Parameters:
interfaceService- FIXME- Returns:
- Same as
TopiaServiceSupport.getServices()but returns only services that implements given contract (or is instance of given class).
-