|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.tiles.xmlDefinition.FactorySet org.apache.struts.tiles.xmlDefinition.I18nFactorySet
public class I18nFactorySet
Definitions factory.
This implementation allows to have a set of definition factories.
There is a main factory and one factory for each file associated to a Locale.
To retrieve a definition, we first search for the appropriate factory using
the Locale found in session context. If no factory is found, use the
default one. Then we ask the factory for the definition.
A definition factory file is loaded using main filename extended with locale code
(ex : templateDefinitions_fr.xml
). If no file is found under this name, use default file.
Field Summary | |
---|---|
static String[] |
DEFAULT_DEFINITION_FILENAMES
Possible definition filenames. |
protected DefinitionsFactory |
defaultFactory
Default factory. |
static String |
DEFINITIONS_CONFIG_PARAMETER_NAME
Config file parameter name. |
static String |
FILENAME_EXTENSION
Default filenames extension. |
protected boolean |
isValidatingParser
Do we want validating parser. |
protected static Log |
log
Commons Logging instance. |
static String |
PARSER_DETAILS_PARAMETER_NAME
Config file parameter name. |
static String |
PARSER_VALIDATE_PARAMETER_NAME
Config file parameter name. |
protected int |
parserDetailLevel
Parser detail level. |
protected XmlParser |
xmlParser
XML parser used. |
Fields inherited from class org.apache.struts.tiles.xmlDefinition.FactorySet |
---|
factories |
Constructor Summary | |
---|---|
I18nFactorySet()
Parameterless Constructor. |
|
I18nFactorySet(ServletContext servletContext,
Map properties)
Constructor. |
Method Summary | |
---|---|
protected DefinitionsFactory |
createDefaultFactory(ServletContext servletContext)
Create default factory . |
protected DefinitionsFactory |
createFactory(Object key,
ServletRequest request,
ServletContext servletContext)
Create a factory for specified key. |
protected DefinitionsFactory |
getDefaultFactory()
Get default factory. |
protected Object |
getDefinitionsFactoryKey(String name,
ServletRequest request,
ServletContext servletContext)
Extract key that will be used to get the sub factory. |
void |
initFactory(ServletContext servletContext,
Map properties)
Initialization method. |
protected void |
initFactory(ServletContext servletContext,
String proposedFilename)
Initialization method. |
protected XmlDefinitionsSet |
parseXmlFile(ServletContext servletContext,
String filename,
XmlDefinitionsSet xmlDefinitions)
Parse specified xml file and add definition to specified definitions set. |
protected XmlDefinitionsSet |
parseXmlFiles(ServletContext servletContext,
String postfix,
XmlDefinitionsSet xmlDefinitions)
Parse files associated to postix if they exist. |
String |
toString()
Return String representation. |
Methods inherited from class org.apache.struts.tiles.xmlDefinition.FactorySet |
---|
getDefinition, getFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static Log log
public static final String DEFINITIONS_CONFIG_PARAMETER_NAME
public static final String PARSER_DETAILS_PARAMETER_NAME
public static final String PARSER_VALIDATE_PARAMETER_NAME
public static final String[] DEFAULT_DEFINITION_FILENAMES
public static final String FILENAME_EXTENSION
protected DefinitionsFactory defaultFactory
protected transient XmlParser xmlParser
protected boolean isValidatingParser
false
.
Can be set from servlet config file.
protected int parserDetailLevel
Constructor Detail |
---|
public I18nFactorySet()
initFactory(javax.servlet.ServletContext, java.util.Map)
must be called prior to any use of created factory.
public I18nFactorySet(ServletContext servletContext, Map properties) throws DefinitionsFactoryException
servletContext
- Servlet context.properties
- Map containing all properties.
FactoryNotFoundException
- Can't find factory configuration file.
DefinitionsFactoryException
Method Detail |
---|
public void initFactory(ServletContext servletContext, Map properties) throws DefinitionsFactoryException
initFactory
in interface ComponentDefinitionsFactory
initFactory
in class FactorySet
servletContext
- Servlet Context passed to newly created factory.properties
- Map of name/property passed to newly created factory. Map can contains
more properties than requested.
DefinitionsFactoryException
- An error occur during initialization.protected void initFactory(ServletContext servletContext, String proposedFilename) throws DefinitionsFactoryException, FileNotFoundException
servletContext
- Servlet Context passed to newly created factory.proposedFilename
- File names, comma separated, to use as base file names.
DefinitionsFactoryException
- An error occur during initialization.
FileNotFoundException
protected DefinitionsFactory getDefaultFactory()
getDefaultFactory
in class FactorySet
protected DefinitionsFactory createDefaultFactory(ServletContext servletContext) throws DefinitionsFactoryException, FileNotFoundException
servletContext
- Current servlet context. Used to open file.
DefinitionsFactoryException
- If an error occur while creating factory.
FileNotFoundException
- if factory can't be loaded from filenames.protected Object getDefinitionsFactoryKey(String name, ServletRequest request, ServletContext servletContext)
getDefinitionsFactoryKey
in class FactorySet
name
- Name of requested definitionrequest
- Current servlet request.servletContext
- Current servlet context.
null
if not found.protected DefinitionsFactory createFactory(Object key, ServletRequest request, ServletContext servletContext) throws DefinitionsFactoryException
createFactory
in class FactorySet
key
- The key.request
- Servlet request.servletContext
- Servlet context.
DefinitionsFactoryException
- If an error occur while creating factory.protected XmlDefinitionsSet parseXmlFiles(ServletContext servletContext, String postfix, XmlDefinitionsSet xmlDefinitions) throws DefinitionsFactoryException
null
.
postfix
- Postfix to add to each description file.xmlDefinitions
- Definitions set to which definitions will be added. If null
, a definitions
set is created on request.
DefinitionsFactoryException
- On errors parsing file.protected XmlDefinitionsSet parseXmlFile(ServletContext servletContext, String filename, XmlDefinitionsSet xmlDefinitions) throws DefinitionsFactoryException
null
, create a new set. Otherwise, return
passed definition set (can be null
).
servletContext
- Current servlet context. Used to open file.filename
- Name of file to parse.xmlDefinitions
- Definitions set to which definitions will be added. If null, a definitions
set is created on request.
DefinitionsFactoryException
- On errors parsing file.public String toString()
toString
in class FactorySet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |