Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple services and factory services in bundle dependent on same configuration pid #698

Merged

Conversation

pelliott-mathworks
Copy link
Collaborator

Multiple services and service factories can be dependent on the same configuration object and should be notified if the configuration object changes. Right now only one will be notified. This pull request fixes this problem in Configuration Admin for any service implementing the ManagedService interface or the ManagedServiceFactory interface. All services implementing those interfaces should be notified when configuration objects on which they are dependent change.

achristoforides and others added 2 commits June 27, 2022 15:46
Signed-off-by: The MathWorks, Inc. <alchrist@mathworks.com>
When more than one service that implements the ManagedServiceInterface or ManagedServiceFactoryInterface is dependent on a configuration object, then all services dependent on that object should be updated when the configuration object is updated. Signed-off-by <pelliott@mathworks.com>
@codecov-commenter
Copy link

codecov-commenter commented Jul 1, 2022

Codecov Report

Merging #698 (7fe5b7a) into development (a4bb526) will decrease coverage by 0.20%.
The diff coverage is 94.11%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #698      +/-   ##
===============================================
- Coverage        90.46%   90.26%   -0.21%     
===============================================
  Files              248      230      -18     
  Lines            13628    12531    -1097     
===============================================
- Hits             12329    11311    -1018     
+ Misses            1299     1220      -79     
Impacted Files Coverage Δ
.../ConfigurationAdmin/src/ConfigurationAdminImpl.cpp 90.90% <94.11%> (-2.11%) ⬇️
...endium/ServiceComponent/src/ComponentException.cpp 0.00% <0.00%> (-100.00%) ⬇️
...m/ServiceComponent/src/ServiceComponentRuntime.cpp 0.00% <0.00%> (-100.00%) ⬇️
...m/DeclarativeServices/src/manager/BundleLoader.cpp 63.82% <0.00%> (-6.32%) ⬇️
...mework/src/service/ServiceReferenceBasePrivate.cpp 86.16% <0.00%> (-5.93%) ⬇️
...pendium/tools/SCRCodeGen/ManifestParserFactory.hpp 83.33% <0.00%> (-5.56%) ⬇️
framework/src/service/ServiceListeners.cpp 95.10% <0.00%> (-4.90%) ⬇️
...iveServices/src/metadata/MetadataParserFactory.hpp 66.66% <0.00%> (-3.34%) ⬇️
...ndium/ConfigurationAdmin/src/CMBundleExtension.cpp 85.71% <0.00%> (-3.18%) ⬇️
framework/src/service/ServiceRegistry.cpp 90.76% <0.00%> (-2.57%) ⬇️
... and 89 more

Replaced while loop with for_each and replaced for loops with range based for loops. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>
Added const to  parameter lists for new for_each statements. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>
Check that managedServiceWrapper and managedServiceFactoryWrapper shared_ptr are not default constructed before dereferencing them. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>
@pelliott-mathworks pelliott-mathworks merged commit ebd854d into development Jul 6, 2022
@pelliott-mathworks pelliott-mathworks deleted the multiple-factories-in-bundle-same-pids branch July 6, 2022 18:03
insi-eb pushed a commit to insi-eb/CppMicroServices-cpp14 that referenced this pull request Feb 3, 2023
…nfiguration pid (CppMicroServices#698)

* Added new test bundle and test

Signed-off-by: The MathWorks, Inc. <alchrist@mathworks.com>

* Configuration Admin multiple notifications

When more than one service that implements the ManagedServiceInterface or ManagedServiceFactoryInterface is dependent on a configuration object, then all services dependent on that object should be updated when the configuration object is updated. Signed-off-by <pelliott@mathworks.com>

* Replaced while and for loops with more efficient constructs

Replaced while loop with for_each and replaced for loops with range based for loops. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

* Update ConfigurationAdminImpl.cpp

Added const to  parameter lists for new for_each statements. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

* Update ConfigurationAdminImpl.cpp

Check that managedServiceWrapper and managedServiceFactoryWrapper shared_ptr are not default constructed before dereferencing them. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

Co-authored-by: Alexander Christoforides <38366659+achristoforides@users.noreply.github.com>
jeffdiclemente pushed a commit that referenced this pull request Feb 3, 2023
…nfiguration pid (#698) (#790)

* Added new test bundle and test



* Configuration Admin multiple notifications

When more than one service that implements the ManagedServiceInterface or ManagedServiceFactoryInterface is dependent on a configuration object, then all services dependent on that object should be updated when the configuration object is updated. Signed-off-by <pelliott@mathworks.com>

* Replaced while and for loops with more efficient constructs

Replaced while loop with for_each and replaced for loops with range based for loops. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

* Update ConfigurationAdminImpl.cpp

Added const to  parameter lists for new for_each statements. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

* Update ConfigurationAdminImpl.cpp

Check that managedServiceWrapper and managedServiceFactoryWrapper shared_ptr are not default constructed before dereferencing them. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>

Co-authored-by: pelliott-mathworks <67922241+pelliott-mathworks@users.noreply.github.com>
Co-authored-by: Alexander Christoforides <38366659+achristoforides@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants