[ http://issues.apache.org/jira/browse/CONFIGURATION-192?page=all ]

Oliver Heger resolved CONFIGURATION-192.
----------------------------------------

    Fix Version/s: Nightly Builds
       Resolution: Fixed

The variable substitution features of the new Commons Lang text package have 
been incorporated to implement enhanced variable interpolation. A new Class 
ConfigurationInterpolator is responsible for interpolation. It manages a set of 
lookup objects that are associated with specific variable prefixes. Standard 
lookup objects for system properties and constants are provided. The user guide 
was updated in this respect, too.

> [configuration] Enhancement of interpolation features
> -----------------------------------------------------
>
>                 Key: CONFIGURATION-192
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-192
>             Project: Commons Configuration
>          Issue Type: Improvement
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Oliver Heger
>         Assigned To: Oliver Heger
>            Priority: Minor
>             Fix For: Nightly Builds
>
>         Attachments: interpolation.diff, Interpolator.java, 
> Interpolator.java, TestInterpolator.java, TestInterpolator.java, 
> VariableResolver.java
>
>
> At the moment interpolation is only supported by the getString() and
> getStringArray() methods. This proposal suggests adding interpolation support
> for other getter methods, too, and at the same time making it more 
> customizable
> (including the ability to disable it at all).
> A first step in achieving this could be to refactor the interpolation
> functionality out of AbstractConfiguration and into a new Interpolator class.
> This class would provide a main interpolation method and would also maintain 
> an
> arbitrary number of objects that know how to resolve variables of certain 
> types.
> Each Configuration object would be assigned an Interpolator instance, to which
> it would delegate interpolation tasks.
> Customization of the interpolation features could be done by assigning an
> Interpolator object to a configuration that has been initialized with a custom
> set of variable resolver objects. If no Interpolator is assigned, no
> interpolation will be performed.
> Variable resolver objects are very simple: They define a method which takes a
> variable's name and return its value. The variable resolver to use for a
> concrete variable is determined by a prefix that can be set for each variable.
> So a variable like ${sys:user.home} e.g. might refer to the system properties
> resolver. Variables without a prefix are handled by a default resolver, which 
> is
> implemented by the Configuration object itself, so that the Configuration's
> properties are used as variable values (which is backwards compatible to the
> current functionality).
> It should be possible to define a default Interpolator (or at least a default
> set of variable resolvers) that is to be used by each Configuration object as
> long as no special Interpolator is set. This could be done through a static
> field in AbstractConfiguration.
> Useful specific variable resolver classes could be:
> - The already mentioned system properties resolver, which would make system
> properties accessable in each configuration.
> - A resolver that would read constant values from specified classes.
> - A resolver that would evaluate expressions in an expression language like 
> EL.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to