Previous Smart props Design Draft¶
What we aim for is an extended properties format that allows declarative inclusion of other component's configuration and the use of some expression language style substitution of variables. In other words, we strive for the use of a template processing language.
The prospective candidate is the Java Unified Expression Language based on the implementation JUEL
<b>Update:</b> As JUEL seems to be pretty dead and support is not clear, currently Java Expression Language (JEXL) is the preferred candidate.
Built-in implicit contexts include
- system properties,
- environment variables,
- other component properties (lookup(<name>)),
- the component name,
- the module name.
Example: A repository declaration could look like this:
com.zfabrik.component.type=com.zfabrik.svncr svncr.url=${system['svn.repoBaseUrl']}${system.branch}/base svncr.user=${system['svn.user']} svncr.passwordr=${system['svn.password']}
Resolution Flow¶
In principle, expressions could be resolved early, during local component repository index load, or late, during component descriptor evaluation.
Early Evaluation¶
This approach has the advantage that component queries would already take resolved component properties into account. Using this method, even system state participations or the visibility as component as such could be controlled via expressions.
We strive for early evaluation.
Processing Scope¶
Allowing template processing means that we do not only process the value part of component properties, but instead the complete component descriptor as a text fragment. A sufficiently powerful expression language might as well introduce properties as desired.
Possible extensions¶
To extend this further, component declarations may indicate their template style via some Shebang, the default being java.util.Properties.
For example:
#!com.zfabrik.components/velocityConfig # com.zfabrik.component.type=com.zfabrik.java #parse('mymodule/spring_template') java.privateReferences=,\ ${java_private_references},\ someotherref
Updated by Henning Blohm almost 8 years ago · 1 revisions