Package com.opensymphony.module.sitemesh
Class Factory
- java.lang.Object
-
- com.opensymphony.module.sitemesh.Factory
-
- All Implemented Interfaces:
PageParserSelector
- Direct Known Subclasses:
BaseFactory
public abstract class Factory extends Object implements PageParserSelector
Factory responsible for creating appropriate instances of implementations. This is specific to a web context and is obtained throughgetInstance(com.opensymphony.module.sitemesh.Config)
.The actual Factory method used is determined by the enviroment entry
sitemesh.factory
. If this doesn't exist, it defaults toDefaultFactory
.- Version:
- $Revision: 1.8 $
- Author:
- Joe Walnes
-
-
Field Summary
Fields Modifier and Type Field Description private static String
SITEMESH_FACTORY
Web context lookup key
-
Constructor Summary
Constructors Constructor Description Factory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DecoratorMapper
getDecoratorMapper()
Return instance of DecoratorMapper.private static String
getEnvEntry(String envEntry, String defaultValue)
Find String environment entry, or return default if not found.static Factory
getInstance(Config config)
Entry-point for obtaining singleton instance of Factory.abstract PageParser
getPageParser(String contentType)
Create a PageParser suitable for the given content-type.abstract boolean
isPathExcluded(String path)
Determine whether the given path should be excluded from decoration or not.abstract void
refresh()
abstract boolean
shouldParsePage(String contentType)
Determine whether a Page of given content-type should be parsed or not.
-
-
-
Field Detail
-
SITEMESH_FACTORY
private static final String SITEMESH_FACTORY
Web context lookup key- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static Factory getInstance(Config config)
Entry-point for obtaining singleton instance of Factory. The default factory class that will be instantiated can be overridden with the environment entrysitemesh.factory
.
-
refresh
public abstract void refresh()
-
getDecoratorMapper
public abstract DecoratorMapper getDecoratorMapper()
Return instance of DecoratorMapper.
-
getPageParser
public abstract PageParser getPageParser(String contentType)
Create a PageParser suitable for the given content-type.For example, if the supplied parameter is
Never returns null.text/html
a parser shall be returned that can parse HTML accordingly.- Specified by:
getPageParser
in interfacePageParserSelector
- Parameters:
contentType
- The MIME content-type of the data to be parsed- Returns:
- Appropriate
PageParser
for reading data
-
shouldParsePage
public abstract boolean shouldParsePage(String contentType)
Determine whether a Page of given content-type should be parsed or not.- Specified by:
shouldParsePage
in interfacePageParserSelector
-
isPathExcluded
public abstract boolean isPathExcluded(String path)
Determine whether the given path should be excluded from decoration or not.
-
-