Replies: 6 comments 1 reply
-
Thank you for sharing your idea in the JEP/Discussion format, which I believe should be the standard for future contributions. Regarding the I propose testing this functionality in the jPOS 3.x is a version were we'll rock the boat a lot with a lot of changes, and it's still not in production, so it's safe to play with this there. With this feature, we probably can remove all custom code that calls This way, we can ensure stability in the current version while testing this new feature. |
Beta Was this translation helpful? Give feedback.
-
I don't think speed is a problem here, specially since the configuration is just read at QBean initialization time. |
Beta Was this translation helpful? Give feedback.
-
Great related PR #546 |
Beta Was this translation helpful? Give feedback.
-
I did something a little different from what I proposed here, as mentioned in this comment, instead of performing the replacement in the
|
Beta Was this translation helpful? Give feedback.
-
In the latest commit to the PR, this was implemented a slightly different version of this. The responsability of calling the method that expands the environment properties, now called |
Beta Was this translation helpful? Give feedback.
-
This was implemented in #554 |
Beta Was this translation helpful? Give feedback.
-
Summary
Enable the possibility to replace environment properties anywhere in XML deployment files.
Goals
Enable environment property replacement for any jPOS's
XMLConfigurable
.Motivation
Sometimes you want to pass an environment property to a component that don't call
Environment.getProperty
, currently you are in one of two possibilities:With this, you could use environment properties replacement anywhere you want.
Description
Add a boolean attribute to XML elements that are passed to configurable components that indicates that any attribute or content in it or its children are modified by replacing any environment property there.
A first idea is to modify
QFactory.setConfiguration
to call a function that replaces all environment properties, if the element contains a given attribute withtrue
value.You can see a simple proof of concept implementation here.
Basically, the following method was added to
QFactory
And it's called in
instantiate
if the attribute value is present:With that, you could for example configure a logger like this:
And get the
${log.disable-realms:Q2.system}
token replaced, even thoughRealmLogFilter
does not callEnvironment.getProperty
forenable
ordisable
elements.Alternatives
ConfigDecorationProvider
mechanism, where a system could have many registered decorators, and type of decorators that acts over the parsedElement
tree. And provide a mechanism to activate those decorators on a per-file basis. The ability to use more than one in a correctly defined order could also be supported.ConfigDecoratorProvider
, that expand all properties in all deploy files.Risks and Assumptions
If the attribute to modify this behavior is chosen with careful, the risk that this could impact some existing installation is near to 0. However, it could not be backward compatible with some installation that uses that attribute name with a
true
value for another thing, and it has a token of the form${...}
in it, and there exists an environment property for that, or the property includes a default value.I could also minimally affect performance, but the recursive call would only be performed when the attribute value is true.
These risks could be mitigated with a global java property (or some other mechanism) that disables the feature.
Beta Was this translation helpful? Give feedback.
All reactions