Package: org.codehaus.groovy.grails.cli.api

## [Java] Class BaseSettingsApi

- org.codehaus.groovy.grails.cli.api.BaseSettingsApi

- Utility methods used on the command line.

  Authors:
    Graeme Rocher

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected java.lang.Object` | `appClassName` |
    `protected GrailsBuildEventListener` | `buildEventListener` |
    `protected java.util.Properties` | `buildProps` |
    `protected BuildSettings` | `buildSettings` |
    `protected groovy.util.ConfigSlurper` | `configSlurper` |
    `protected boolean` | `enableProfile` |
    `protected java.lang.String` | `grailsAppName` |
    `protected java.io.File` | `grailsHome` |
    `protected boolean` | `isInteractive` |
    `protected Metadata` | `metadata` |
    `protected java.io.File` | `metadataFile` |
    `protected PluginBuildSettings` | `pluginSettings` |
    `protected java.lang.String` | `pluginsHome` |
    `protected PathMatchingResourcePatternResolver` | `resolver` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `BaseSettingsApi (BuildSettings buildSettings, boolean interactive)`
    `BaseSettingsApi (BuildSettings settings, GrailsBuildEventListener buildEventListener, boolean interactive)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `boolean` | `confirmInput(java.lang.String message, java.lang.String code)` Interactive prompt that can be used by any part of the build.
    `boolean` | `confirmInput(java.lang.String message)`
    `void` | `copyGrailsResource(java.lang.Object targetFile, Resource resource)` Copies a Spring resource to the file system.
    `void` | `copyGrailsResource(java.lang.Object targetFile, Resource resource, boolean overwrite)`
    `void` | `copyGrailsResources(java.lang.Object destDir, java.lang.Object pattern)`
    `void` | `copyGrailsResources(java.lang.Object destDir, java.lang.Object pattern, boolean overwrite)`
    `groovy.util.XmlSlurper` | `createXmlSlurper()`
    `void` | `enableUaa()`
    `void` | `exit(int code)` Exits the build immediately with a given exit code.
    `java.lang.Object` | `getAppClassName()`
    `java.lang.String` | `getAppGrailsVersion()`
    `GrailsBuildEventListener` | `getBuildEventListener()`
    `java.util.Properties` | `getBuildProps()`
    `BuildSettings` | `getBuildSettings()`
    `groovy.util.ConfigSlurper` | `getConfigSlurper()`
    `java.lang.String` | `getGrailsAppName()`
    `java.lang.String` | `getGrailsAppVersion()`
    `java.io.File` | `getGrailsHome()`
    `boolean` | `getIsInteractive()`
    `Metadata` | `getMetadata()`
    `java.io.File` | `getMetadataFile()`
    `PluginBuildSettings` | `getPluginBuildSettings()`
    `PluginBuildSettings` | `getPluginSettings()`
    `java.lang.String` | `getPluginsHome()`
    `java.lang.Object` | `getPropertyValue(java.lang.String propName, java.lang.Object defaultValue)` Resolves the value for a given property name.
    `PathMatchingResourcePatternResolver` | `getResolver()`
    `java.lang.String` | `getServerHost()`
    `int` | `getServerPort()`
    `int` | `getServerPortHttps()`
    `java.lang.String` | `getServletVersion()`
    `Resource` | `grailsResource(java.lang.String path)` Closure that returns a Spring Resource - either from $GRAILS_HOME if that is set, or from the classpath.
    `protected boolean` | `isDeclared(java.lang.Object cla, java.lang.reflect.Method readMethod)`
    `boolean` | `isEnableProfile()`
    `void` | `logError(java.lang.String message, java.lang.Throwable t)`
    `void` | `logErrorAndExit(java.lang.String message, java.lang.Throwable t)`
    `void` | `makeApiAvailableToScripts(groovy.lang.Binding binding, java.lang.Object cla)`
    `java.lang.String` | `makeRelative(java.lang.String path)`
    `java.lang.String` | `makeRelative(java.io.File file)`
    `void` | `profile(java.lang.String name, groovy.lang.Closure<?> callable)` Times the execution of a closure, which can include a target.
    `java.util.List<groovy.util.slurpersupport.GPathResult>` | `readAllPluginXmlMetadata()` Reads all installed plugin descriptors returning a list
    `groovy.util.slurpersupport.GPathResult` | `readPluginXmlMetadata(java.lang.String pluginName)` Reads a plugin.xml descriptor for the given plugin name
    `Resource[]` | `resolveResources(java.lang.String pattern)`
    `void` | `updateMetadata(Metadata metadata, java.util.Map entries)`
    `void` | `updateMetadata(java.util.Map entries)` Modifies the application's metadata, as stored in the "application.properties" file.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `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

    - #### protected java.lang.Object appClassName

    - #### protected GrailsBuildEventListener buildEventListener

    - #### protected java.util.Properties buildProps

    - #### protected BuildSettings buildSettings

    - #### protected groovy.util.ConfigSlurper configSlurper

    - #### protected boolean enableProfile

    - #### protected java.lang.String grailsAppName

    - #### protected java.io.File grailsHome

    - #### protected boolean isInteractive

    - #### protected Metadata metadata

    - #### protected java.io.File metadataFile

    - #### protected PluginBuildSettings pluginSettings

    - #### protected java.lang.String pluginsHome

    - #### protected PathMatchingResourcePatternResolver resolver

  - ### Constructor Detail

    - #### public BaseSettingsApi(BuildSettings buildSettings, boolean interactive)

    - #### public BaseSettingsApi(BuildSettings settings, GrailsBuildEventListener buildEventListener, boolean interactive)

  - ### Method Detail

    - #### public boolean confirmInput(java.lang.String message, java.lang.String code)

      Interactive prompt that can be used by any part of the build. Echos the given message to the console and waits for user input that matches either 'y' or 'n'. Returns `true` if the user enters 'y', `false` otherwise.

    - #### public boolean confirmInput(java.lang.String message)

    - #### public void copyGrailsResource(java.lang.Object targetFile, Resource resource)

      Copies a Spring resource to the file system.

    - #### public void copyGrailsResource(java.lang.Object targetFile, Resource resource, boolean overwrite)

    - #### public void copyGrailsResources(java.lang.Object destDir, java.lang.Object pattern)

    - #### public void copyGrailsResources(java.lang.Object destDir, java.lang.Object pattern, boolean overwrite)

    - #### public groovy.util.XmlSlurper createXmlSlurper()

    - #### public void enableUaa()

    - #### public void exit(int code)

      Exits the build immediately with a given exit code.

    - #### public java.lang.Object getAppClassName()

    - #### public java.lang.String getAppGrailsVersion()

    - #### public GrailsBuildEventListener getBuildEventListener()

    - #### public java.util.Properties getBuildProps()

    - #### public BuildSettings getBuildSettings()

    - #### public groovy.util.ConfigSlurper getConfigSlurper()

    - #### public java.lang.String getGrailsAppName()

    - #### public java.lang.String getGrailsAppVersion()

    - #### public java.io.File getGrailsHome()

    - #### public boolean getIsInteractive()

    - #### public Metadata getMetadata()

    - #### public java.io.File getMetadataFile()

    - #### public PluginBuildSettings getPluginBuildSettings()

    - #### public PluginBuildSettings getPluginSettings()

    - #### public java.lang.String getPluginsHome()

    - #### public java.lang.Object getPropertyValue(java.lang.String propName, java.lang.Object defaultValue)

      Resolves the value for a given property name. It first looks for a system property, then in the BuildSettings configuration, and finally uses the given default value if other options are exhausted.

    - #### public PathMatchingResourcePatternResolver getResolver()

    - #### public java.lang.String getServerHost()

    - #### public int getServerPort()

    - #### public int getServerPortHttps()

    - #### public java.lang.String getServletVersion()

    - #### public Resource grailsResource(java.lang.String path)

      Closure that returns a Spring Resource - either from $GRAILS_HOME if that is set, or from the classpath.

    - #### protected boolean isDeclared(java.lang.Object cla, java.lang.reflect.Method readMethod)

    - #### public boolean isEnableProfile()

    - #### public void logError(java.lang.String message, java.lang.Throwable t)

    - #### public void logErrorAndExit(java.lang.String message, java.lang.Throwable t)

    - #### public void makeApiAvailableToScripts(groovy.lang.Binding binding, java.lang.Object cla)

    - #### public java.lang.String makeRelative(java.lang.String path)

    - #### public java.lang.String makeRelative(java.io.File file)

    - #### public void profile(java.lang.String name, groovy.lang.Closure<?> callable)

      Times the execution of a closure, which can include a target. For example, profile("compile", compile) where 'compile' is the target.

    - #### public java.util.List<groovy.util.slurpersupport.GPathResult> readAllPluginXmlMetadata()

      Reads all installed plugin descriptors returning a list

    - #### public groovy.util.slurpersupport.GPathResult readPluginXmlMetadata(java.lang.String pluginName)

      Reads a plugin.xml descriptor for the given plugin name

    - #### public Resource[] resolveResources(java.lang.String pattern)

    - #### public void updateMetadata(Metadata metadata, @java.lang.SuppressWarnings("rawtypes") java.util.Map entries)

    - #### public void updateMetadata(@java.lang.SuppressWarnings("rawtypes") java.util.Map entries)

      Modifies the application's metadata, as stored in the "application.properties" file. If it doesn't exist, the file is created.