Package org.kohsuke.stapler
Class CachingScriptLoader<S,E extends Exception>
- java.lang.Object
-
- org.kohsuke.stapler.CachingScriptLoader<S,E>
-
- Direct Known Subclasses:
AbstractTearOff
public abstract class CachingScriptLoader<S,E extends Exception> extends Object
Convenient base class for caching loaded scripts.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description CachingScriptLoader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clearScripts()
Discards the cached script.S
findScript(String name)
Locates the view script of the given name.protected abstract URL
getResource(String name)
protected abstract S
loadScript(String name)
Cache-less version of thefindScript(String)
that provides the actual logic.
-
-
-
Method Detail
-
findScript
public S findScript(String name) throws E extends Exception
Locates the view script of the given name.- Parameters:
name
- if this is a relative path, such as "foo.jelly" or "foo/bar.groovy", then it is assumed to be relative to this class, so "org/acme/MyClass/foo.jelly" or "org/acme/MyClass/foo/bar.groovy" will be searched.If the extension is omitted, the default extension will be appended. This is useful for some loaders that support loading multiple file extension types (such as Jelly support.)
If this starts with "/", then it is assumed to be absolute, and that name is searched from the classloader. This is useful to do mix-in.
- Returns:
- null if none was found.
- Throws:
E extends Exception
-
loadScript
protected abstract S loadScript(String name) throws E extends Exception
Cache-less version of thefindScript(String)
that provides the actual logic.
-
clearScripts
public void clearScripts()
Discards the cached script.
-
-