org.eclipse.jetty.overlays
Class TemplateContext

java.lang.Object
  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.util.component.AggregateLifeCycle
          extended by org.eclipse.jetty.overlays.TemplateContext
All Implemented Interfaces:
Destroyable, Dumpable, LifeCycle, WebAppClassLoader.Context

public class TemplateContext
extends AggregateLifeCycle
implements WebAppClassLoader.Context, Destroyable

A Cloudtide template context.

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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
 
Field Summary
 
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
Constructor Summary
TemplateContext()
           
TemplateContext(String key, Server server, Resource baseResource, ClassLoader libLoader)
           
 
Method Summary
 void addServerClass(String classname)
           
 void addSystemClass(String classname)
           
 void destroy()
           
 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.
 
Methods inherited from class org.eclipse.jetty.util.component.AggregateLifeCycle
addBean, doStart, doStop, dump, dump, dump, dump, dump, dumpStdErr, dumpThis, getBean, getBeans, getBeans, removeBean, removeBeans
 
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateContext

public TemplateContext()

TemplateContext

public TemplateContext(String key,
                       Server server,
                       Resource baseResource,
                       ClassLoader libLoader)
                throws IOException
Throws:
IOException
Method Detail

getLibLoader

public ClassLoader getLibLoader()

getBaseResource

public Resource getBaseResource()

getExtraClasspath

public String getExtraClasspath()
Specified by:
getExtraClasspath in interface WebAppClassLoader.Context
Returns:
Comma or semicolon separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.

getMimeTypes

public MimeTypes getMimeTypes()

getPermissions

public PermissionCollection getPermissions()
Specified by:
getPermissions in interface WebAppClassLoader.Context
Returns:
Returns the permissions.

getResourceCache

public ResourceCache getResourceCache()

getServer

public Server getServer()

isParentLoaderPriority

public boolean isParentLoaderPriority()
Specified by:
isParentLoaderPriority in interface WebAppClassLoader.Context
Returns:
True if the classloader should delegate first to the parent classloader (standard java behaviour) or false if the classloader should first try to load from WEB-INF/lib or WEB-INF/classes (servlet spec recommendation).

isServerClass

public boolean isServerClass(String clazz)
Description copied from interface: WebAppClassLoader.Context
Is the class a Server Class. A Server class is a class that is part of the implementation of the server and is NIT visible to a webapplication. The web application may provide it's own implementation of the class, to be loaded from WEB-INF/lib or WEB-INF/classes

Specified by:
isServerClass in interface WebAppClassLoader.Context
Parameters:
clazz - The fully qualified name of the class.
Returns:
True if the class is a server class.

isSystemClass

public boolean isSystemClass(String clazz)
Description copied from interface: WebAppClassLoader.Context
Is the class a System Class. A System class is a class that is visible to a webapplication, but that cannot be overridden by the contents of WEB-INF/lib or WEB-INF/classes

Specified by:
isSystemClass in interface WebAppClassLoader.Context
Parameters:
clazz - The fully qualified name of the class.
Returns:
True if the class is a system class.

newResource

public Resource newResource(String urlOrPath)
                     throws IOException
Description copied from interface: WebAppClassLoader.Context
Convert a URL or path to a Resource. The default implementation is a wrapper for Resource.newResource(String).

Specified by:
newResource in interface WebAppClassLoader.Context
Parameters:
urlOrPath - The URL or path to convert
Returns:
The Resource for the URL/path
Throws:
IOException - The Resource could not be created.

setExtraClasspath

public void setExtraClasspath(String extraClasspath)
Parameters:
extraClasspath - Comma or semicolon separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.

setParentLoaderPriority

public void setParentLoaderPriority(boolean java2compliant)
Parameters:
java2compliant - The java2compliant to set.

setPermissions

public void setPermissions(PermissionCollection permissions)
Parameters:
permissions - The permissions to set.

setServerClasses

public void setServerClasses(String[] serverClasses)
Set the server classes patterns.

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:

org.package.Classname
Match a specific class
org.package.
Match a specific package hierarchy
-org.package.Classname
Exclude a specific class
-org.package.
Exclude a specific package hierarchy

Parameters:
serverClasses - The serverClasses to set.

setSystemClasses

public void setSystemClasses(String[] systemClasses)
Set the system classes patterns.

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:

org.package.Classname
Match a specific class
org.package.
Match a specific package hierarchy
-org.package.Classname
Exclude a specific class
-org.package.
Exclude a specific package hierarchy

Parameters:
systemClasses - The systemClasses to set.

addSystemClass

public void addSystemClass(String classname)

addServerClass

public void addServerClass(String classname)

destroy

public void destroy()
Specified by:
destroy in interface Destroyable
Overrides:
destroy in class AggregateLifeCycle

setIdMap

public void setIdMap(Map<String,Object> idMap)

getIdMap

public Map<String,Object> getIdMap()


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.