jbonofre opened a new pull request, #2517:
URL: https://github.com/apache/karaf/pull/2517

   ## Summary
   
   Shell commands currently have no convenient way to access OSGi configuration 
properties. This adds a `@Config` annotation that allows injecting 
ConfigurationAdmin properties directly into command fields:
   
   ```java
   @Config(pid = "foo.bar")
   Map<String, Object> properties;
   ```
   
   ## Changes
   
   - New `@Config` annotation in `shell.api.action.lifecycle` with a `pid` 
attribute
   - `ManagerImpl` resolves the PID via ConfigurationAdmin during command 
instantiation and injects properties as a `LinkedHashMap`
   - `CommandExtension` automatically tracks ConfigurationAdmin as a dependency 
when `@Config` is used
   - Graceful degradation: empty map injected when ConfigAdmin is unavailable 
or PID doesn't exist
   
   ## Test plan
   
   - [x] Config properties are correctly injected from ConfigurationAdmin
   - [x] Null properties (PID exists, no values) yields empty map
   - [x] Missing ConfigurationAdmin yields empty map
   - [x] Multiple `@Config` fields with different PIDs
   - [x] ConfigurationAdmin IOException is handled gracefully
   - [x] Fallback to dependencies registry when local registry has no 
ConfigAdmin


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to