Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sitemesh.mapper
Class DefaultDecoratorMapper  view DefaultDecoratorMapper download DefaultDecoratorMapper.java

java.lang.Object
  extended bycom.sitemesh.mapper.DefaultDecoratorMapper
All Implemented Interfaces:
com.sitemesh.DecoratorMapper, com.sitemesh.RequestConstants

public class DefaultDecoratorMapper
extends java.lang.Object
implements com.sitemesh.DecoratorMapper, com.sitemesh.RequestConstants

Default implementation of DecoratorMapper. Reads decorators and mappings from /WEB-INF/decorators.xml.

Version:
$Revision: 1.5 $

Field Summary
private  java.io.File configFile
           
private  long configLastModified
           
private  java.util.Map decorators
           
private  java.util.Map mappings
           
 
Fields inherited from interface com.sitemesh.RequestConstants
DECORATOR, FILTER_APPLIED, PAGE
 
Constructor Summary
DefaultDecoratorMapper()
           
 
Method Summary
private  java.lang.String findDefaultKey(java.lang.String path)
           
private  java.lang.String findDirectoryKey(java.lang.String path)
           
private  java.lang.String findExactKey(java.lang.String path)
           
private  java.lang.String findExtentionKey(java.lang.String path)
           
private  java.lang.String findKey(java.lang.String path)
           
private  java.lang.String getContainedText(org.w3c.dom.Node parent, java.lang.String childTagName)
           
 com.sitemesh.Decorator getDecorator(javax.servlet.http.HttpServletRequest request, com.sitemesh.Page page)
          Return appropriate Decorator for a certain Page.
 void init(Config config, java.util.Properties properties)
          Initialize the mapper.
private  void loadConfig()
           
 void refresh()
          Check if configuration file has been updated, and if so, reload.
private  void storeDecorator(com.sitemesh.Decorator d)
           
private  void storeMapping(java.lang.String name, java.lang.String pattern)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decorators

private java.util.Map decorators

mappings

private java.util.Map mappings

configLastModified

private long configLastModified

configFile

private java.io.File configFile
Constructor Detail

DefaultDecoratorMapper

public DefaultDecoratorMapper()
Method Detail

init

public void init(Config config,
                 java.util.Properties properties)
          throws java.lang.InstantiationException
Description copied from interface: com.sitemesh.DecoratorMapper
Initialize the mapper. This is always called before the other method.

Specified by:
init in interface com.sitemesh.DecoratorMapper

getDecorator

public com.sitemesh.Decorator getDecorator(javax.servlet.http.HttpServletRequest request,
                                           com.sitemesh.Page page)
Description copied from interface: com.sitemesh.DecoratorMapper
Return appropriate Decorator for a certain Page. The implementation can determine the result based on the actual request or the data of the parsed page.

Specified by:
getDecorator in interface com.sitemesh.DecoratorMapper

findKey

private java.lang.String findKey(java.lang.String path)

findExactKey

private java.lang.String findExactKey(java.lang.String path)

findDirectoryKey

private java.lang.String findDirectoryKey(java.lang.String path)

findExtentionKey

private java.lang.String findExtentionKey(java.lang.String path)

findDefaultKey

private java.lang.String findDefaultKey(java.lang.String path)

loadConfig

private void loadConfig()
                 throws javax.servlet.ServletException

getContainedText

private java.lang.String getContainedText(org.w3c.dom.Node parent,
                                          java.lang.String childTagName)

storeDecorator

private void storeDecorator(com.sitemesh.Decorator d)

storeMapping

private void storeMapping(java.lang.String name,
                          java.lang.String pattern)

refresh

public void refresh()
             throws javax.servlet.ServletException
Check if configuration file has been updated, and if so, reload.