Skip to content

Add @Config annotation for shell command configuration injection#2517

Merged
jbonofre merged 2 commits intoapache:mainfrom
jbonofre:feat/shell-config-annotation
Apr 19, 2026
Merged

Add @Config annotation for shell command configuration injection#2517
jbonofre merged 2 commits intoapache:mainfrom
jbonofre:feat/shell-config-annotation

Conversation

@jbonofre
Copy link
Copy Markdown
Member

@jbonofre jbonofre commented Apr 5, 2026

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:

@Config(pid = "foo.bar")
Map<String, Object> properties;

@jbonofre jbonofre linked an issue Apr 5, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Test Results

234 files  +1  234 suites  +1   21m 59s ⏱️ +7s
923 tests +6  875 ✅ +6  48 💤 ±0  0 ❌ ±0 
927 runs  +6  879 ✅ +6  48 💤 ±0  0 ❌ ±0 

Results for commit 1a1edc2. ± Comparison against base commit 031d9a1.

Allow shell commands to inject OSGi ConfigurationAdmin properties
via a new @config(pid = "...") annotation on Map<String, Object>
fields.

ManagerImpl resolves the configuration PID at instantiation time and
injects the properties as a LinkedHashMap. CommandExtension
automatically tracks ConfigurationAdmin availability when a command
uses @config.
@jbonofre jbonofre force-pushed the feat/shell-config-annotation branch from 1a1edc2 to cef7430 Compare April 12, 2026 05:48
…ache#2518)

System.out.print() without a newline was not displayed immediately on
the Karaf console because the PrintStream wrapping the terminal output
was created without autoFlush. Enable autoFlush on the local console
and SSH command PrintStreams, consistent with ShellFactoryImpl.
@jbonofre jbonofre merged commit cbdabc4 into apache:main Apr 19, 2026
16 of 18 checks passed
@jbonofre jbonofre deleted the feat/shell-config-annotation branch April 19, 2026 06:51
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.

Update Karaf shell command to support injection of a configuration pid

1 participant