Changeset 1178 for trunk/grails-app/conf


Ignore:
Timestamp:
Nov 19, 2010, 1:19:00 PM (12 years ago)
Author:
work@…
Message:
  • this change is part of #185
  • moved object instantes out of Config.groovy (this should only contain configuration)
  • moved module specific configuration for SAM and Metabolomics out of BootStrapStudies?.groovy and into Config.groovy
Location:
trunk/grails-app/conf
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/BootStrap.groovy

    r1127 r1178  
    99import dbnp.studycapturing.Sample
    1010import dbnp.rest.common.CommunicationManager
     11import org.codehaus.groovy.grails.commons.*
    1112
    1213/**
     
    2829                "bootstrapping application".grom()
    2930
     31                // get configuration
     32                def config = ConfigurationHolder.config
     33
    3034                // define timezone
    3135                System.setProperty('user.timezone', 'CET')
     
    3337                // set up authentication (if required)
    3438                if (!SecRole.count() || !SecUser.count()) BootStrapAuthentication.initDefaultAuthentication(springSecurityService)
     39
     40                // set up the SAM communication manager
     41                // this should probably more dynamic and put into the modules
     42                // section instead of the bootstrap as not all instances will
     43                // probably run WITH sam. GSCF should be able to run independently
     44                // from other modules. Part of gscf ticket #185
     45                if (config.modules?.sam) {
     46                        // register SAM REST methods
     47                        "Registering SAM REST methods".grom()
     48                        CommunicationManager.SAMServerURL = config.modules.sam.url
     49                        CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     50                }
    3551
    3652                // developmental bootstrapping:
     
    5773                TemplateEntity.getField(Subject.domainFields, 'species').ontologies = [Ontology.getOrCreateOntologyByNcboId(1132)]
    5874                TemplateEntity.getField(Sample.domainFields, 'material').ontologies = [Ontology.getOrCreateOntologyByNcboId(1005)]
    59 
    60                 // register SAM REST methods
    61                 "Registering SAM REST methods".grom()
    62                 CommunicationManager.registerRestWrapperMethodsSAMtoGSCF()
    6375        }
    6476
  • trunk/grails-app/conf/BootStrapStudies.groovy

    r1163 r1178  
    1515import grails.util.GrailsUtil
    1616import dbnp.rest.common.CommunicationManager
     17import org.codehaus.groovy.grails.commons.*
     18
    1719
    1820class BootStrapStudies {
     
    2123         * Add example studies. This function is meant to be called only in development mode
    2224         */
    23 
    2425        public static void addExampleStudies(dbnp.authentication.SecUser owner, dbnp.authentication.SecUser otherUser ) {
    2526                "inserting initial studies".grom()
     27
     28                // get configuration
     29                def config = ConfigurationHolder.config
    2630
    2731                // Look up the used ontologies which should be in the database by now
     
    463467                .with { if (!validate()) { errors.each { println it} } else save()}
    464468
    465                 // sam urls are in config.groovy, where they belong...
    466                 // if that doesn't work for you, make it work... now you're
    467                 // breaking the other environments....
    468                 //def samURL = GrailsUtil.environment == GrailsApplication.ENV_PRODUCTION ? 'http://sam.nmcdsp.org' : 'http://localhost:8182/sam'
    469                 def nmcdspURL = GrailsUtil.environment == GrailsApplication.ENV_PRODUCTION ? 'http://metabolomics.nmcdsp.org' : 'http://localhost:8183/nmcdsp'
    470                 def samURL = CommunicationManager.SAMServerURL
    471 
    472469                // Add SAM assay reference
    473470                def clinicalModule = new AssayModule(
    474471                        name: 'SAM module for clinical data',
    475472                        platform: 'clinical measurements',
    476                         url: samURL
     473                        url: config.modules.sam.url
    477474                ).with { if (!validate()) { errors.each { println it} } else save()}
    478475
     
    481478                        name: 'Metabolomics module',
    482479                        platform: 'GCMS/LCMS',
    483                         url: nmcdspURL
     480                        url: config.modules.metabolomics.url
    484481                ).with { if (!validate()) { errors.each { println it} } else save()}
    485482
  • trunk/grails-app/conf/Config.groovy

    r1171 r1178  
    5151        development {
    5252                grails.serverURL = "http://localhost:8080/${appName}"
    53 
    54                 CommunicationManager.SAMServerURL = 'http://localhost:8182/sam'
    55                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     53                modules {
     54                        sam {
     55                                url = "http://localhost:8182/sam"
     56                        }
     57                        metabolomics {
     58                                url = "http://localhost:8183/nmcdsp"
     59                        }
     60                }
    5661        }
    5762        ci {
    5863                // used by build script
    5964                grails.serverURL = "http://ci.gscf.nmcdsp.org"
    60 
    61                 CommunicationManager.SAMServerURL = 'http://ci.sam.nmcdsp.org'
    62                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     65                modules {
     66                        sam {
     67                                url = "http://ci.sam.nmcdsp.org"
     68                        }
     69                        metabolomics {
     70                                url = "http://ci.metabolomics.nmcdsp.org"
     71                        }
     72                }
    6373        }
    6474        test {
    6575                // used by build script
    6676                grails.serverURL = "http://test.gscf.nmcdsp.org"
    67 
    68                 CommunicationManager.SAMServerURL = 'http://test.sam.nmcdsp.org'
    69                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     77                modules {
     78                        sam {
     79                                url = "http://test.sam.nmcdsp.org"
     80                        }
     81                        metabolomics {
     82                                url = "http://test.metabolomics.nmcdsp.org"
     83                        }
     84                }
    7085        }
    7186        dbnptest {
    7287                // used by build script
    7388                grails.serverURL = "http://test.dbnp.org"
    74 
    75                 CommunicationManager.SAMServerURL = 'http://test.sam.dbnp.org'
    76                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     89                modules {
     90                        sam {
     91                                url = "http://test.sam.dbnp.org"
     92                        }
     93                        metabolomics {
     94                                url = "http://test.metabolomics.dbnp.org"
     95                        }
     96                }
    7797        }
    7898        dbnpdemo {
    7999                // used by build script
    80100                grails.serverURL = "http://demo.dbnp.org"
    81 
    82                 CommunicationManager.SAMServerURL = 'http://demo.sam.dbnp.org'
    83                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     101                modules {
     102                        sam {
     103                                url = "http://demo.sam.dbnp.org"
     104                        }
     105                        metabolomics {
     106                                url = "http://demo.metabolomics.dbnp.org"
     107                        }
     108                }
    84109        }
    85110        production {
    86111                grails.serverURL = "http://www.nmcdsp.org"
    87 
    88                 CommunicationManager.SAMServerURL = 'http://sam.nmcdsp.org'
    89                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     112                modules {
     113                        sam {
     114                                url = "http://sam.nmcdsp.org"
     115                        }
     116                        metabolomics {
     117                                url = "http://metabolomics.nmcdsp.org"
     118                        }
     119                }
    90120        }
    91121        www {
    92122                // used by build script
    93123                grails.serverURL = "http://www.nmcdsp.org"
    94 
    95                 CommunicationManager.SAMServerURL = 'http://sam.nmcdsp.org'
    96                 CommunicationManager.registerRestWrapperMethodsGSCFtoSAM()
     124                modules {
     125                        sam {
     126                                url = "http://sam.nmcdsp.org"
     127                        }
     128                        metabolomics {
     129                                url = "http://metabolomics.nmcdsp.org"
     130                        }
     131                }
    97132        }
    98133}
Note: See TracChangeset for help on using the changeset viewer.