|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.roscopeco.janno.actions.script.CachingScriptActionLoader
public abstract class CachingScriptActionLoader
Abstract ActionClassLoader
implementation that compiles action classes from an implementation-specific
scripting language, and maintains an internal Class cache keyed on the script
URL and validated by the last-modified attribute.
loadScriptClass(URLConnection)
method. The resulting class will be
a fully-compatible ActionClassLoader
implementation that can be
used simply by registering it in the context container.
Constructor Summary | |
---|---|
protected |
CachingScriptActionLoader(ClassLoader parentLoader)
Create a new CachingScriptActionLoader that will use the
specified ClassLoader as it's parent. |
Method Summary | |
---|---|
Class |
getActionClass(URL script)
Attempts to load an action class from the specified script URL. This implementation caches the action classes internally, using the last-modified attribute of the script URL to determine whether it should be recompiled. |
protected abstract Class |
loadScriptClass(URLConnection conn)
Loads and compiles a script from the specified URLConnection . |
protected ClassLoader |
parentLoader()
Returns the parent classloader assigned to this action loader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected CachingScriptActionLoader(ClassLoader parentLoader)
CachingScriptActionLoader
that will use the
specified ClassLoader
as it's parent.
parentLoader
- Parent classloader to use. This must not
be null.Method Detail |
---|
public Class getActionClass(URL script) throws IOException, ScriptException
loadScriptClass(URLConnection)
method.
getActionClass
in interface ActionClassLoader
script
- A URL pointing to the script
IOException
- if an error occurs while retrieving or processing
data from the URL.
ScriptException
- if an error occurs during compilation.protected ClassLoader parentLoader()
protected abstract Class loadScriptClass(URLConnection conn) throws IOException, ScriptException
URLConnection
. This method is implemented by language
specific caching loader implementations, and called only when the
URL is not cached or has changed. It should simply compile the class
as necessary and return it.
conn
- The URLConnection
to load the script from.
Class
compiled from the script.
IOException
- if an error occurs while reading from the connection.
ScriptException
- if there is a problem with the script itself.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |