Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 211c54f

Browse files
committed
upgrade to grails 2.5
1 parent 32d984c commit 211c54f

File tree

80 files changed

+2234
-3045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2234
-3045
lines changed

application.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Grails Metadata file
2-
#Tue May 06 15:00:38 CEST 2014
3-
app.grails.version=2.2.5
2+
#Thu Aug 06 14:28:20 CEST 2015
3+
app.grails.version=2.5.0
44
app.name=OpenLabFramework
5-
app.servlet.version=2.4
6-
app.version=1.3.2
5+
app.servlet.version=2.5
6+
app.version=1.4.0

grails-app/conf/BootStrap.groovy

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
*
2828
* ############################################################################
2929
*/
30-
import grails.util.GrailsUtil
3130
import org.openlab.barcode.BarcodeDataObject
3231
import org.openlab.barcode.BarcodeLabel
3332
import org.openlab.barcode.BarcodeSite
@@ -41,30 +40,22 @@ import org.openlab.storage.Box
4140
import org.openlab.storage.Compartment
4241
import org.openlab.storage.Freezer
4342
import org.openlab.storage.StorageLocation
44-
import org.openlab.genetracker.Recombinant
45-
import org.openlab.genetracker.Gene
4643

4744
class BootStrap {
4845

49-
//def moduleHandlerService
50-
//def applicationHandlerService
51-
//def addinHandlerService
5246
def settingsService
53-
def grailsApplication
54-
def springSecurityService
5547
def searchableService
56-
def dataSource
5748

5849
def init = { servletContext ->
5950

60-
println "Database name: " + grailsApplication.config.openlab.database.name
51+
println "Database name: " + grails.util.Holders.config.openlab.database.name
6152

6253
initSettings()
6354
initUserbase()
6455
initData()
6556
initSecurity()
6657

67-
switch (GrailsUtil.environment) {
58+
switch (grails.util.Environment) {
6859
case "development":
6960

7061
//initDummyData()
@@ -101,13 +92,6 @@ class BootStrap {
10192
if (BarcodeLabel.list().size() == 0)
10293
def barcodeLabel = new BarcodeLabel(name: "Label", parameters: "", barcodeType: "QR", xml: "").save()
10394

104-
/*
105-
* Create data from original geneTracker
106-
*
107-
def fileName = "/home/markus/genetrackerData.xls" //"C:\\temp\\genetrackerData.xls"
108-
def importer = new org.openlab.dataimport.GeneTrackerImporter(fileName)
109-
importer.createAll()
110-
//importer.createOnlyMasterData()*/
11195
}
11296

11397
def initSearchablePlugin() {
@@ -234,6 +218,10 @@ class BootStrap {
234218
def requestMap = new Requestmap(url: "/appAccessToken/**", configAttribute: "ROLE_ADMIN")
235219
requestMap.save()
236220
}
221+
if(!Requestmap.findByUrl("/dashboard/**")) {
222+
def requestMap = new Requestmap(url: "/dashboard/**", configAttribute: "IS_AUTHENTICATED_ANONYMOUSLY")
223+
requestMap.save()
224+
}
237225
}
238226

239227
def initDummyData() {

grails-app/conf/BuildConfig.groovy

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,84 +34,89 @@ pluginDir.eachDir {
3434
}
3535
grails.plugin.location.prototype = "prototype"
3636

37+
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
38+
39+
forkConfig = [maxMemory: 1024, minMemory: 512, debug: false, maxPerm: 256]
40+
grails.project.fork = [
41+
test: forkConfig, // configure settings for the test-app JVM
42+
run: forkConfig, // configure settings for the run-app JVM
43+
war: forkConfig, // configure settings for the run-war JVM
44+
standalone: forkConfig // configure settings for the Swing console JVM
45+
]
46+
47+
grails.project.target.level = 1.6
48+
grails.project.source.level = 1.6
3749
grails.project.class.dir = "target/classes"
3850
grails.project.test.class.dir = "target/test-classes"
3951
grails.project.test.reports.dir = "target/test-reports"
4052
grails.project.war.file = "target/${appName}.war"
41-
grails.tomcat.jvmArgs= ["-Xms512m", "-Xmx1024m", "-XX:PermSize=512m", "-XX:MaxPermSize=512m"]
53+
//grails.tomcat.jvmArgs= ["-Xms512m", "-Xmx1024m", "-XX:PermSize=512m", "-XX:MaxPermSize=512m"]
54+
grails.project.dependency.resolver = "maven" // or ivy
55+
56+
//grails.plugin.standalone.tomcatVersion = "7.0.52.1"
4257
grails.project.dependency.resolution = {
4358
// inherit Grails' default dependencies
4459
inherits( "global" ) {
4560
// uncomment to disable ehcache
4661
// excludes 'ehcache'
47-
excludes "bcpg-jdk15", "bcprov-jdk15"
48-
62+
//excludes "bcpg-jdk15", "bcprov-jdk15"
4963
}
64+
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
65+
5066
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
5167
repositories {
52-
inherits true
5368
grailsPlugins()
5469
grailsHome()
5570
grailsCentral()
5671
mavenCentral()
57-
mavenRepo "http://maven.springframework.org/milestone/"
5872
mavenRepo "http://repo.grails.org/grails/repo/"
59-
60-
// uncomment the below to enable remote dependency resolution
61-
// from public Maven repositories
62-
//mavenLocal()
63-
//mavenCentral()
64-
//mavenRepo "http://snapshots.repository.codehaus.org"
65-
//mavenRepo "http://repository.codehaus.org"
66-
//mavenRepo "http://download.java.net/maven/2/"
67-
//mavenRepo "http://repository.jboss.com/maven2/"
6873
}
6974
dependencies {
70-
compile "org.grails:grails-webflow:$grailsVersion"
71-
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
7275
runtime "hsqldb:hsqldb:1.8.0.10"
7376
runtime 'mysql:mysql-connector-java:5.1.16'
7477
runtime "net.sourceforge.jtds:jtds:1.3.1" //MS-SQL
75-
compile "org.cloudfoundry:cloudfoundry-runtime:0.8.4"
7678
runtime 'org.bouncycastle:bcpg-jdk15on:1.50'
7779
runtime 'org.bouncycastle:bcprov-jdk15on:1.50'
78-
runtime "org.docx4j:docx4j-ImportXHTML:3.2.2"
80+
runtime ("org.docx4j:docx4j-ImportXHTML:3.2.2"){
81+
excludes 'sl4j-log4j12'
82+
}
7983
runtime "net.sf.jtidy:jtidy:r938"
80-
compile "org.quartz-scheduler:quartz:1.7.3"
84+
//compile "org.quartz-scheduler:quartz:1.7.3"
85+
compile 'commons-beanutils:commons-beanutils:1.8.3'
8186
}
8287

8388
plugins{
84-
runtime ":hibernate:$grailsVersion"
85-
runtime ":jquery:1.7.1"
86-
runtime ":jquery-ui:1.8.24"
87-
runtime ":resources:1.1.6"
88-
//runtime ":database-migration:1.3.2"
89-
build ":tomcat:$grailsVersion"
89+
build ':tomcat:7.0.54'
90+
runtime ':hibernate:3.6.10.18'
91+
compile ":jquery:1.11.1"
92+
compile ":jquery-ui:1.10.4"
93+
runtime ":resources:1.2.14"
94+
//runtime ":database-migration:1.4.0"
95+
compile ':scaffolding:2.1.2'
9096

91-
compile ":searchable:0.6.4"
92-
compile(":webflow:2.0.0") {
93-
exclude 'grails-webflow'
94-
}
97+
compile ":searchable:0.6.9"
98+
compile ":webflow:2.1.0"
9599

96100
compile ":jquery-mobile:1.1.0.5"
97-
compile ":excel-import:1.0.0"
98-
compile ":spring-security-core:1.2.7.3"
101+
//compile ":excel-import:1.0.0"
102+
compile ":spring-security-core:1.2.7.4"
99103
//compile ":spring-security-acl:1.1.1"
100104
compile ":spring-security-cas:1.0.5"
101105
compile ':webxml:1.4.1'
102-
compile ":spring-mobile:0.5.1"
103-
compile ":standalone:1.2.3"
106+
compile ":spring-mobile:1.1.3"
107+
compile ":standalone:1.3"
108+
compile ":quartz:1.0.2"
104109

105110
compile ":yui:2.8.2.1"
106111
compile (":grails-ui:1.2.3") {
107112
excludes 'yui'
108113
}
109-
compile (":richui:0.8"){
110-
excludes 'yui'
111-
}
114+
112115
compile ":ajax-uploader:1.1"
113116
compile ":bubbling:2.1.4"
114-
compile ":export:1.5"
115-
compile ":joda-time:1.4"
117+
compile (":export:1.6"){
118+
excludes 'bcmail-jdk14', 'bcprov-jdk14', 'bctsp-jdk14'
119+
}
120+
compile ":joda-time:1.5"
116121
}
117122
}

grails-app/conf/Config.groovy

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.cloudfoundry.runtime.env.CloudEnvironment
2-
import org.cloudfoundry.runtime.env.RedisServiceInfo
31
import org.apache.log4j.DailyRollingFileAppender
42
import org.apache.log4j.Priority
53
import org.apache.log4j.ConsoleAppender
@@ -44,7 +42,7 @@ import org.apache.log4j.ConsoleAppender
4442
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
4543
// }
4644

47-
grails.tomcat.jvmArgs= ["-Xms256m", "-Xmx1024m", "-XX:PermSize=512m", "-XX:MaxPermSize=512m"]
45+
grails.tomcat.jvmArgs= ["-Xms256m", "-Xmx1024m"]
4846

4947
def olfLogLevel = "ERROR"
5048
def olfLogPattern = "%d{yyyy-MM-dd/HH:mm:ss.SSS} [%t] %x %-5p %c{2} - %m%n"
@@ -77,7 +75,7 @@ else {
7775
}
7876

7977
/* */
80-
cgrails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
78+
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
8179
grails.mime.use.accept.header = false
8280
grails.mime.types = [html: ['text/html', 'application/xhtml+xml'],
8381
xml: ['text/xml', 'application/xml'],
@@ -192,6 +190,11 @@ grails.plugins.springsecurity.securityConfigType = 'Requestmap'
192190

193191
//resource plugin
194192
//grails.resources.debug=true
193+
//grails.databinding.useSpringBinder = true
194+
195+
// What URL patterns should be processed by the resources plugin
196+
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
197+
grails.resources.adhoc.includes = ['/images/**', '/css/**', '/js/**', '/plugins/**']
195198

196199
grails.resources.modules = {
197200
labelPrinter{
@@ -250,4 +253,7 @@ grails.views.javascript.library="prototype"
250253
//make sure that the restful controller is only called via secure http since the access token can easily be sniffed out otherwise
251254
grails.plugins.springsecurity.secureChannel.definition = [
252255
'/restful/**' : 'REQUIRES_SECURE_CHANNEL'
253-
]
256+
]
257+
258+
//restore default data binding behaviour we knew from grails 2.2, i.e. empty strings are not converted to NULL anymore
259+
grails.databinding.convertEmptyStringsToNull = false

grails-app/conf/DataSource.groovy

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import org.cloudfoundry.runtime.env.CloudEnvironment
2-
import org.cloudfoundry.runtime.env.RdbmsServiceInfo
3-
41
/*
52
* Copyright (C) 2013
63
* Center for Excellence in Nanomedicine (NanoCAN)
@@ -41,7 +38,7 @@ hibernate {
4138
}
4239

4340
// set per-environment serverURL stem for creating absolute links
44-
def cloudEnv = new CloudEnvironment()
41+
// def cloudEnv = new CloudEnvironment()
4542

4643
environments {
4744
production {
@@ -51,7 +48,7 @@ environments {
5148
test {
5249
grails.serverURL = "http://localhost:8080/${appName}"
5350
}
54-
cloud {
51+
/*cloud {
5552
dataSource {
5653
5754
dbCreate = "update"
@@ -84,18 +81,18 @@ environments {
8481
}
8582
openlab.database.name = 'cloud mySQL instance'
8683
grails.serverURL = "http://www.openlabframework.cfapps.io"
87-
}
84+
} */
8885
standalone {
8986
dataSource {
9087
pooled = true
91-
driverClassName = "org.h2.Driver"
88+
driverClassName = 'org.hsqldb.jdbcDriver'
89+
url = 'jdbc:hsqldb:file:standaloneDB'
9290
username = "sa"
9391
password = ""
9492
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
95-
url = "jdbc:h2:file:olfDB;MVCC=TRUE"
9693
}
9794
openlab.upload.dir = "upload/"
98-
openlab.database.name = 'H2 SQL instance'
95+
openlab.database.name = 'HSQLDB SQL instance'
9996
}
10097

10198
}

grails-app/controllers/org/openlab/content/DashboardController.groovy

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ class DashboardController {
4444
return
4545
}
4646

47-
[:]
48-
}
47+
if(!springSecurityService?.loggedIn){
48+
redirect(action: "auth", controller: "login", params: [bodyOnly:false])
49+
return
50+
}
51+
52+
[:]
53+
}
4954

5055
def dashboard = {
5156
if(!springSecurityService?.loggedIn){

grails-app/controllers/org/openlab/datasource/DataSourceController.groovy

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,17 @@ package org.openlab.datasource
3636
*/
3737
class DataSourceController {
3838

39-
def dataSource
39+
def grailsApplication
4040

4141
def index = {
4242
redirect action: show
4343
}
4444

4545
def show =
4646
{
47-
if (dataSource instanceof org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy) {
48-
def baseDataSource = dataSource.targetDataSource
49-
[url: baseDataSource.url, driverClassName: baseDataSource.driverClassName, username: baseDataSource.username]
50-
}
51-
52-
else {
53-
[url: dataSource.jdbcUrl, driverClassName: dataSource.driverClass, username: dataSource.user]
54-
}
47+
def ds = grailsApplication.config.dataSource
5548

49+
[url: ds.url, driverClassName: ds.driverClassName, username: ds.username]
5650
}
5751

5852

0 commit comments

Comments
 (0)