Groovy Documentation

org.grails.plugin.platform.config
[Groovy] Class PluginConfigurationImpl

java.lang.Object
  org.grails.plugin.platform.config.PluginConfigurationImpl
All Implemented Interfaces:
PluginConfiguration, org.springframework.context.ApplicationContextAware

class PluginConfigurationImpl

Bean for declaring and accessing plugin config Plugins declare the config they support, the expected types, validators and default values This means they do not have to supply/merge default values into Config. The values of these settings provided by the user are read from /grails-app/conf/PluginConfig.groovy so that they can be merged in and validated Config priority is in this order: 1. Values supplied by the application in Config.groovy 2. Values supplied in PluginConfig.groovy 3. Default values specified by the declaring plugin


Field Summary
protected java.util.Map legacyPluginConfigurationEntries

protected java.util.List pluginConfigurationEntries

 
Property Summary
static java.lang.Object PLUGIN_CONFIG_CLASS

org.springframework.context.ApplicationContext applicationContext

java.lang.Object grailsApplication

java.lang.Object injectedMethods

java.lang.Object log

java.lang.Object pluginManager

 
Constructor Summary
PluginConfigurationImpl()

 
Method Summary
void applyAppPluginConfiguration(groovy.util.ConfigObject appPluginConfig)

Load plugin config settigns from PluginConfig.groovy and merge into main app config

void applyConfig()

Take app config, merge in config from PluginConfig.groovy and then doWithConfig blocks, and validate the whole lot according to doWithConfigOptions

void applyPluginConfigurationDefaultValuesAndConstraints()

Apply plugin-supplied config defaults for declared config values if values are missing and then validate

void clearCaches()

java.util.List getAllEntries()

Get information about all the declared plugin config variables

groovy.util.ConfigObject getPluginConfig(java.lang.String pluginName)

Return the plugin-specific ConfigObject for the given plugin

groovy.util.ConfigObject getPluginConfigFor(java.lang.Object objectInstance)

Get pluginConfig for any object, determined by the plugin in which is was defined

protected void loadConfigurationOptions()

Load up all the doWithConfigOptions metadata

protected groovy.util.ConfigObject loadPluginConfig()

void mergeConfigs(groovy.util.ConfigObject newConfig, groovy.util.ConfigObject oldConfig)

Merge new into old, working around the problems with merging ConfigObjects that already have values or already have empty nodes in the old one

void mergeDoWithConfig()

Load cross-plugin doWithConfig configuration and merge into main app config

void migrateLegacyConfigValues(boolean overwriteExisting)

Find any config values that start with legacy prefixes from doWithConfigOptions and copy them into the correct plugin namespace so that plugins only need to check the new location

groovy.util.ConfigObject parseConfigClosure(groovy.lang.Closure c)

Take a Closure and use it as config, returns a ConfigObject

void reload()

groovy.util.ConfigObject safeConfigMerge(java.util.Map config, java.util.Map other)

Copies values from other into config, only if no value already exists in config Impl works around bug with other containing empty ConfigObject that obliterate non-Map valus in config

protected void setConfigValueByPath(java.lang.String fullPath, java.lang.Object value, boolean overwriteExisting = true)

Set an app config value using a full string path key

void verifyConfig()

Warn the user if any plugin.x config exists that is not declared by a plugin

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

legacyPluginConfigurationEntries

protected java.util.Map legacyPluginConfigurationEntries


pluginConfigurationEntries

protected java.util.List pluginConfigurationEntries


 
Property Detail

PLUGIN_CONFIG_CLASS

static java.lang.Object PLUGIN_CONFIG_CLASS


applicationContext

org.springframework.context.ApplicationContext applicationContext


grailsApplication

java.lang.Object grailsApplication


injectedMethods

java.lang.Object injectedMethods


log

final java.lang.Object log


pluginManager

java.lang.Object pluginManager


 
Constructor Detail

PluginConfigurationImpl

PluginConfigurationImpl()


 
Method Detail

applyAppPluginConfiguration

void applyAppPluginConfiguration(groovy.util.ConfigObject appPluginConfig)
Load plugin config settigns from PluginConfig.groovy and merge into main app config


applyConfig

void applyConfig()
Take app config, merge in config from PluginConfig.groovy and then doWithConfig blocks, and validate the whole lot according to doWithConfigOptions


applyPluginConfigurationDefaultValuesAndConstraints

void applyPluginConfigurationDefaultValuesAndConstraints()
Apply plugin-supplied config defaults for declared config values if values are missing and then validate


clearCaches

void clearCaches()


getAllEntries

java.util.List getAllEntries()
Get information about all the declared plugin config variables


getPluginConfig

groovy.util.ConfigObject getPluginConfig(java.lang.String pluginName)
Return the plugin-specific ConfigObject for the given plugin
Parameters:
pluginName - the BEAN notation name of the plugin e.g. beanFields


getPluginConfigFor

groovy.util.ConfigObject getPluginConfigFor(java.lang.Object objectInstance)
Get pluginConfig for any object, determined by the plugin in which is was defined


loadConfigurationOptions

protected void loadConfigurationOptions()
Load up all the doWithConfigOptions metadata


loadPluginConfig

protected groovy.util.ConfigObject loadPluginConfig()


mergeConfigs

void mergeConfigs(groovy.util.ConfigObject newConfig, groovy.util.ConfigObject oldConfig)
Merge new into old, working around the problems with merging ConfigObjects that already have values or already have empty nodes in the old one


mergeDoWithConfig

void mergeDoWithConfig()
Load cross-plugin doWithConfig configuration and merge into main app config


migrateLegacyConfigValues

void migrateLegacyConfigValues(boolean overwriteExisting)
Find any config values that start with legacy prefixes from doWithConfigOptions and copy them into the correct plugin namespace so that plugins only need to check the new location


parseConfigClosure

groovy.util.ConfigObject parseConfigClosure(groovy.lang.Closure c)
Take a Closure and use it as config, returns a ConfigObject


reload

void reload()


safeConfigMerge

groovy.util.ConfigObject safeConfigMerge(java.util.Map config, java.util.Map other)
Copies values from other into config, only if no value already exists in config Impl works around bug with other containing empty ConfigObject that obliterate non-Map valus in config


setConfigValueByPath

protected void setConfigValueByPath(java.lang.String fullPath, java.lang.Object value, boolean overwriteExisting = true)
Set an app config value using a full string path key


verifyConfig

void verifyConfig()
Warn the user if any plugin.x config exists that is not declared by a plugin


 

Groovy Documentation