com.arsdigita.templating
Class Templating

java.lang.Object
  extended bycom.arsdigita.templating.Templating

public class Templating
extends Object

An entry-point class for the functions of the templating package. This class maintains a cache of XSLTemplate objects, managed via the getTemplate and purgeTemplate methods.

Author:
Dan Berrange, Justin Ross <jross@redhat.com>

Field Summary
static Class DEFAULT_PRESENTATION_MANAGER
           
static String FANCY_ERROR_COLLECTION
          This is the name of the attribute that is set in the request whose value, if present, is a collection of TransformerExceptions that can be used to produce a "pretty" error.
static String versionId
           
 
Constructor Summary
Templating()
           
 
Method Summary
static TemplatingConfig getConfig()
          Gets the TemplatingConfig record.
static PresentationManager getPresentationManager()
          Deprecated. Use BebopConfig.getPresentationManager() instead.
static XSLTemplate getTemplate(javax.servlet.http.HttpServletRequest sreq)
          Resolves and retrieves the template for the given request.
static XSLTemplate getTemplate(javax.servlet.http.HttpServletRequest sreq, boolean fancyErrors, boolean useCache)
          Resolves and retrieves the template for the given request.
static XSLTemplate getTemplate(URL source)
          Retrieves an XSL template.
static XSLTemplate getTemplate(URL source, boolean fancyErrors, boolean useCache)
          Retrieves an XSL template.
static InputStream multiplexXSLFiles(Iterator paths)
          Generates a stream containing imports for a number of URLs.
static void purgeTemplate(URL source)
          Removes an XSL template from the internal cache.
static void purgeTemplates()
          Removes all cached template objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

DEFAULT_PRESENTATION_MANAGER

public static final Class DEFAULT_PRESENTATION_MANAGER

FANCY_ERROR_COLLECTION

public static final String FANCY_ERROR_COLLECTION
This is the name of the attribute that is set in the request whose value, if present, is a collection of TransformerExceptions that can be used to produce a "pretty" error.

See Also:
Constant Field Values
Constructor Detail

Templating

public Templating()
Method Detail

getConfig

public static TemplatingConfig getConfig()
Gets the TemplatingConfig record.

Returns:
The TemplatingConfig of this runtime

getPresentationManager

public static PresentationManager getPresentationManager()
Deprecated. Use BebopConfig.getPresentationManager() instead.

Returns a new instance of the current presentation manager class. This is an object which has the PresentationManager interface which can be used to transform an XML document into an output stream.

Returns:
an instance of the PresentationManager interface

getTemplate

public static XSLTemplate getTemplate(URL source)
Retrieves an XSL template. If the template is already loaded in the cache, it will be returned. If the template has been modified since it was first generated, it will be regenerated first.

Parameters:
source - the URL to the top-level template resource
Returns:
an XSLTemplate instance representing source

getTemplate

public static XSLTemplate getTemplate(URL source,
                                      boolean fancyErrors,
                                      boolean useCache)
Retrieves an XSL template. If the template is already loaded in the cache, it will be returned. If the template has been modified since it was first generated, it will be regenerated first.

Parameters:
source - the URL to the top-level template resource
fancyErrors - Should this place any xsl errors in the request for use by another class. If this is true, the the errors are stored for later use.
useCache - Should the templates be pulled from cache, if available? True means they are pulled from cache. False means they are pulled from the disk. If this is false the pages are also not placed in the cache.
Returns:
an XSLTemplate instance representing source

getTemplate

public static XSLTemplate getTemplate(javax.servlet.http.HttpServletRequest sreq)
Resolves and retrieves the template for the given request.

Parameters:
sreq - The current request object
Returns:
The resolved XSLTemplate instance

getTemplate

public static XSLTemplate getTemplate(javax.servlet.http.HttpServletRequest sreq,
                                      boolean fancyErrors,
                                      boolean useCache)
Resolves and retrieves the template for the given request.

Parameters:
sreq - The current request object
fancyErrors - Should this place any xsl errors in the request for use by another class. If this is true, the the errors are stored for later use.
useCache - Should the templates be pulled from cache, if available? True means they are pulled from cache. False means they are pulled from the disk. If this is false the pages are also not placed in the cache.
Returns:
The resolved XSLTemplate instance

purgeTemplate

public static void purgeTemplate(URL source)
Removes an XSL template from the internal cache. The template for source will be regenerated on the next request for it.

Parameters:
source - the URL to the top-level template resource

purgeTemplates

public static void purgeTemplates()
Removes all cached template objects. All template objects will be regenerated on-demand as each gets requested.


multiplexXSLFiles

public static InputStream multiplexXSLFiles(Iterator paths)
Generates a stream containing imports for a number of URLs.

Parameters:
paths - An iterator of java.net.URL objects
Returns:
a virtual XSL file


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC