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

java.lang.Object
  extended by org.codehaus.groovy.grails.cli.api.BaseSettingsApi

public class BaseSettingsApi
extends java.lang.Object

Utility methods used on the command line.


Field Summary
protected  java.lang.Object appClassName
           
protected  GrailsBuildEventListener buildEventListener
           
protected  java.util.Properties buildProps
           
protected  grails.util.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  grails.util.PluginBuildSettings pluginSettings
           
protected  java.lang.String pluginsHome
           
protected  PathMatchingResourcePatternResolver resolver
           
 
Constructor Summary
BaseSettingsApi(grails.util.BuildSettings buildSettings, boolean interactive)
           
BaseSettingsApi(grails.util.BuildSettings settings, GrailsBuildEventListener buildEventListener, boolean interactive)
           
 
Method Summary
 boolean confirmInput(java.lang.String message)
           
 boolean confirmInput(java.lang.String message, java.lang.String code)
          Interactive prompt that can be used by any part of the build.
 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)
           
 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()
           
 grails.util.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()
           
 grails.util.PluginBuildSettings getPluginBuildSettings()
           
 grails.util.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.io.File file)
           
 java.lang.String makeRelative(java.lang.String path)
           
 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(java.util.Map entries)
          Modifies the application's metadata, as stored in the "application.properties" file.
 void updateMetadata(Metadata metadata, java.util.Map entries)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buildSettings

protected grails.util.BuildSettings buildSettings

buildProps

protected java.util.Properties buildProps

resolver

protected PathMatchingResourcePatternResolver resolver

grailsHome

protected java.io.File grailsHome

metadata

protected Metadata metadata

metadataFile

protected java.io.File metadataFile

enableProfile

protected boolean enableProfile

isInteractive

protected boolean isInteractive

pluginsHome

protected java.lang.String pluginsHome

pluginSettings

protected grails.util.PluginBuildSettings pluginSettings

grailsAppName

protected java.lang.String grailsAppName

appClassName

protected java.lang.Object appClassName

configSlurper

protected groovy.util.ConfigSlurper configSlurper

buildEventListener

protected GrailsBuildEventListener buildEventListener
Constructor Detail

BaseSettingsApi

public BaseSettingsApi(grails.util.BuildSettings buildSettings,
                       boolean interactive)

BaseSettingsApi

public BaseSettingsApi(grails.util.BuildSettings settings,
                       GrailsBuildEventListener buildEventListener,
                       boolean interactive)
Method Detail

getBuildEventListener

public GrailsBuildEventListener getBuildEventListener()

enableUaa

public void enableUaa()

getConfigSlurper

public groovy.util.ConfigSlurper getConfigSlurper()

getAppClassName

public java.lang.Object getAppClassName()

getServerPort

public int getServerPort()

getServerPortHttps

public int getServerPortHttps()

getServerHost

public java.lang.String getServerHost()

getGrailsAppName

public java.lang.String getGrailsAppName()

getGrailsAppVersion

public java.lang.String getGrailsAppVersion()

getAppGrailsVersion

public java.lang.String getAppGrailsVersion()

getServletVersion

public java.lang.String getServletVersion()

getPluginsHome

public java.lang.String getPluginsHome()

getPluginBuildSettings

public grails.util.PluginBuildSettings getPluginBuildSettings()

getPluginSettings

public grails.util.PluginBuildSettings getPluginSettings()

getBuildSettings

public grails.util.BuildSettings getBuildSettings()

getBuildProps

public java.util.Properties getBuildProps()

getResolver

public PathMatchingResourcePatternResolver getResolver()

getGrailsHome

public java.io.File getGrailsHome()

getMetadata

public Metadata getMetadata()

getMetadataFile

public java.io.File getMetadataFile()

isEnableProfile

public boolean isEnableProfile()

getIsInteractive

public boolean getIsInteractive()

resolveResources

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

grailsResource

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.


copyGrailsResource

public void copyGrailsResource(java.lang.Object targetFile,
                               Resource resource)
                        throws java.io.FileNotFoundException,
                               java.io.IOException
Copies a Spring resource to the file system.

Throws:
java.io.FileNotFoundException
java.io.IOException

copyGrailsResource

public void copyGrailsResource(java.lang.Object targetFile,
                               Resource resource,
                               boolean overwrite)
                        throws java.io.FileNotFoundException,
                               java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

copyGrailsResources

public void copyGrailsResources(java.lang.Object destDir,
                                java.lang.Object pattern)
                         throws java.io.FileNotFoundException,
                                java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

copyGrailsResources

public void copyGrailsResources(java.lang.Object destDir,
                                java.lang.Object pattern,
                                boolean overwrite)
                         throws java.io.FileNotFoundException,
                                java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getPropertyValue

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.


updateMetadata

public void updateMetadata(Metadata metadata,
                           java.util.Map entries)

updateMetadata

public void updateMetadata(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.


readPluginXmlMetadata

public groovy.util.slurpersupport.GPathResult readPluginXmlMetadata(java.lang.String pluginName)
                                                             throws java.lang.Exception
Reads a plugin.xml descriptor for the given plugin name

Throws:
java.lang.Exception

readAllPluginXmlMetadata

public java.util.List<groovy.util.slurpersupport.GPathResult> readAllPluginXmlMetadata()
                                                                                throws java.lang.Exception
Reads all installed plugin descriptors returning a list

Throws:
java.lang.Exception

profile

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.


makeRelative

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

makeRelative

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

exit

public void exit(int code)
Exits the build immediately with a given exit code.


confirmInput

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.


confirmInput

public boolean confirmInput(java.lang.String message)

logError

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

logErrorAndExit

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

makeApiAvailableToScripts

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

isDeclared

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