Smart props old » History » Version 1
Henning Blohm, 05.03.2017 22:18
1 | 1 | Henning Blohm | h1. Previous Smart props Design Draft |
---|---|---|---|
2 | |||
3 | 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. |
||
4 | |||
5 | The prospective candidate is the "Java Unified Expression Language":https://en.wikipedia.org/wiki/Unified_Expression_Language based on the implementation "JUEL":http://juel.sourceforge.net/ |
||
6 | |||
7 | <b>Update:</b> As JUEL seems to be pretty dead and support is not clear, currently Java Expression Language ("JEXL":http://commons.apache.org/proper/commons-jexl/) is the preferred candidate. |
||
8 | |||
9 | Built-in implicit contexts include |
||
10 | |||
11 | * system properties, |
||
12 | * environment variables, |
||
13 | * other component properties (_lookup(<name>)_), |
||
14 | * the component name, |
||
15 | * the module name. |
||
16 | |||
17 | Example: A repository declaration could look like this: |
||
18 | |||
19 | <pre> |
||
20 | com.zfabrik.component.type=com.zfabrik.svncr |
||
21 | |||
22 | svncr.url=${system['svn.repoBaseUrl']}${system.branch}/base |
||
23 | svncr.user=${system['svn.user']} |
||
24 | svncr.passwordr=${system['svn.password']} |
||
25 | </pre> |
||
26 | |||
27 | h2. Resolution Flow |
||
28 | |||
29 | In principle, expressions could be resolved early, during local component repository index load, or late, during component descriptor evaluation. |
||
30 | |||
31 | h3. Early Evaluation |
||
32 | |||
33 | 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. |
||
34 | |||
35 | We strive for early evaluation. |
||
36 | |||
37 | h2. Processing Scope |
||
38 | |||
39 | 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. |
||
40 | |||
41 | |||
42 | h2. Possible extensions |
||
43 | |||
44 | To extend this further, component declarations may indicate their template style via some "Shebang":http://de.wikipedia.org/wiki/Shebang, the default being *java.util.Properties*. |
||
45 | |||
46 | For example: |
||
47 | |||
48 | <pre> |
||
49 | #!com.zfabrik.components/velocityConfig |
||
50 | # |
||
51 | com.zfabrik.component.type=com.zfabrik.java |
||
52 | |||
53 | #parse('mymodule/spring_template') |
||
54 | |||
55 | java.privateReferences=,\ |
||
56 | ${java_private_references},\ |
||
57 | someotherref |
||
58 | </pre> |