Package com.composum.sling.core.script
Class GroovyRunner
- java.lang.Object
-
- com.composum.sling.core.script.GroovyRunner
-
public class GroovyRunner extends Object
Created by rw on 06.10.15.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.framework.BundleContextbundleContextstatic StringDEFAULT_SETUP_SCRIPTstatic StringENCODINGprotected Map<String,Object>generalBindingsstatic StringJAVA_RESOURCE_BASEprotected PrintWriteroutprotected javax.jcr.query.QueryManagerqueryManagerprotected org.apache.sling.api.resource.ResourceResolverresourceResolverprotected org.apache.sling.api.resource.ResourceResolverFactoryresourceResolverFactoryprotected javax.jcr.Sessionsessionprotected StringsetupScriptprotected javax.jcr.Workspaceworkspace
-
Constructor Summary
Constructors Constructor Description GroovyRunner(javax.jcr.Session session, PrintWriter out)GroovyRunner(javax.jcr.Session session, PrintWriter out, String setupScript)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidextendBinding(groovy.lang.Binding binding, Object variables)protected voidextendBinding(groovy.lang.Script script, Object variables)protected org.osgi.framework.BundleContextgetBundleContext()protected javax.jcr.query.QueryManagergetQueryManager(javax.jcr.Workspace workspace)protected org.apache.sling.api.resource.ResourceResolvergetResolver()protected org.apache.sling.api.resource.ResourceResolverFactorygetResourceResolverFactory()protected groovy.lang.ScriptgetScript(Reader scriptReader, Map<String,Object> variables, String name)protected ReadergetScriptResource(String path)Objectrun(Reader scriptReader, Map<String,Object> variables)Objectrun(Reader scriptReader, Map<String,Object> variables, String name)Objectrun(String path, Map<String,Object> variables)protected Objectsetup(groovy.lang.Script script)
-
-
-
Field Detail
-
DEFAULT_SETUP_SCRIPT
public static final String DEFAULT_SETUP_SCRIPT
- See Also:
- Constant Field Values
-
JAVA_RESOURCE_BASE
public static final String JAVA_RESOURCE_BASE
- See Also:
- Constant Field Values
-
ENCODING
public static final String ENCODING
- See Also:
- Constant Field Values
-
bundleContext
protected org.osgi.framework.BundleContext bundleContext
-
resourceResolverFactory
protected org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory
-
resourceResolver
protected org.apache.sling.api.resource.ResourceResolver resourceResolver
-
session
protected javax.jcr.Session session
-
workspace
protected javax.jcr.Workspace workspace
-
queryManager
protected javax.jcr.query.QueryManager queryManager
-
out
protected PrintWriter out
-
setupScript
protected String setupScript
-
-
Constructor Detail
-
GroovyRunner
public GroovyRunner(javax.jcr.Session session, PrintWriter out)
-
GroovyRunner
public GroovyRunner(javax.jcr.Session session, PrintWriter out, String setupScript)
-
-
Method Detail
-
run
public Object run(String path, Map<String,Object> variables) throws InterruptedException
- Throws:
InterruptedException
-
run
public Object run(Reader scriptReader, Map<String,Object> variables) throws InterruptedException
- Throws:
InterruptedException
-
run
public Object run(Reader scriptReader, Map<String,Object> variables, String name) throws InterruptedException
- Throws:
InterruptedException
-
getScript
protected groovy.lang.Script getScript(Reader scriptReader, Map<String,Object> variables, String name)
-
extendBinding
protected void extendBinding(groovy.lang.Script script, Object variables)
-
extendBinding
protected void extendBinding(groovy.lang.Binding binding, Object variables)
-
setup
protected Object setup(groovy.lang.Script script)
-
getBundleContext
protected org.osgi.framework.BundleContext getBundleContext()
-
getResourceResolverFactory
protected org.apache.sling.api.resource.ResourceResolverFactory getResourceResolverFactory()
-
getResolver
protected org.apache.sling.api.resource.ResourceResolver getResolver()
-
getQueryManager
protected javax.jcr.query.QueryManager getQueryManager(javax.jcr.Workspace workspace)
-
-