[
https://issues.apache.org/jira/browse/DELTASPIKE-378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mark Struberg resolved DELTASPIKE-378.
--------------------------------------
Resolution: Fixed
> ProjectStage-aware and Property-aware configuration
> ----------------------------------------------------
>
> Key: DELTASPIKE-378
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-378
> Project: DeltaSpike
> Issue Type: New Feature
> Components: Configuration
> Affects Versions: 0.4
> Reporter: Mark Struberg
> Assignee: Mark Struberg
> Fix For: 0.5
>
>
> In many situations one likes to use different configurations depending on the
> ProjectStage.
> E.g. to take the JPA configuration for the local database from a properties
> file which contains the credentials and JDBC driver class for the local test
> setup in ProjectStage Development and UnitTest, but use a JNDI provided
> DataSource for ProjectStage Production.
> Same goes with using various kind of configuration depending on a configured
> property like e.g. 'dbvendor'. Using some Oracle specific flags if dbvendor
> is set to 'oracle' vs other flags for 'mysql'.
> To not come into chicken/egg issues, I propose that the whole change only
> affects our ConfigResolver and the producers for @ConfigProperty
> I suggest to add 2 new methods to ConfigResolver:
> #getProjectStageAwarePropertyValue(String key)
> This would basically first do a lookup of key + projectStage, e.g.
> someKey.Production and if it doesn't find anything, then looks up the
> configured value without the ProjectStage.
> #getPropertyAwarePropertyValue(String key, String propertyName);
> The lookup pack for key= 'someconfig', ProjectStage = Production and
> propertyName = 'dbvendor' would be:
> * lookup dbvendor.Production, then if not found do a fallback to dbvendor.
> Let's say we found the value 'mysql' that way.
> * lookup someconfig.mysql.Production
> * fallback: lookup someconfig.mysql
> * fallback: lookup someconfig.Production
> * fallback: lookup someconfig
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira