public enum Environment extends java.lang.Enum
Represents the current environment.
Enum constant | Description |
---|---|
APPLICATION |
For the application data source, primarily for backward compatibility for those applications that use ApplicationDataSource.groovy. |
CUSTOM |
A custom environment |
DEVELOPMENT |
The development environment |
PRODUCTION |
The production environment |
TEST |
The test environment |
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
DEFAULT |
Constants that indicates whether this GrailsApplication is running in the default environment |
static java.lang.String |
ENV_GRAILS_HOME |
The name of the GRAILS_HOME environment variable |
static java.lang.String |
ENV_KEY |
Constant used to resolve the environment via System.getenv(Environment.ENV_KEY). |
static java.lang.String |
FULL_STACKTRACE |
Whether the display of full stack traces is needed |
static java.lang.String |
INITIALIZING |
Whether Grails is in the middle of bootstrapping or not |
static java.lang.String |
INTERACTIVE_MODE_ENABLED |
Whether interactive mode is enabled |
static java.lang.String |
KEY |
Constant used to resolve the environment via System.getProperty(Environment.KEY) |
static java.lang.String |
RELOAD_ENABLED |
Specify whether reloading is enabled for this environment |
static java.lang.String |
RELOAD_LOCATION |
The location where to reload resources from |
static java.lang.String |
RUN_ACTIVE |
Constant indicating whether run-app or test-app was executed |
static java.lang.String |
STANDALONE |
Whether Grails has been executed standalone via the static void main method and not loaded in via the container |
static org.codehaus.groovy.control.MultipleCompilationErrorsException |
currentCompilationError |
|
static java.lang.Throwable |
currentReloadError |
Type Params | Return Type | Name and description |
---|---|---|
|
public static java.lang.Object |
executeForCurrentEnvironment(groovy.lang.Closure<?> closure) Takes an environment specific DSL block like: |
|
public static java.lang.Object |
executeForEnvironment(Environment env, groovy.lang.Closure<?> closure) Takes an environment specific DSL block like: |
|
public static Environment |
getCurrent() Returns the current environment which is typcally either DEVELOPMENT, PRODUCTION or TEST. |
|
public static org.codehaus.groovy.control.MultipleCompilationErrorsException |
getCurrentCompilationError() |
|
public static Environment |
getCurrentEnvironment()
|
|
public static java.lang.Throwable |
getCurrentReloadError() |
|
public static Environment |
getEnvironment(java.lang.String shortName) Returns the environment for the given short name |
|
public static groovy.lang.Closure<?> |
getEnvironmentSpecificBlock(groovy.lang.Closure<?> closure) Takes an environment specific DSL block like: |
|
public static groovy.lang.Closure<?> |
getEnvironmentSpecificBlock(Environment env, groovy.lang.Closure<?> closure) Takes an environment specific DSL block like: |
|
public static java.lang.String |
getGrailsVersion()
|
|
public java.lang.String |
getName()
|
|
public java.lang.String |
getReloadLocation()
|
|
public boolean |
hasReloadLocation()
|
|
public static boolean |
isDevelopmentEnvironmentAvailable() This method will return true if the 'grails-app' directory was found, regardless of whether reloading is active or not |
|
public static boolean |
isDevelopmentMode() |
|
public static boolean |
isDevelopmentRun() This method will return true the application is run |
|
public static boolean |
isDevtoolsRestart() Checks if the run of the app is due to spring dev-tools or not. |
|
public static boolean |
isFork() Whether this is a fork of the Grails command line environment |
|
public static boolean |
isInitializing()
|
|
public static boolean |
isInteractiveMode()
|
|
public boolean |
isReloadEnabled()
|
|
public static boolean |
isReloadInProgress() |
|
public static boolean |
isReloadingAgentEnabled() |
|
public static boolean |
isStandalone() Whether the application has been executed standalone via static void main. |
|
public static boolean |
isStandaloneDeployed() Whether the application is running standalone within a JAR |
|
public static boolean |
isSystemSet()
|
|
public static boolean |
isWarDeployed() Check whether the application is deployed |
|
public static boolean |
isWithinShell() Returns whether the environment is running within the Grails shell (executed via the 'grails' command line in a terminal window) |
|
public static void |
reset() Reset the current environment |
|
public static void |
setCurrentReloadError(java.lang.Throwable currentReloadError) |
|
public static void |
setInitializing(boolean initializing) |
|
public void |
setName(java.lang.String name) Set the name. |
Methods inherited from class | Name |
---|---|
class java.lang.Enum |
java.lang.Enum#name(), java.lang.Enum#equals(java.lang.Object), java.lang.Enum#toString(), java.lang.Enum#hashCode(), java.lang.Enum#compareTo(java.lang.Object), java.lang.Enum#compareTo(java.lang.Enum), java.lang.Enum#valueOf(java.lang.Class, java.lang.String), java.lang.Enum#getDeclaringClass(), java.lang.Enum#ordinal(), java.lang.Enum#wait(long, int), java.lang.Enum#wait(long), java.lang.Enum#wait(), java.lang.Enum#getClass(), java.lang.Enum#notify(), java.lang.Enum#notifyAll() |
For the application data source, primarily for backward compatibility for those applications that use ApplicationDataSource.groovy.
A custom environment
The development environment
The production environment
The test environment
Constants that indicates whether this GrailsApplication is running in the default environment
The name of the GRAILS_HOME environment variable
Constant used to resolve the environment via System.getenv(Environment.ENV_KEY).
Whether the display of full stack traces is needed
Whether Grails is in the middle of bootstrapping or not
Whether interactive mode is enabled
Constant used to resolve the environment via System.getProperty(Environment.KEY)
Specify whether reloading is enabled for this environment
The location where to reload resources from
Constant indicating whether run-app or test-app was executed
Whether Grails has been executed standalone via the static void main method and not loaded in via the container
Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And executes the closure that relates to the current environment
closure
- The top level closure Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And executes the closure that relates to the specified environment
env
- The environment to useclosure
- The top level closureReturns the current environment which is typcally either DEVELOPMENT, PRODUCTION or TEST. For custom environments CUSTOM type is returned.
Returns the environment for the given short name
shortName
- The short name Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And returns the closure that relates to the current environment
closure
- The top level closure Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And returns the closure that relates to the specified
env
- The environment to useclosure
- The top level closure
This method will return true if the 'grails-app' directory was found, regardless of whether reloading is active or not
This method will return true the application is run
Checks if the run of the app is due to spring dev-tools or not.
Whether this is a fork of the Grails command line environment
Whether the application has been executed standalone via static void main. This method will return true when the application is executed via `java -jar` or if the application is run directly via the main method within an IDE
Whether the application is running standalone within a JAR This method will return true only if the the application is executed via `java -jar` and not if it is run via the main method within an IDE
Check whether the application is deployed
Returns whether the environment is running within the Grails shell (executed via the 'grails' command line in a terminal window)
Reset the current environment
Set the name.
name
- the nameGroovy Documentation