public class TemplateContext extends AggregateLifeCycle implements WebAppClassLoader.Context, Destroyable
This class is configured by the template.xml files and is used to control the shared resource cache and classloader.
This class is an AggregateLifeCycle, so dependent beans may be added to the template and will be started, stopped and destroyed with the template. The template is started after the template.xml file have been applied. It is stopped and destroyed after the last instance using the template is undeployed.
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
TemplateContext() |
TemplateContext(String key,
Server server,
Resource baseResource,
ClassLoader libLoader) |
Modifier and Type | Method and Description |
---|---|
void |
addServerClass(String classname) |
void |
addSystemClass(String classname) |
void |
destroy()
Destroy the joined Destroyable beans in the reverse order they were added.
|
Resource |
getBaseResource() |
String |
getExtraClasspath() |
Map<String,Object> |
getIdMap() |
ClassLoader |
getLibLoader() |
MimeTypes |
getMimeTypes() |
PermissionCollection |
getPermissions() |
ResourceCache |
getResourceCache() |
Server |
getServer() |
boolean |
isParentLoaderPriority() |
boolean |
isServerClass(String clazz)
Is the class a Server Class.
|
boolean |
isSystemClass(String clazz)
Is the class a System Class.
|
Resource |
newResource(String urlOrPath)
Convert a URL or path to a Resource.
|
void |
setExtraClasspath(String extraClasspath) |
void |
setIdMap(Map<String,Object> idMap) |
void |
setParentLoaderPriority(boolean java2compliant) |
void |
setPermissions(PermissionCollection permissions) |
void |
setServerClasses(String[] serverClasses)
Set the server classes patterns.
|
void |
setSystemClasses(String[] systemClasses)
Set the system classes patterns.
|
addBean, addBean, contains, doStart, doStop, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public TemplateContext()
public TemplateContext(String key, Server server, Resource baseResource, ClassLoader libLoader) throws IOException
IOException
public ClassLoader getLibLoader()
public Resource getBaseResource()
public String getExtraClasspath()
getExtraClasspath
in interface WebAppClassLoader.Context
public MimeTypes getMimeTypes()
public PermissionCollection getPermissions()
getPermissions
in interface WebAppClassLoader.Context
public ResourceCache getResourceCache()
public Server getServer()
public boolean isParentLoaderPriority()
isParentLoaderPriority
in interface WebAppClassLoader.Context
public boolean isServerClass(String clazz)
WebAppClassLoader.Context
isServerClass
in interface WebAppClassLoader.Context
clazz
- The fully qualified name of the class.public boolean isSystemClass(String clazz)
WebAppClassLoader.Context
isSystemClass
in interface WebAppClassLoader.Context
clazz
- The fully qualified name of the class.public Resource newResource(String urlOrPath) throws IOException
WebAppClassLoader.Context
Resource.newResource(String)
.newResource
in interface WebAppClassLoader.Context
urlOrPath
- The URL or path to convertIOException
- The Resource could not be created.public void setExtraClasspath(String extraClasspath)
extraClasspath
- Comma or semicolon separated path of filenames or URLs
pointing to directories or jar files. Directories should end
with '/'.public void setParentLoaderPriority(boolean java2compliant)
java2compliant
- The java2compliant to set.public void setPermissions(PermissionCollection permissions)
permissions
- The permissions to set.public void setServerClasses(String[] serverClasses)
Server classes/packages are classes used to implement the server and are hidden from the context. If the context needs to load these classes, it must have its own copy of them in WEB-INF/lib or WEB-INF/classes. A class pattern is a string of one of the forms:
serverClasses
- The serverClasses to set.public void setSystemClasses(String[] systemClasses)
System classes/packages are classes provided by the JVM and that
cannot be replaced by classes of the same name from WEB-INF,
regardless of the value of setParentLoaderPriority(boolean)
.
A class pattern is a string of one of the forms:
systemClasses
- The systemClasses to set.public void addSystemClass(String classname)
public void addServerClass(String classname)
public void destroy()
AggregateLifeCycle
destroy
in interface Destroyable
destroy
in class AggregateLifeCycle
Destroyable.destroy()
Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.