public enum Environment extends java.lang.Enum<Environment>
| Enum Constant and Description |
|---|
APPLICATION
For the application data source, primarly for backward compatability for those applications
that use ApplicationDataSource.groovy.
|
CUSTOM
A custom environment
|
DEVELOPMENT
The development environment
|
PRODUCTION
The production environment
|
TEST
The test environment
|
| Modifier and Type | Field and Description |
|---|---|
static org.codehaus.groovy.control.MultipleCompilationErrorsException |
currentCompilationError |
static java.lang.Throwable |
currentReloadError |
static java.lang.String |
DEFAULT
Constants that indicates whether this GrailsApplication is running in the default environment
|
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
|
| Modifier and Type | Method and Description |
|---|---|
static void |
cacheCurrentEnvironment() |
static java.lang.Object |
executeForCurrentEnvironment(groovy.lang.Closure<?> closure)
Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And executes the closure that relates to the current environment |
static java.lang.Object |
executeForEnvironment(Environment env,
groovy.lang.Closure<?> closure)
Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And executes the closure that relates to the specified environment |
static Environment |
getCurrent()
Returns the current environment which is typcally either DEVELOPMENT, PRODUCTION or TEST.
|
static org.codehaus.groovy.control.MultipleCompilationErrorsException |
getCurrentCompilationError() |
static Environment |
getCurrentEnvironment() |
static java.lang.Throwable |
getCurrentReloadError() |
static Environment |
getEnvironment(java.lang.String shortName)
Returns the environment for the given short name
|
static groovy.lang.Closure<?> |
getEnvironmentSpecificBlock(groovy.lang.Closure<?> closure)
Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And returns the closure that relates to the current environment |
static groovy.lang.Closure<?> |
getEnvironmentSpecificBlock(Environment env,
groovy.lang.Closure<?> closure)
Takes an environment specific DSL block like:
environments {
development {}
production {}
}
And returns the closure that relates to the specified |
java.lang.String |
getName() |
java.lang.String |
getReloadLocation() |
boolean |
hasReloadLocation() |
static boolean |
isDevelopmentMode()
Returns true if the application is running in development mode (within grails run-app)
|
static boolean |
isFork()
Whether this is a fork of the Grails command line environment
|
static boolean |
isInitializing() |
static boolean |
isInteractiveMode() |
boolean |
isReloadEnabled() |
static boolean |
isReloadingAgentEnabled() |
static boolean |
isReloadInProgress() |
static boolean |
isSystemSet() |
static boolean |
isWarDeployed()
Check whether the application is deployed
|
static boolean |
isWithinShell()
Returns whether the environment is running within the Grails shell (executed via the 'grails' command line in a terminal window)
|
static void |
setCurrentReloadError(java.lang.Throwable currentReloadError) |
static void |
setInitializing(boolean initializing) |
void |
setName(java.lang.String name)
Set the name.
|
static Environment |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Environment[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Environment DEVELOPMENT
public static final Environment PRODUCTION
public static final Environment TEST
public static final Environment APPLICATION
public static final Environment CUSTOM
public static java.lang.String KEY
public static java.lang.String RELOAD_ENABLED
public static final java.lang.String RELOAD_LOCATION
public static final java.lang.String INTERACTIVE_MODE_ENABLED
public static final java.lang.String DEFAULT
public static final java.lang.String INITIALIZING
public static java.lang.Throwable currentReloadError
public static org.codehaus.groovy.control.MultipleCompilationErrorsException currentCompilationError
public static Environment[] values()
for (Environment c : Environment.values()) System.out.println(c);
public static Environment valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static void setCurrentReloadError(java.lang.Throwable currentReloadError)
public static org.codehaus.groovy.control.MultipleCompilationErrorsException getCurrentCompilationError()
public static java.lang.Throwable getCurrentReloadError()
public static boolean isReloadInProgress()
public static Environment getCurrent()
public static void cacheCurrentEnvironment()
public static Environment getCurrentEnvironment()
getCurrent()public static boolean isDevelopmentMode()
public static boolean isWarDeployed()
public static boolean isFork()
public static boolean isWithinShell()
public static boolean isSystemSet()
public static Environment getEnvironment(java.lang.String shortName)
shortName - The short namepublic static groovy.lang.Closure<?> getEnvironmentSpecificBlock(groovy.lang.Closure<?> closure)
environments {
development {}
production {}
}
And returns the closure that relates to the current environmentclosure - The top level closurepublic static groovy.lang.Closure<?> getEnvironmentSpecificBlock(Environment env, groovy.lang.Closure<?> closure)
environments {
development {}
production {}
}
And returns the closure that relates to the specifiedenv - The environment to useclosure - The top level closurepublic static java.lang.Object executeForCurrentEnvironment(groovy.lang.Closure<?> closure)
environments {
development {}
production {}
}
And executes the closure that relates to the current environmentclosure - The top level closurepublic static java.lang.Object executeForEnvironment(Environment env, groovy.lang.Closure<?> closure)
environments {
development {}
production {}
}
And executes the closure that relates to the specified environmentenv - The environment to useclosure - The top level closurepublic java.lang.String getName()
public void setName(java.lang.String name)
name - the namepublic boolean isReloadEnabled()
public static boolean isInteractiveMode()
public static boolean isInitializing()
public static void setInitializing(boolean initializing)
public static boolean isReloadingAgentEnabled()
public java.lang.String getReloadLocation()
public boolean hasReloadLocation()