-
Notifications
You must be signed in to change notification settings - Fork 123
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
XCOMMONS-2921: Add support for overwritting the configuration from the execution context #760
base: master
Are you sure you want to change the base?
Conversation
…e execution context * Implement a new "executionContext" configuration source * Add ConfigurationSource#removeProperty() * Add a helper to execute some code with modified configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy about this one, but I don't have a better option. I'm open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what we need is actually a configuration specific thing. To me, the real need is to pass a callable which is executed between an ExecutionContext set/unset and that's useful for various other use cases than just the configuration. You would then simply call the default ConfigutationSource in the callable you pass to the helper.
For example, it could simply be something like Execution#call(Map<String, Object> properties, Callable<V> callable)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that proposal does not work well with custom storage in the ExecutionContext, which is most probably the case of the ExecutionContext ConfigurationSource.
Check xwiki/xwiki-platform#2834 for the usage. |
<dependency> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-context</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative was to put the code in xwiki-commons-context
and add there the dependency on xwiki-commons-configuration-api
, but @tmortagne noted that it's more probable for a module that requires the configuration API to also require the context API, than the other way.
Jira URL
https://jira.xwiki.org/browse/XCOMMONS-2921
Changes
Description