Package ch.grengine

Class Grengine.Grape

java.lang.Object
ch.grengine.Grengine.Grape
Enclosing class:
Grengine

public static class Grengine.Grape extends Object
Convenience class for easily getting a Grengine that works with Grape.

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 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

      public static void activate(Object lock)
      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

      public static Grengine newGrengine()
      equivalent to Grengine(), 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

      public static Grengine newGrengine(CompilerConfiguration config)
      equivalent to Grengine(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

      public static Grengine newGrengine(GroovyClassLoader parent)
      equivalent to Grengine(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

      public static Grengine newGrengine(GroovyClassLoader parent, CompilerConfiguration config)
      Parameters:
      parent - parent class loader for the engine
      config - 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

      public static Grengine newGrengine(File dir)
      equivalent to Grengine(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

      public static Grengine newGrengine(CompilerConfiguration config, File dir)
      equivalent to Grengine(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 it
      dir - script directory
      Returns:
      new instance
      Throws:
      NullPointerException - if any argument is null
      Since:
      1.2
    • newGrengine

      public static Grengine newGrengine(GroovyClassLoader parent, File dir)
      equivalent to Grengine(ClassLoader, File), with the following differences.

      Compiler configuration is the default compiler configuration, with added Grape support.

      Parameters:
      parent - parent class loader for the engine
      dir - 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)
      Parameters:
      parent - parent class loader for the engine
      config - compiler configuration to use for compiling all sources, Grape support is added to it
      dir - script directory
      Returns:
      new instance
      Throws:
      NullPointerException - if any argument is null
      Since:
      1.2
    • newGrengine

      public static Grengine newGrengine(File dir, DirMode dirMode)
      equivalent to Grengine(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 directory
      dirMode - dir mode
      Returns:
      new instance
      Throws:
      NullPointerException - if any argument is null
      Since:
      1.2
    • newGrengine

      public static Grengine newGrengine(CompilerConfiguration config, File dir, DirMode dirMode)
      equivalent to Grengine(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 it
      dir - script directory
      dirMode - dir mode
      Returns:
      new instance
      Throws:
      NullPointerException - if any argument is null
      Since:
      1.2
    • newGrengine

      public static Grengine newGrengine(GroovyClassLoader parent, File dir, DirMode dirMode)
      equivalent to Grengine(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 engine
      dir - script directory
      dirMode - 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)
      Parameters:
      parent - parent class loader for the engine
      config - compiler configuration to use for compiling all sources, Grape support is added to it
      dir - script directory
      dirMode - dir mode
      Returns:
      new instance
      Throws:
      NullPointerException - if any argument is null
      Since:
      1.2
    • newGrengine

      public static Grengine newGrengine(Collection<URL> urls)
      equivalent to Grengine(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

      public static Grengine newGrengine(CompilerConfiguration config, Collection<URL> urls)
      equivalent to Grengine(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 it
      urls - 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, Collection<URL> urls)
      equivalent to Grengine(ClassLoader, Collection), with the following differences.

      Compiler configuration is the default compiler configuration, with added Grape support.

      Parameters:
      parent - parent class loader for the engine
      urls - 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)
      Parameters:
      parent - parent class loader for the engine
      config - compiler configuration to use for compiling all sources, Grape support is added to it
      urls - collection of URL-based scripts
      Returns:
      new instance
      Throws:
      NullPointerException - if any argument is null
      Since:
      1.2