This repository was archived by the owner on Jul 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJerseyRequestBuilderGrailsPlugin.groovy
75 lines (66 loc) · 2.57 KB
/
JerseyRequestBuilderGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright 2013-2015 Bud Byrd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.budjb.requestbuilder.JerseyClientFactory
import com.budjb.requestbuilder.JerseyRequestBuilderImpl
import grails.util.Environment
import org.codehaus.groovy.grails.commons.GrailsApplication
class JerseyRequestBuilderGrailsPlugin {
def version = "2.0.2"
def grailsVersion = "2.0 > *"
def title = "Jersey Request Builder Plugin"
def author = "Bud Byrd"
def authorEmail = "bud.byrd@gmail.com"
def description = 'Provides the Jersey client library and a builder to simplify use of the library.'
def documentation = "http://budjb.github.io/grails-jersey-request-builder/doc/manual/index.html"
def license = "APACHE"
def developers = [
[
name: "Aaron Brown",
email: "brown.aaron.lloyd@gmail.com"
],
]
def issueManagement = [system: 'GITHUB', url: 'https://github.com/budjb/grails-jersey-request-builder/issues']
def scm = [url: 'https://github.com/budjb/grails-jersey-request-builder']
def pluginExcludes = [
'grails-app/controllers/**',
'src/groovy/com/budjb/requestbuilder/RequestBuilderFunctionalTest.groovy',
'src/docs/**',
'test/**'
]
def doWithSpring = {
loadDefaultConfig(application)
'jerseyRequestBuilder'(JerseyRequestBuilderImpl) { bean ->
bean.autowire = true
}
'jerseyClientFactory'(JerseyClientFactory) { bean ->
bean.autowire = true
}
}
def onConfigChange = {
loadDefaultConfig(application)
}
/**
* Merges plugin config with host app config, but allowing customization
*
* @param app
*/
private void loadDefaultConfig(GrailsApplication app) {
GroovyClassLoader classLoader = new GroovyClassLoader(getClass().classLoader)
ConfigObject defaultConfig = new ConfigSlurper(Environment.current.name).parse(classLoader.loadClass('DefaultJerseyRequestBuilderConfig'))
defaultConfig.merge(app.config)
app.config.merge(defaultConfig)
}
}