Project

General

Profile

Smart props - DONE » History » Version 5

Henning Blohm, 17.07.2016 10:57

1 1 Henning Blohm
h1. Smart Props
2
3
The goal of this concept is to provide facilities to simplify sharing of component configuration while still being able to query resolved component configuration efficiently and with minimal resource usage.
4
5
h2. Design Draft
6
7
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 vaiables. In other words, we strive for the use of a template processing language.
8
9 4 Henning Blohm
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/
10
11 5 Henning Blohm
Built-in implicit contexts include 
12
13
* system properties, 
14
* environment variables, 
15
* other component properties (_lookup(<name>)_), 
16
* the component name, 
17
* the module name.
18 4 Henning Blohm
19
Example: A repository declaration could look like this:
20
21
<pre>
22
com.zfabrik.component.type=com.zfabrik.svncr
23
24
svncr.url=${system['svn.repoBaseUrl']}${system.branch}/base
25
svncr.user=${system['svn.user']}
26
svncr.passwordr=${system['svn.password']}
27
</pre>
28
29
30
31
32
h2. Possible extensions
33
34 2 Henning Blohm
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*.
35 1 Henning Blohm
36
For example:
37
38
<pre>
39
#!com.zfabrik.components/velocityConfig
40
#
41 3 Henning Blohm
com.zfabrik.component.type=com.zfabrik.java
42 1 Henning Blohm
43
#parse('mymodule/spring_template')
44
45
java.privateReferences=,\
46
  ${java_private_references},\
47
  someotherref
48
</pre>