Permalink
Browse files

Introduced reset method to provide more suitable output onConfigChange.

  • Loading branch information...
1 parent 53e86ae commit ecbf6a558fa702883ba87ce738ccca130eca7ee5 acampbell3000 committed Jul 17, 2010
@@ -29,9 +29,10 @@ class OauthGrailsPlugin {
// URL to the plugin's documentation
def documentation = "http://www.grails.org/plugin/oauth"
-
- def doWithDynamicMethods = { ctx ->
- // TODO Implement registering dynamic methods to classes (optional)
+
+ def onConfigChange = { event ->
+ // Config change, need to reset the OauthService
+ final def oauthService = event?.ctx?.getBean("oauthService")
+ oauthService?.reset()
}
-
}
@@ -33,7 +33,16 @@ class OauthService implements InitializingBean {
def providers = [:]
def consumers = [:]
String callback = ""
-
+
+ /**
+ * Initialise config properties.
+ */
+ @Override
+ void afterPropertiesSet() {
+ log?.info "Initialising the ${this.getClass().getSimpleName()}..."
+ reset()
+ }
+
/**
* Parses OAuth settings in Config.groovy and propagates providers and consumers
*
@@ -76,9 +85,8 @@ class OauthService implements InitializingBean {
* Note: The scope provider specific property and is a optional. Only providers
* such as Google's GDATA API make use of this property.
*/
- @Override
- void afterPropertiesSet() {
- log?.info "Initialising the ${this.getClass().getSimpleName()}..."
+ void reset() {
+ log?.info "Resetting ${this.getClass().getSimpleName()} configuration..."
// Initialize consumer list by reading config
final String serverURL = C.config.grails.serverURL.toString()

0 comments on commit ecbf6a5

Please sign in to comment.