:recycle: [Service Configuration] Service Configurations refactoring
This PR continues the work initiated during the DI introduction, separating the logic of service configuration management into the ServiceConfigurationManager implementations. This also changes how ServiceConfigurationManagers are wired - managers are no longer annotated with @Named but are wired as contributors to a Map, e.g.:
@ProvidesIntoMap
@ClassMapKey(UserService.class)
@Singleton
ServiceConfigurationManager userServiceConfigurationManager(
Unfortunately Guice does not support overriding for Map binder entries, therefore each service configuration manager has been isolated in a separate Module wiring file. If you need to change the behaviour of any ServiceConfigurationManager, configure the locator.xml to ignore that full class name (including the package name) and provide a new implementation.
Having all service configuration managers in a map was functional to solve a vulnerability issue present in the Rest Apis, which were instantiating classes based on the name provided by the user. Now the value provided by the user is matched (at the string level) with the list of available keys.
Furthermore, within this PR the logic to retrieve the TMetadata for services has been isolated in its own provider, allowing for alternative implementations.
Codecov Report
Attention: Patch coverage is 62.19081% with 214 lines in your changes missing coverage. Please review.
Project coverage is 16.75%. Comparing base (
ca5615b) to head (ccdca43). Report is 4 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #4079 +/- ##
==========================================
Coverage 16.75% 16.75%
Complexity 22 22
==========================================
Files 2016 2023 +7
Lines 52357 52373 +16
Branches 4417 4417
==========================================
+ Hits 8773 8776 +3
- Misses 43184 43198 +14
+ Partials 400 399 -1
| Files | Coverage Δ | |
|---|---|---|
| ...ons/configuration/ServiceConfigurationManager.java | 0.00% <ø> (ø) |
|
| ...se/kapua/commons/configuration/ValueTokenizer.java | 89.60% <100.00%> (ø) |
|
| ...onfiguration/metatype/PasswordPropertyAdapter.java | 13.63% <ø> (ø) |
|
| .../kapua/app/api/web/RestApiJAXBContextProvider.java | 0.00% <ø> (ø) |
|
| .../kapua/service/account/internal/AccountModule.java | 93.75% <100.00%> (-0.70%) |
:arrow_down: |
| ...rnal/AccountServiceConfigurationManagerModule.java | 100.00% <100.00%> (ø) |
|
| ...eclipse/kapua/model/config/metatype/EmptyTocd.java | 100.00% <ø> (ø) |
|
| .../eclipse/kapua/model/config/metatype/KapuaTad.java | 100.00% <100.00%> (ø) |
|
| ...e/kapua/model/config/metatype/KapuaTdesignate.java | 100.00% <100.00%> (ø) |
|
| ...se/kapua/model/config/metatype/KapuaTmetadata.java | 100.00% <100.00%> (ø) |
|
| ... and 52 more |