Class Grengine.Grape
- Enclosing class:
- Grengine
Call activate() once before using the newGrengine()
methods to create a Grengine instance that works with Grape.
See the user manual at "Grengine and Grape" and the DefaultGroovyCompiler
class for more information.
- Since:
- 1.2
- Author:
- Alain Stalder, Made in Switzerland.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidactivate()activate Grape for Grengine (with the default lock).static voidactivate Grape for Grengine with the given lock.static voiddeactivate Grape for Grengine - not recommended in some scenarios.static Grengineequivalent toGrengine(), with the following differences.static GrenginenewGrengine(GroovyClassLoader parent) equivalent toGrengine(ClassLoader), with the following differences.static GrenginenewGrengine(GroovyClassLoader parent, File dir) equivalent toGrengine(ClassLoader, File), with the following differences.static GrenginenewGrengine(GroovyClassLoader parent, File dir, DirMode dirMode) equivalent toGrengine(ClassLoader, File, DirMode), with the following differences.static GrenginenewGrengine(GroovyClassLoader parent, Collection<URL> urls) equivalent toGrengine(ClassLoader, Collection), with the following differences.static GrenginenewGrengine(GroovyClassLoader parent, CompilerConfiguration config) equivalent toGrengine(ClassLoader, CompilerConfiguration).static GrenginenewGrengine(GroovyClassLoader parent, CompilerConfiguration config, File dir) equivalent toGrengine(ClassLoader, CompilerConfiguration, File).static GrenginenewGrengine(GroovyClassLoader parent, CompilerConfiguration config, File dir, DirMode dirMode) equivalent toGrengine(ClassLoader, CompilerConfiguration, File, DirMode).static GrenginenewGrengine(GroovyClassLoader parent, CompilerConfiguration config, Collection<URL> urls) equivalent toGrengine(ClassLoader, CompilerConfiguration, Collection).static GrenginenewGrengine(File dir) equivalent toGrengine(File), with the following differences.static GrenginenewGrengine(File dir, DirMode dirMode) equivalent toGrengine(File, DirMode), with the following differences.static GrenginenewGrengine(Collection<URL> urls) equivalent toGrengine(Collection), with the following differences.static GrenginenewGrengine(CompilerConfiguration config) equivalent toGrengine(CompilerConfiguration), with the following differences.static GrenginenewGrengine(CompilerConfiguration config, File dir) equivalent toGrengine(CompilerConfiguration, File), with the following differences.static GrenginenewGrengine(CompilerConfiguration config, File dir, DirMode dirMode) equivalent toGrengine(CompilerConfiguration, File, DirMode), with the following differences.static GrenginenewGrengine(CompilerConfiguration config, Collection<URL> urls) equivalent toGrengine(CompilerConfiguration, Collection), with the following differences.
-
Method Details
-
activate
public static void activate()activate Grape for Grengine (with the default lock).See user manual under "Grengine and Grape" for more info.
- Since:
- 1.2
-
activate
activate Grape for Grengine with the given lock.See user manual under "Grengine and Grape" for more info.
- Parameters:
lock- lock to use; uses default lock if null- Since:
- 1.2
-
deactivate
public static void deactivate()deactivate Grape for Grengine - not recommended in some scenarios.Normally, there is no practical reason to call this method.
Calling it is explicitly not recommended in the following scenario: The Grengine JAR is loaded more than once (separate classloaders) but they all use the same Groovy JDK (single classloader), for example, independent web applications in a container, and they are calling
deactivate()in an uncoordinated way, so that one of them doing so deactivates Grape with Grengine for all the others.See user manual under "Grengine and Grape" for more info.
- Since:
- 1.2
-
newGrengine
equivalent toGrengine(), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent. Compiler configuration is the default compiler configuration, with added Grape support.
- Returns:
- new instance
- Since:
- 1.2
-
newGrengine
equivalent toGrengine(CompilerConfiguration), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent.
- Parameters:
config- compiler configuration to use for compiling all sources, Grape support is added to it- Returns:
- new instance
- Throws:
NullPointerException- if the compiler configuration is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(ClassLoader), with the following differences.Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
parent- parent class loader for the engine- Returns:
- new instance
- Throws:
NullPointerException- if the parent class loader is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(ClassLoader, CompilerConfiguration).- Parameters:
parent- parent class loader for the engineconfig- compiler configuration to use for compiling all sources, Grape support is added to it- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(File), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent. Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
dir- script directory- Returns:
- new instance
- Throws:
NullPointerException- if the directory is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(CompilerConfiguration, File), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent.
- Parameters:
config- compiler configuration to use for compiling all sources, Grape support is added to itdir- script directory- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(ClassLoader, File), with the following differences.Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
parent- parent class loader for the enginedir- script directory- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
public static Grengine newGrengine(GroovyClassLoader parent, CompilerConfiguration config, File dir) equivalent toGrengine(ClassLoader, CompilerConfiguration, File).- Parameters:
parent- parent class loader for the engineconfig- compiler configuration to use for compiling all sources, Grape support is added to itdir- script directory- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(File, DirMode), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent. Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
dir- script directorydirMode- dir mode- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(CompilerConfiguration, File, DirMode), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent.
- Parameters:
config- compiler configuration to use for compiling all sources, Grape support is added to itdir- script directorydirMode- dir mode- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(ClassLoader, File, DirMode), with the following differences.Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
parent- parent class loader for the enginedir- script directorydirMode- dir mode- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
public static Grengine newGrengine(GroovyClassLoader parent, CompilerConfiguration config, File dir, DirMode dirMode) equivalent toGrengine(ClassLoader, CompilerConfiguration, File, DirMode).- Parameters:
parent- parent class loader for the engineconfig- compiler configuration to use for compiling all sources, Grape support is added to itdir- script directorydirMode- dir mode- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(Collection), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent. Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
urls- collection of URL-based scripts- Returns:
- new instance
- Throws:
NullPointerException- if the URL collection is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(CompilerConfiguration, Collection), with the following differences.Parent class loader is a GroovyClassLoader with the context class loader of the current thread as its parent.
- Parameters:
config- compiler configuration to use for compiling all sources, Grape support is added to iturls- collection of URL-based scripts- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
equivalent toGrengine(ClassLoader, Collection), with the following differences.Compiler configuration is the default compiler configuration, with added Grape support.
- Parameters:
parent- parent class loader for the engineurls- collection of URL-based scripts- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-
newGrengine
public static Grengine newGrengine(GroovyClassLoader parent, CompilerConfiguration config, Collection<URL> urls) equivalent toGrengine(ClassLoader, CompilerConfiguration, Collection).- Parameters:
parent- parent class loader for the engineconfig- compiler configuration to use for compiling all sources, Grape support is added to iturls- collection of URL-based scripts- Returns:
- new instance
- Throws:
NullPointerException- if any argument is null- Since:
- 1.2
-