[
https://issues.apache.org/jira/browse/FELIX-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411954#comment-13411954
]
Christian Schneider commented on FELIX-3590:
--------------------------------------------
While in theory you are right I think in practice System properties are
normally not changed at runtime. So session will most times not influence each
other. Still I can imagine that not everyone wants the system property
resolution.
On the other hand we currently need this feature in Karaf. So perhaps we can
find some kind of extensibility mechanism that Karaf can use to add this to
gogo. Basically we would like to tap into the get(String name) resolution. How
about having an interface we can implement and inject into the session.
Like: interface VariableResolver {
Object resolve(String name);
}
and session.addVariableResolver(VariableResolver resolver)
The implementation of get in session would call the resolver if it is present.
So we could change the behaviour for Karaf and it would still stay the same by
default for Felix. Does that make sense?
> Add system property resolution to CommandSessionImpl
> ----------------------------------------------------
>
> Key: FELIX-3590
> URL: https://issues.apache.org/jira/browse/FELIX-3590
> Project: Felix
> Issue Type: Improvement
> Components: Gogo Runtime
> Affects Versions: gogo.runtime-0.10.0
> Reporter: Christian Schneider
> Priority: Minor
> Fix For: gogo.runtime-0.12.0
>
>
> Currently we wrap the CommandProcessor and CommandShell in karaf to simply
> add the resolution of system properties.
> See org.apache.karaf.shell.console.impl.jline.Activator in the karaf console
> module.
> In the innermost code it is only the following we override in
> CommandSessionImpl.
> public Object get(String name) {
> Object val = super.get(name);
> if (val == null) {
> val = System.getProperty(name);
> }
> return val;
> }
> So I propose to add this system property resolution to gogo. This would allow
> us to remove all the wrapping code in karaf.
> If you are interested I can provide a patch.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira