You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2013/09/11 13:00:02 UTC

[jira] [Resolved] (DELTASPIKE-378) ProjectStage-aware and Property-aware configuration

     [ 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