View Poll Results: Is this addon interesting to you ?

Voters
4. You may not vote on this poll
  • Much

    2 50.00%
  • Quite

    2 50.00%
  • Little

    0 0%
  • Nothing

    0 0%
Results 1 to 4 of 4

Thread: Addon: Distinct configuration values by environment

  1. #1
    Join Date
    Jan 2010
    Location
    Mislata - Valencia - Spain
    Posts
    162

    Lightbulb Addon: Distinct configuration values by environment

    Hi all !

    GvNIX team is finishing our dynamic configurations addon to simplify use and allow export to maven profiles.

    Here an example:

    Code:
    # Create pet clinic example application
    script --file clinic.roo
    
    # Create a development configuration
    configuration create --name dev
    
    # Make some properties available for all configurations 
    configuration property add --name database.url
    configuration property add --name hibernate.hbm2ddl.auto
    configuration property add --name log4j.rootLogger
    
    # Set property values distinct than default for development configuration
    configuration property value --configuration dev --property database.url --value jdbc:hsqldb:mem:mydevdb
    
    # Check configurations
    configuration list
    
    # Write configurations to project
    configuration export
    
    # Create a production configuration
    configuration create --name pro
    
    # Set property values distinct than default for production configuration 
    configuration property value --configuration pro --property database.url --value jdbc:hsqldb:file:myprodb
    configuration property value --configuration pro --property hibernate.hbm2ddl.auto --value update
    configuration property value --configuration pro --property log4j.rootLogger --value "ERROR, stdout"
    
    # Write configurations to project
    configuration export
    Then you can run the application with distinct profiles:

    * mvn clean tomcat:run -P dev
    * mvn clean tomcat:run -P pro

    Some feedback ?
    Mario Martínez Sánchez
    Project Manager & Software Architect
    --------------------------
    Disid Technologies S.L.
    http://www.disid.com
    --------------------------
    gvNIX
    http://gvnix.googlecode.com
    http://www.gvnix.org

  2. #2
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    667

    Default

    Does this overlap at all with the profile support coming up in Spring 3.1?

  3. #3
    Join Date
    Jan 2010
    Location
    Mislata - Valencia - Spain
    Posts
    162

    Default

    Addon is independent of the configuration management system.

    Addon commands only allows easily define configurations, properties and values. The information about each configuration is stored as metadata in an internal format.

    Currently the addon has a command to export the configuration to maven profiles, but could be extended to export ant profiles, spring profiles, etc.
    Mario Martínez Sánchez
    Project Manager & Software Architect
    --------------------------
    Disid Technologies S.L.
    http://www.disid.com
    --------------------------
    gvNIX
    http://gvnix.googlecode.com
    http://www.gvnix.org

  4. #4
    Join Date
    Jan 2010
    Location
    Mislata - Valencia - Spain
    Posts
    162

    Default

    Here the execution of previous example:

    Code:
    roo> script --file clinic.roo
    roo> ...
    
    ~.web roo> configuration create --name dev
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Configuration created with currently available properties
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    First created configuration set as default
    (use 'configuration property add' to make a property available for all configurations
    
    ~.web roo> configuration property add --name database.url
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property available for all configurations
    (use 'configuration property value' to set property new values)
    
    ~.web roo> configuration property add --name hibernate.hbm2ddl.auto
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property available for all configurations
    (use 'configuration property value' to set property new values)
    
    ~.web roo> configuration property add --name log4j.rootLogger
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property available for all configurations
    (use 'configuration property value' to set property new values)
    
    ~.web roo> configuration property value --configuration dev --property database.url --value jdbc:hsqldb:mem:mydevdb
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property value seted
    (use 'configuration list' to show configurations and their properties)
    
    ~.web roo> configuration list
          (Active)      dev
    ----------------------------------------
     * Database Connection Properties
       - database.url = jdbc:hsqldb:mem:mydevdb
     * Persistence Property Attributes XML
       - hibernate.hbm2ddl.auto = create
     * Logging Service Properties
       - log4j.rootLogger = INFO, stdout
    (use 'configuration export' to write configurations into the project)
    
    ~.web roo> configuration export
    Updated ROOT/pom.xml
    Updated SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    Updated SRC_MAIN_RESOURCES/META-INF/persistence.xml
    Updated SRC_MAIN_RESOURCES/log4j.properties
    Configurations exported into project
    (use '-P name' on maven commands to use a configuration)
    (use 'configuration create' to define a new configuration)
    
    ~.web roo> configuration create --name pro
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Configuration created with currently available properties
     * Database Connection Properties
       - database.url = jdbc:hsqldb:mem:petclinic
     * Persistence Property Attributes XML
       - hibernate.hbm2ddl.auto = create
     * Logging Service Properties
       - log4j.rootLogger = INFO, stdout
    (use 'configuration property add' to make a property available for all configurations
    
    ~.web roo> configuration property value --configuration pro --property database.url --value jdbc:hsqldb:file:myprodb
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property value seted
    (use 'configuration list' to show configurations and their properties)
    
    ~.web roo> configuration property value --configuration pro --property hibernate.hbm2ddl.auto --value update
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property value seted
    (use 'configuration list' to show configurations and their properties)
    
    ~.web roo> configuration property value --configuration pro --property log4j.rootLogger --value "ERROR, stdout"
    Updated SRC_MAIN_RESOURCES/dynamic-configuration.xml
    Property value seted
    (use 'configuration list' to show configurations and their properties)
    
    ~.web roo> configuration export
    Updated ROOT/pom.xml
    Updated ROOT/pom.xml
    Updated SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    Updated SRC_MAIN_RESOURCES/META-INF/persistence.xml
    Updated SRC_MAIN_RESOURCES/log4j.properties
    Updated SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    Updated SRC_MAIN_RESOURCES/META-INF/persistence.xml
    Updated SRC_MAIN_RESOURCES/log4j.properties
    Configurations exported into project
    (use '-P name' on maven commands to use a configuration)
    (use 'configuration create' to define a new configuration)
    Mario Martínez Sánchez
    Project Manager & Software Architect
    --------------------------
    Disid Technologies S.L.
    http://www.disid.com
    --------------------------
    gvNIX
    http://gvnix.googlecode.com
    http://www.gvnix.org

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •