| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private static final ClassLoader | |
| private CompilerConfiguration | |
| private static final URL[] | |
| private GroovyClassLoader | |
| private static WeakReference | |
| private final ClassLoader | |
| private final ResourceConnector | |
| private final URL[] | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| private | GroovyScriptEngine(URL[]
This an array of URLs where Groovy scripts will be stored. They should
be laid out using their package structure like Java classes roots, ClassLoader parent, ResourceConnector rc)The groovy script engine will run groovy scripts and reload them and their dependencies when they are modified. |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static URL[] | |
| public Script | Returns: the script objectname of the script to run scriptName, Binding the binding to pass to the script binding)Creates a Script with a given scriptName and binding. |
| private static void | forceClose(URLConnection
the urlConnection)URLConnection to be "closed" to close the underlying file descriptors.This method closes a |
| public CompilerConfiguration | |
| protected long | |
| public GroovyClassLoader | Returns: the GroovyClassLoaderReturns the GroovyClassLoader associated with this script engine instance. |
| private long | |
| private static synchronized ThreadLocal | |
| public ClassLoader | Returns: the parent classloader used to load scriptsGet the |
| public URLConnection | Returns: a URLConnection to the resourcename of the resource to be retrieved resourceName)Implements groovy. URLConnection to retrieve a script
from the ResourceConnector.
|
| private GroovyClassLoader | Returns: the parent classloader used to load scriptsInitialize a new GroovyClassLoader with a default or constructor-supplied parentClassLoader. |
| protected boolean | |
| public Class | Returns: the loaded scriptName as a compiled classresource name pointing to the script scriptName)Get the class of the scriptName in question, so that you can instantiate Groovy objects with caching and reloading. |
| public static void | |
| private static URLConnection | |
| public String | |
| public Object | |
| public void | |
| private static void |
| CL_STUB | back to summary |
|---|---|
| private static final ClassLoader CL_STUB | |
| config | back to summary |
|---|---|
| private CompilerConfiguration config | |
| EMPTY_URL_ARRAY | back to summary |
|---|---|
| private static final URL[] EMPTY_URL_ARRAY | |
| groovyLoader | back to summary |
|---|---|
| private GroovyClassLoader groovyLoader | |
| localData | back to summary |
|---|---|
| private static WeakReference<ThreadLocal<GroovyScriptEngine. | |
| parentLoader | back to summary |
|---|---|
| private final ClassLoader parentLoader | |
| rc | back to summary |
|---|---|
| private final ResourceConnector rc | |
| roots | back to summary |
|---|---|
| private final URL[] roots | |
| scriptCache | back to summary |
|---|---|
| private final Map<String, GroovyScriptEngine. | |
| GroovyScriptEngine | back to summary |
|---|---|
| private GroovyScriptEngine(URL[] roots, ClassLoader parent, ResourceConnector rc) The groovy script engine will run groovy scripts and reload them and their dependencies when they are modified. This is useful for embedding groovy in other containers like games and application servers.
| |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(URL[] roots) | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(URL[] roots, ClassLoader parentClassLoader) | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(String[] urls) throws IOException | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(String[] urls, ClassLoader parentClassLoader) throws IOException | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(String url) throws IOException | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(String url, ClassLoader parentClassLoader) throws IOException | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(ResourceConnector rc) | |
| GroovyScriptEngine | back to summary |
|---|---|
| public GroovyScriptEngine(ResourceConnector rc, ClassLoader parentClassLoader) | |
| createRoots | back to summary |
|---|---|
| private static URL[] createRoots(String[] urls) throws MalformedURLException | |
| createScript | back to summary |
|---|---|
| public Script createScript(String scriptName, Binding binding) throws ResourceException, ScriptException Creates a Script with a given scriptName and binding.
| |
| forceClose | back to summary |
|---|---|
| private static void forceClose(URLConnection urlConnection) This method closes a
| |
| getConfig | back to summary |
|---|---|
public CompilerConfiguration getConfig()
| |
| getCurrentTime | back to summary |
|---|---|
| protected long getCurrentTime() | |
| getGroovyClassLoader | back to summary |
|---|---|
| public GroovyClassLoader getGroovyClassLoader() Returns the GroovyClassLoader associated with this script engine instance. Useful if you need to pass the class loader to another library.
| |
| getLastModified | back to summary |
|---|---|
| private long getLastModified(String scriptName) throws ResourceException | |
| getLocalData | back to summary |
|---|---|
| private static synchronized ThreadLocal | |
| getParentClassLoader | back to summary |
|---|---|
| public ClassLoader getParentClassLoader() Get the
| |
| getResourceConnection | back to summary |
|---|---|
| public URLConnection getResourceConnection(String resourceName) throws ResourceException Implements groovy. Get a resource connection as a
| |
| initGroovyLoader | back to summary |
|---|---|
| private GroovyClassLoader initGroovyLoader() Initialize a new GroovyClassLoader with a default or constructor-supplied parentClassLoader.
| |
| isSourceNewer | back to summary |
|---|---|
| protected boolean isSourceNewer(GroovyScriptEngine. | |
| loadScriptByName | back to summary |
|---|---|
| public Class Get the class of the scriptName in question, so that you can instantiate Groovy objects with caching and reloading.
| |
| main | back to summary |
|---|---|
| public static void main(String[] urls) throws Exception Simple testing harness for the GSE. Enter script roots as arguments and then input script names to run them. | |
| openConnection | back to summary |
|---|---|
| private static URLConnection openConnection(URL scriptURL) throws IOException | |
| run | back to summary |
|---|---|
| public String run(String scriptName, String argument) throws ResourceException, ScriptException Run a script identified by name with a single argument.
| |
| run | back to summary |
|---|---|
| public Object run(String scriptName, Binding binding) throws ResourceException, ScriptException Run a script identified by name with a given binding.
| |
| setConfig | back to summary |
|---|---|
| public void setConfig(CompilerConfiguration config) sets a compiler configuration
| |
| verifyInputStream | back to summary |
|---|---|
| private static void verifyInputStream(URLConnection urlConnection) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv CompilationUnit | |
| pack-priv final StringSetMap | |
| pack-priv final Map |
| Access | Constructor and Description |
|---|---|
| private |
| cu | back to summary |
|---|---|
| pack-priv CompilationUnit cu | |
| dependencyCache | back to summary |
|---|---|
| pack-priv final StringSetMap dependencyCache | |
| precompiledEntries | back to summary |
|---|---|
| pack-priv final Map<String, String> precompiledEntries | |
| LocalData | back to summary |
|---|---|
| private LocalData() | |
| Modifier and Type | Field and Description |
|---|---|
| private final Set | |
| private final long | |
| private final long | |
| private final Class | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | ScriptCacheEntry(Class<T> clazz, long modified, long lastCheck, Set<String> depend, boolean sourceNewer)
|
| public |
| dependencies | back to summary |
|---|---|
| private final Set<String> dependencies | |
| lastCheck | back to summary |
|---|---|
| private final long lastCheck | |
| lastModified | back to summary |
|---|---|
| private final long lastModified | |
| scriptClass | back to summary |
|---|---|
| private final Class<T> scriptClass | |
| sourceNewer | back to summary |
|---|---|
| private final boolean sourceNewer | |
| ScriptCacheEntry | back to summary |
|---|---|
| public ScriptCacheEntry(Class<T> clazz, long modified, long lastCheck, Set<String> depend, boolean sourceNewer) | |
| ScriptCacheEntry | back to summary |
|---|---|
| public ScriptCacheEntry(GroovyScriptEngine. | |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private Set | |
| protected CompilationUnit | createCompilationUnit(CompilerConfiguration
the compiler configuration, usually the same as for this class loader configuration, CodeSource the source containing the initial file to compile, more files may follow during compilation source)Overrides groovy. |
| private Class | |
| private String | |
| public Class | parseClass(GroovyCodeSource codeSource, boolean
if true then the generated class will be stored in the source cache shouldCacheSource)Overrides groovy. |
| private void | |
| private void | |
| private void |
| ScriptClassLoader | back to summary |
|---|---|
| public ScriptClassLoader(GroovyClassLoader loader) | |
| ScriptClassLoader | back to summary |
|---|---|
| public ScriptClassLoader(ClassLoader loader, CompilerConfiguration config) | |
| convertToPaths | back to summary |
|---|---|
| private Set | |
| createCompilationUnit | back to summary |
|---|---|
| protected CompilationUnit createCompilationUnit(CompilerConfiguration configuration, CodeSource source) Overrides groovy. Doc from groovy. creates a new CompilationUnit. If you want to add additional phase operations to the CompilationUnit (for example to inject additional methods, variables, fields), then you should overwrite this method.
| |
| doParseClass | back to summary |
|---|---|
| private Class | |
| getPath | back to summary |
|---|---|
| private String getPath(Class<T> clazz, Map<String, String> precompiledEntries) | |
| parseClass | back to summary |
|---|---|
| public Class Overrides groovy. Doc from groovy. Parses the given code source into a Java class. If there is a class file for the given code source, then no parsing is done, instead the cached class is returned. | |
| setResLoader | back to summary |
|---|---|
| private void setResLoader() | |
| updateLocalDependencyCache | back to summary |
|---|---|
| private void updateLocalDependencyCache(GroovyCodeSource codeSource, GroovyScriptEngine. | |
| updateScriptCache | back to summary |
|---|---|
| private void updateScriptCache(GroovyScriptEngine. | |