eXo JCR :: Component :: Extension Service 1.16.0-CR2

org.exoplatform.services.jcr.ext.script.groovy
Class JcrGroovyCompiler

java.lang.Object
  extended by org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyCompiler
All Implemented Interfaces:
org.picocontainer.Startable

public class JcrGroovyCompiler
extends Object
implements org.picocontainer.Startable

JcrGroovyCompiler can load source code of groovy script from JCR and parse it via GroovyClassLoader.

Version:
$Id$
Author:
Andrey Parfonov

Field Summary
protected  List<GroovyScriptAddRepoPlugin> addRepoPlugins
           
protected  JcrGroovyClassLoaderProvider classLoaderProvider
           
 
Constructor Summary
JcrGroovyCompiler()
           
JcrGroovyCompiler(JcrGroovyClassLoaderProvider classLoaderProvider)
           
 
Method Summary
 Class<?>[] compile(org.exoplatform.services.rest.ext.groovy.SourceFile[] files)
          Compile Groovy source that located in files.
 Class<?>[] compile(org.exoplatform.services.rest.ext.groovy.SourceFolder[] src, org.exoplatform.services.rest.ext.groovy.SourceFile[] files)
          Compile Groovy source that located in files.
 Class<?>[] compile(org.exoplatform.services.rest.ext.groovy.SourceFolder[] src, UnifiedNodeReference... sourceReferences)
          Compile Groovy source that located in sourceReferences.
 Class<?>[] compile(UnifiedNodeReference... sourceReferences)
          Compile Groovy source that located in sourceReferences.
 URL[] getDependencies(org.exoplatform.services.rest.ext.groovy.SourceFolder[] sources, org.exoplatform.services.rest.ext.groovy.SourceFile[] files)
          Get URLs of classes (stored in JCR only) required to compile sources files.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classLoaderProvider

protected final JcrGroovyClassLoaderProvider classLoaderProvider

addRepoPlugins

protected List<GroovyScriptAddRepoPlugin> addRepoPlugins
Constructor Detail

JcrGroovyCompiler

public JcrGroovyCompiler(JcrGroovyClassLoaderProvider classLoaderProvider)

JcrGroovyCompiler

public JcrGroovyCompiler()
Method Detail

compile

public Class<?>[] compile(UnifiedNodeReference... sourceReferences)
                   throws IOException
Compile Groovy source that located in sourceReferences. Compiled sources can be dependent to each other and dependent to Groovy sources that are accessible for this compiler.

Parameters:
sourceReferences - references to Groovy sources to be compiled
Returns:
result of compilation
Throws:
IOException - if any i/o errors occurs

compile

public Class<?>[] compile(org.exoplatform.services.rest.ext.groovy.SourceFolder[] src,
                          UnifiedNodeReference... sourceReferences)
                   throws IOException
Compile Groovy source that located in sourceReferences. Compiled sources can be dependent to each other and dependent to Groovy sources that are accessible for this compiler and with additional Groovy sources src. NOTE To be able load Groovy source files from specified folders the following rules must be observed:
Example: If source stream that we want compile contains the following code:
           package c.b.a
           
           import a.b.c.A
           
           class B extends A {
           // Do something.
           }
 
Assume we store dependencies in JCR then URL of folder with Groovy sources may be like this: jcr://repository/workspace#/groovy-library. Then absolute path to JCR node that contains Groovy source must be as following: /groovy-library/a/b/c/A.groovy

Parameters:
src - additional Groovy source location that should be added in class-path when compile sourceReferences
sourceReferences - references to Groovy sources to be compiled
Returns:
result of compilation
Throws:
IOException - if any i/o errors occurs

compile

public Class<?>[] compile(org.exoplatform.services.rest.ext.groovy.SourceFolder[] src,
                          org.exoplatform.services.rest.ext.groovy.SourceFile[] files)
                   throws IOException
Compile Groovy source that located in files. Compiled sources can be dependent to each other and dependent to Groovy sources that are accessible for this compiler and with additional Groovy sources src. NOTE To be able load Groovy source files from specified folders the following rules must be observed:

Parameters:
src - additional Groovy source location that should be added in class-path when compile files
files - Groovy sources to be compiled
Returns:
result of compilation
Throws:
IOException - if any i/o errors occurs

compile

public Class<?>[] compile(org.exoplatform.services.rest.ext.groovy.SourceFile[] files)
                   throws IOException
Compile Groovy source that located in files. Compiled sources can be dependent to each other and dependent to Groovy sources that are accessible for this compiler.

Parameters:
files - Groovy sources to be compiled
Returns:
result of compilation
Throws:
IOException - if any i/o errors occurs

getDependencies

public URL[] getDependencies(org.exoplatform.services.rest.ext.groovy.SourceFolder[] sources,
                             org.exoplatform.services.rest.ext.groovy.SourceFile[] files)
                      throws IOException
Get URLs of classes (stored in JCR only) required to compile sources files. Result array includes URLs of files plus URLs of other required sources if they can be found in class-path.

Parameters:
sources - additional Groovy source location that should be added in class-path when analyze files
files - set of sources for analyzing
Returns:
URLs
Throws:
IOException - if any i/o errors occurs

start

public void start()
Specified by:
start in interface org.picocontainer.Startable
See Also:
Startable.start()

stop

public void stop()
Specified by:
stop in interface org.picocontainer.Startable
See Also:
Startable.stop()

eXo JCR :: Component :: Extension Service 1.16.0-CR2

Copyright © 2014 eXo Platform SAS. All Rights Reserved.