com.sun.rave.web.ui.renderer.template.xml
Class XMLLayoutDefinitionManager

java.lang.Object
  extended by com.sun.rave.web.ui.renderer.template.LayoutDefinitionManager
      extended by com.sun.rave.web.ui.renderer.template.xml.XMLLayoutDefinitionManager

public class XMLLayoutDefinitionManager
extends LayoutDefinitionManager

This class is a concrete implmentation of the abstract class LayoutDefinitionManager. It obtains LayoutDefinition objects by interpreting the key passed to getLayoutDefinition(String) as a path to an XML file describing the LayoutDefinition. It will first attempt to resolve this path from the document root of the ServletContext or PortletCotnext. If that fails, it will attempt to use the Classloader to resolve it.

Locating the dtd for the XML file is done in a similar manner. It will first attempt to locate the dtd relative to the ServletContext (or PortletContext) root. If that fails it will attempt to use the ClassLoader to resolve it. Optionally a different EntityResolver may be supplied to provide a custom way of locating the dtd, this is done via setEntityResolver(org.xml.sax.EntityResolver).

This class is a singleton. This means modifications to this class effect all threads using this class. This includes setting EntityResolvers and ErrorHandlers. These values only need to be set once to remain in effect as long as the JVM is running.


Nested Class Summary
static class XMLLayoutDefinitionManager.ClassLoaderEntityResolver
           This entity reolver looks for xml & dtd files that are included as SYSTEM entities in the java class-path.
 
Field Summary
static java.lang.String BASE_URI
           
static boolean DEBUG
           
static java.lang.String ENTITY_RESOLVER
          This is an attribute key which can be used to provide an EntityResolver to the XML parser.
static java.lang.String ERROR_HANDLER
           
 
Fields inherited from class com.sun.rave.web.ui.renderer.template.LayoutDefinitionManager
DEFAULT_LAYOUT_DEFINITION_MANAGER_IMPL, LAYOUT_DEFINITION_MANAGER_KEY
 
Constructor Summary
protected XMLLayoutDefinitionManager()
          Constructor.
 
Method Summary
 java.lang.String getBaseURI()
          This returns the LDM's XML parser baseURI which will be used to resolve relative URI's, null if not set.
 org.xml.sax.EntityResolver getEntityResolver()
          This returns the LDM's entity resolver, null if not set.
 org.xml.sax.ErrorHandler getErrorHandler()
          This returns the LDM's XML parser ErrorHandler, null if not set.
static LayoutDefinitionManager getInstance()
          This method returns an instance of this LayoutDefinitionManager.
 LayoutDefinition getLayoutDefinition(java.lang.String key)
           This method is responsible for finding the requested LayoutDefinition for the given key.
 void setBaseURI(java.lang.String baseURI)
          This method sets the LDM's BaseURI.
 void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
          This method sets the LDM's entity resolver.
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
          This method sets the LDM's ErrorHandler.
 
Methods inherited from class com.sun.rave.web.ui.renderer.template.LayoutDefinitionManager
getAttribute, getManager, getManager, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTITY_RESOLVER

public static final java.lang.String ENTITY_RESOLVER
This is an attribute key which can be used to provide an EntityResolver to the XML parser.

See Also:
Constant Field Values

ERROR_HANDLER

public static final java.lang.String ERROR_HANDLER
See Also:
Constant Field Values

BASE_URI

public static final java.lang.String BASE_URI
See Also:
Constant Field Values

DEBUG

public static boolean DEBUG
Constructor Detail

XMLLayoutDefinitionManager

protected XMLLayoutDefinitionManager()
Constructor.

Method Detail

getInstance

public static LayoutDefinitionManager getInstance()
This method returns an instance of this LayoutDefinitionManager. The object returned is a singleton (only 1 instance will be created per JVM).

Returns:
XMLLayoutDefinitionManager instance

getLayoutDefinition

public LayoutDefinition getLayoutDefinition(java.lang.String key)

This method is responsible for finding the requested LayoutDefinition for the given key.

Specified by:
getLayoutDefinition in class LayoutDefinitionManager
Parameters:
key - Key identifying the desired LayoutDefinition
Returns:
The requested LayoutDefinition.

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
This returns the LDM's entity resolver, null if not set.

Returns:
EntityResolver

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
This method sets the LDM's entity resolver.

Parameters:
entityResolver - The EntityResolver to use.

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
This returns the LDM's XML parser ErrorHandler, null if not set.

Returns:
ErrorHandler

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
This method sets the LDM's ErrorHandler.

Parameters:
errorHandler - The ErrorHandler to use.

getBaseURI

public java.lang.String getBaseURI()
This returns the LDM's XML parser baseURI which will be used to resolve relative URI's, null if not set.

Returns:
The base URI as a String

setBaseURI

public void setBaseURI(java.lang.String baseURI)
This method sets the LDM's BaseURI.

Parameters:
baseURI - The BaseURI to use.