Class GroovyScriptInstantiator

java.lang.Object
org.exoplatform.services.script.groovy.GroovyScriptInstantiator

public class GroovyScriptInstantiator extends Object
Version:
$Id: $
Author:
Andrey Parfonov
  • Constructor Details

    • GroovyScriptInstantiator

      public GroovyScriptInstantiator(org.exoplatform.container.ExoContainerContext containerContext)
      Parameters:
      containerContext - container context
  • Method Details

    • instantiateScript

      public Object instantiateScript(String spec) throws MalformedURLException, IOException
      Load script from given address.
      Parameters:
      spec - the resource's address.
      Returns:
      the object created from groovy script.
      Throws:
      MalformedURLException - if parameter url have wrong format.
      IOException - if can't load script from given url.
      See Also:
    • instantiateScript

      public Object instantiateScript(URL url) throws IOException
      Load script from given address.
      Parameters:
      url - the resource's address.
      Returns:
      the object created from groovy script.
      Throws:
      IOException - if can't load script from given url.
      See Also:
    • instantiateScript

      public Object instantiateScript(InputStream stream) throws IOException
      Parse given stream, the stream must represents groovy script.
      Parameters:
      stream - the stream represented groovy script.
      Returns:
      the object created from groovy script.
      Throws:
      IOException - if stream can't be parsed or object can't be created cause to illegal content of stream
    • instantiateScript

      public Object instantiateScript(InputStream stream, String name) throws IOException
      Parse given stream, the stream must represents groovy script.
      Parameters:
      stream - the stream represented groovy script.
      name - script name is null or empty string that groovy completer will use default name
      Returns:
      the object created from groovy script.
      Throws:
      IOException - if stream can't be parsed or object can't be created cause to illegal content of stream
    • instantiateScript

      public Object instantiateScript(InputStream stream, String name, groovy.lang.GroovyClassLoader loader) throws IOException
      Parse given stream, the stream must represents groovy script and use given class-loader. If loader == null then GroovyClassLoader will be is use.
      Parameters:
      stream - the stream represented groovy script.
      name - script name is null or empty string that groovy completer will use default name
      loader - GroovyClassLoader or null
      Returns:
      the object created from groovy script.
      Throws:
      IOException - if stream can't be parsed or object can't be created cause to illegal content of stream
    • instantiateScript

      public Object instantiateScript(groovy.lang.GroovyCodeSource codeSource, groovy.lang.GroovyClassLoader loader)
      Instantiate script from give GroovyCodeSource and use given class-loader. If loader == null then GroovyClassLoader will be is use.
      Parameters:
      codeSource - code source
      loader -
      Returns:
    • addPlugin

      public void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)