grails.util
Class GrailsUtil

java.lang.Object
  extended by grails.util.GrailsUtil

public class GrailsUtil
extends Object

Grails utility methods for command line and GUI applications

Since:
0.2
Version:
$Revision: 5305 $ First Created: 02-Jun-2006 Last Updated: $Date: 2007-08-23 13:00:49 +0100 (Thu, 23 Aug 2007) $
Author:
Graeme Rocher

Constructor Summary
GrailsUtil()
           
 
Method Summary
static ApplicationContext bootstrapGrailsFromApplication(GrailsApplication application)
          Bootstraps Grails with the given GrailsApplication instance
static ApplicationContext bootstrapGrailsFromClassPath()
          Bootstraps a Grails application from the current classpath.
static ApplicationContext bootstrapGrailsFromParentContext(ApplicationContext parent)
          Bootstraps Grails from the given parent ApplicationContext which should contain a bean definition called "grailsApplication" of type GrailsApplication
static void deprecated(Class clazz, String methodOrPropName)
          Logs warning message about deprecation of specified property or method of some class.
static void deprecated(Class clazz, String methodOrPropName, String version)
          Logs warning message about deprecation of specified property or method of some class.
static void deprecated(String message)
          Logs warning message about some deprecation and code style related hints.
static String getEnvironment()
          Retrieves the current execution environment
static String getGrailsVersion()
           
static boolean isDevelopmentEnv()
          Retrieves whether the current execution environment is the development one
static void warn(String message)
          Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrailsUtil

public GrailsUtil()
Method Detail

bootstrapGrailsFromClassPath

public static ApplicationContext bootstrapGrailsFromClassPath()

Bootstraps a Grails application from the current classpath. The method will look for an applicationContext.xml file in the classpath that must contain a bean of type GrailsApplication and id grailsApplication

The method will then bootstrap Grails with the GrailsApplication and load all Grails plug-ins found in the path

Returns:
The Grails ApplicationContext instance

bootstrapGrailsFromApplication

public static ApplicationContext bootstrapGrailsFromApplication(GrailsApplication application)
Bootstraps Grails with the given GrailsApplication instance

Parameters:
application - The GrailsApplication instance
Returns:
A Grails ApplicationContext

bootstrapGrailsFromParentContext

public static ApplicationContext bootstrapGrailsFromParentContext(ApplicationContext parent)
Bootstraps Grails from the given parent ApplicationContext which should contain a bean definition called "grailsApplication" of type GrailsApplication


getEnvironment

public static String getEnvironment()
Retrieves the current execution environment

Returns:
The environment Grails is executing under

isDevelopmentEnv

public static boolean isDevelopmentEnv()
Retrieves whether the current execution environment is the development one

Returns:
True if it is the development environment

getGrailsVersion

public static String getGrailsVersion()

deprecated

public static void deprecated(Class clazz,
                              String methodOrPropName)
Logs warning message about deprecation of specified property or method of some class.

Parameters:
clazz - A class
methodOrPropName - Name of deprecated property or method

deprecated

public static void deprecated(Class clazz,
                              String methodOrPropName,
                              String version)
Logs warning message about deprecation of specified property or method of some class.

Parameters:
clazz - A class
methodOrPropName - Name of deprecated property or method
version - Version of Grails release in which property or method were deprecated

deprecated

public static void deprecated(String message)
Logs warning message about some deprecation and code style related hints.

Parameters:
message - Message to display

warn

public static void warn(String message)
Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode.

Parameters:
message - Message to display


Copyright (c) 2005-2006 The Grails project