Groovy Documentation

org.codehaus.groovy.grails.plugins
[Groovy] Class GrailsPluginUtils

java.lang.Object
  org.codehaus.groovy.grails.plugins.GrailsPluginUtils

class GrailsPluginUtils
extends java.lang.Object

Utility class containing methods that aid in loading and evaluating plug-ins.

Authors:
Graeme Rocher
Since:
1.0


Property Summary
static java.lang.String GRAILS_HOME

static java.lang.String WILDCARD

 
Method Summary
static java.lang.Object clearCaches()

Clears cached resolved resources

static org.springframework.core.io.Resource[] getArtefactResources(java.lang.String basedir)

All artefact resources (all Groovy files contained within the grails-app directory of plugins or applications).

static org.springframework.core.io.Resource[] getArtefactResourcesForOne(java.lang.String projectDir)

All artefacts in the given application or plugin directory as Spring resources.

static org.springframework.core.io.Resource[] getAvailableScripts(java.lang.String grailsHome, java.lang.String pluginDirPath, java.lang.String basedir)

All Gant scripts that are availabe for execution in a Grails application.

static org.springframework.core.io.Resource getBasePluginDescriptor(java.lang.String basedir)

static org.springframework.core.io.Resource getDescriptorForPlugin(org.springframework.core.io.Resource pluginDir)

Returns the descriptor location for the given plugin directory.

static java.lang.String getGlobalPluginsPath()

The path to the global plugins directory.

static java.util.List getImplicitPluginDirectories(java.lang.String pluginDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)

All plugin directories in both the given path and the global "plugins" directory together.

static java.lang.String getLowerVersion(java.lang.String pluginVersion)

Returns the lower version of a Grails version number expression in a plugin

static groovy.util.slurpersupport.GPathResult getMetadataForPlugin(java.lang.String pluginName)

Returns XML about the plugin.

static groovy.util.slurpersupport.GPathResult getMetadataForPlugin(org.springframework.core.io.Resource pluginDir)

Returns XML metadata for the plugin.

static java.util.List getPluginBaseDirectories(java.lang.String pluginDirPath)

All the known plugin base directories (directories where plugins are installed to).

static java.util.List getPluginBaseDirectories()

All the known plugin base directories (directories where plugins are installed to).

static PluginBuildSettings getPluginBuildSettings()

Returns a cached PluginBuildSettings instance.

static org.springframework.core.io.Resource[] getPluginDescriptors(java.lang.String basedir, java.lang.String pluginsDirPath)

All plug-in descriptors (the root classes that end with *GrailsPlugin.groovy).

static org.springframework.core.io.Resource getPluginDirForName(java.lang.String pluginName)

Obtains a plugin directory for the given name.

static org.springframework.core.io.Resource getPluginDirForName(java.lang.String pluginsDirPath, java.lang.String pluginName)

Obtains a plugin directory for the given name.

static org.springframework.core.io.Resource[] getPluginDirectories()

static org.springframework.core.io.Resource[] getPluginDirectories(java.lang.String pluginDirPath)

static org.springframework.core.io.Resource[] getPluginI18nDirectories(java.lang.String pluginsDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)

All plugin i18n directories.

static GrailsPluginInfo[] getPluginInfos(java.lang.String pluginDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)

Returns an array of PluginInfo objects

static org.springframework.core.io.Resource[] getPluginJarFiles(java.lang.String pluginsDirPath)

All plug-in provided JAR files.

static org.springframework.core.io.Resource[] getPluginLibDirectories(java.lang.String pluginsDirPath)

All plug-in lib directories.

static java.lang.String getPluginName(java.lang.Class clazz)

Get the name of the a plugin for a particular class.

static org.springframework.core.io.Resource[] getPluginResourceBundles(java.lang.String pluginDirPath)

All plugin provided resource bundles.

static org.springframework.core.io.Resource[] getPluginScripts(java.lang.String pluginDirPath)

Plug-in provided Gant scripts available to a Grails application.

static org.springframework.core.io.Resource[] getPluginSourceFiles(java.lang.String pluginsDirPath)

All plug-in provided source files (Java and Groovy).

static java.lang.String getPluginVersion(java.lang.Class clazz)

Get the version of the a plugin for a particular class.

static org.springframework.core.io.Resource[] getPluginXmlMetadata(java.lang.String pluginsDirPath)

The Plugin metadata XML files used to describe the plugins provided resources.

static GrailsPluginInfo[] getSupportedPluginInfos(java.lang.String pluginDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)

Returns only the PluginInfo objects that support the current Environment and BuildScope

static java.lang.String getUpperVersion(java.lang.String pluginVersion)

Returns the upper version of a Grails version number expression in a plugin

static boolean isGlobalPluginLocation(org.springframework.core.io.Resource pluginDir)

static boolean isValidVersion(java.lang.String pluginVersion, java.lang.String requiredVersion)

Check if the required version is a valid for the given plugin version.

static boolean isVersionGreaterThan(java.lang.String leftVersion, java.lang.String rightVersion)

Returns true if rightVersion is greater than leftVersion

static PluginBuildSettings newPluginBuildSettings()

Returns a new PluginBuildSettings instance

static java.lang.Object setPluginBuildSettings(PluginBuildSettings settings)

static boolean supportsAtLeastVersion(java.lang.String pluginVersion, java.lang.String requiredVersion)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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()
 

Property Detail

GRAILS_HOME

static final java.lang.String GRAILS_HOME


WILDCARD

static final java.lang.String WILDCARD


 
Method Detail

clearCaches

static java.lang.Object clearCaches()
Clears cached resolved resources


getArtefactResources

static org.springframework.core.io.Resource[] getArtefactResources(java.lang.String basedir)
All artefact resources (all Groovy files contained within the grails-app directory of plugins or applications).


getArtefactResourcesForOne

static org.springframework.core.io.Resource[] getArtefactResourcesForOne(java.lang.String projectDir)
All artefacts in the given application or plugin directory as Spring resources.


getAvailableScripts

static org.springframework.core.io.Resource[] getAvailableScripts(java.lang.String grailsHome, java.lang.String pluginDirPath, java.lang.String basedir)
All Gant scripts that are availabe for execution in a Grails application.


getBasePluginDescriptor

static org.springframework.core.io.Resource getBasePluginDescriptor(java.lang.String basedir)


getDescriptorForPlugin

static org.springframework.core.io.Resource getDescriptorForPlugin(org.springframework.core.io.Resource pluginDir)
Returns the descriptor location for the given plugin directory. The descriptor is the Groovy file that ends with *GrailsPlugin.groovy.


getGlobalPluginsPath

static java.lang.String getGlobalPluginsPath()
The path to the global plugins directory.


getImplicitPluginDirectories

static java.util.List getImplicitPluginDirectories(java.lang.String pluginDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)
All plugin directories in both the given path and the global "plugins" directory together.


getLowerVersion

static java.lang.String getLowerVersion(java.lang.String pluginVersion)
Returns the lower version of a Grails version number expression in a plugin
deprecated:
Use GrailsVersionUtils


getMetadataForPlugin

static groovy.util.slurpersupport.GPathResult getMetadataForPlugin(java.lang.String pluginName)
Returns XML about the plugin.


getMetadataForPlugin

static groovy.util.slurpersupport.GPathResult getMetadataForPlugin(org.springframework.core.io.Resource pluginDir)
Returns XML metadata for the plugin.


getPluginBaseDirectories

static java.util.List getPluginBaseDirectories(java.lang.String pluginDirPath)
All the known plugin base directories (directories where plugins are installed to).


getPluginBaseDirectories

static java.util.List getPluginBaseDirectories()
All the known plugin base directories (directories where plugins are installed to).


getPluginBuildSettings

static PluginBuildSettings getPluginBuildSettings()
Returns a cached PluginBuildSettings instance.


getPluginDescriptors

static org.springframework.core.io.Resource[] getPluginDescriptors(java.lang.String basedir, java.lang.String pluginsDirPath)
All plug-in descriptors (the root classes that end with *GrailsPlugin.groovy).


getPluginDirForName

static org.springframework.core.io.Resource getPluginDirForName(java.lang.String pluginName)
Obtains a plugin directory for the given name.


getPluginDirForName

static org.springframework.core.io.Resource getPluginDirForName(java.lang.String pluginsDirPath, java.lang.String pluginName)
Obtains a plugin directory for the given name.


getPluginDirectories

static org.springframework.core.io.Resource[] getPluginDirectories()


getPluginDirectories

static org.springframework.core.io.Resource[] getPluginDirectories(java.lang.String pluginDirPath)


getPluginI18nDirectories

static org.springframework.core.io.Resource[] getPluginI18nDirectories(java.lang.String pluginsDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)
All plugin i18n directories.


getPluginInfos

static GrailsPluginInfo[] getPluginInfos(java.lang.String pluginDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)
Returns an array of PluginInfo objects


getPluginJarFiles

static org.springframework.core.io.Resource[] getPluginJarFiles(java.lang.String pluginsDirPath)
All plug-in provided JAR files.


getPluginLibDirectories

static org.springframework.core.io.Resource[] getPluginLibDirectories(java.lang.String pluginsDirPath)
All plug-in lib directories.


getPluginName

static java.lang.String getPluginName(java.lang.Class clazz)
Get the name of the a plugin for a particular class.
deprecated:
Use GrailsVersionUtils


getPluginResourceBundles

static org.springframework.core.io.Resource[] getPluginResourceBundles(java.lang.String pluginDirPath)
All plugin provided resource bundles.


getPluginScripts

static org.springframework.core.io.Resource[] getPluginScripts(java.lang.String pluginDirPath)
Plug-in provided Gant scripts available to a Grails application.


getPluginSourceFiles

static org.springframework.core.io.Resource[] getPluginSourceFiles(java.lang.String pluginsDirPath)
All plug-in provided source files (Java and Groovy).


getPluginVersion

static java.lang.String getPluginVersion(java.lang.Class clazz)
Get the version of the a plugin for a particular class.
deprecated:
Use GrailsVersionUtils


getPluginXmlMetadata

static org.springframework.core.io.Resource[] getPluginXmlMetadata(java.lang.String pluginsDirPath)
The Plugin metadata XML files used to describe the plugins provided resources.


getSupportedPluginInfos

static GrailsPluginInfo[] getSupportedPluginInfos(java.lang.String pluginDirPath = BuildSettingsHolder.settings?.projectPluginsDir?.path)
Returns only the PluginInfo objects that support the current Environment and BuildScope
See Also:
Environment
BuildScope


getUpperVersion

static java.lang.String getUpperVersion(java.lang.String pluginVersion)
Returns the upper version of a Grails version number expression in a plugin
deprecated:
Use GrailsVersionUtils


isGlobalPluginLocation

static boolean isGlobalPluginLocation(org.springframework.core.io.Resource pluginDir)


isValidVersion

static boolean isValidVersion(java.lang.String pluginVersion, java.lang.String requiredVersion)
Check if the required version is a valid for the given plugin version.
deprecated:
Use GrailsVersionUtils
Parameters:
pluginVersion - The plugin version
requiredVersion - The required version
Returns:
true if it is valid


isVersionGreaterThan

static boolean isVersionGreaterThan(java.lang.String leftVersion, java.lang.String rightVersion)
Returns true if rightVersion is greater than leftVersion
Parameters:
leftVersion
rightVersion
Returns:
@deprecated Use GrailsVersionUtils


newPluginBuildSettings

static PluginBuildSettings newPluginBuildSettings()
Returns a new PluginBuildSettings instance


setPluginBuildSettings

static java.lang.Object setPluginBuildSettings(PluginBuildSettings settings)


supportsAtLeastVersion

static boolean supportsAtLeastVersion(java.lang.String pluginVersion, java.lang.String requiredVersion)


 

Groovy Documentation