com.macvu.tiles.xmlDefinition
Class CacheI18nFactorySet

java.lang.Object
  extended by com.macvu.tiles.xmlDefinition.CacheFactorySet
      extended by com.macvu.tiles.xmlDefinition.CacheI18nFactorySet
All Implemented Interfaces:
java.io.Serializable, org.apache.struts.tiles.ComponentDefinitionsFactory

public class CacheI18nFactorySet
extends CacheFactorySet

See Also:
Serialized Form

Field Summary
static java.lang.String[] DEFAULT_DEFINITION_FILENAMES
          Possible definition filenames.
protected  CacheDefinitionFactory defaultFactory
          Default factory.
static java.lang.String DEFINITIONS_CONFIG_PARAMETER_NAME
          Config file parameter name.
static java.lang.String FILENAME_EXTENSION
          Default filenames extension.
static java.lang.String INSTANCES_CONFIG_PARAMETER_NAME
          Config file parameter name.
protected  boolean isValidatingParser
          Do we want validating parser.
protected static org.apache.commons.logging.Log log
          Commons Logging instance.
static java.lang.String PARSER_DETAILS_PARAMETER_NAME
          Config file parameter name.
static java.lang.String PARSER_VALIDATE_PARAMETER_NAME
          Config file parameter name.
protected  int parserDetailLevel
          Parser detail level.
protected  XmlCacheParser xmlParser
          Xml parser used.
 
Fields inherited from class com.macvu.tiles.xmlDefinition.CacheFactorySet
factories
 
Constructor Summary
CacheI18nFactorySet()
          Parameterless Constructor.
CacheI18nFactorySet(javax.servlet.ServletContext servletContext, java.util.Map properties)
          Constructor.
 
Method Summary
protected  CacheDefinitionFactory createDefaultFactory(javax.servlet.ServletContext servletContext)
          Create default factory .
protected  CacheDefinitionFactory createFactory(java.lang.Object key, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Create a factory for specified key.
protected  CacheDefinitionFactory getDefaultFactory()
          Get default factory.
protected  java.lang.Object getDefinitionsFactoryKey(java.lang.String name, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Extract key that will be used to get the sub factory.
 void initFactory(javax.servlet.ServletContext servletContext, java.util.Map properties)
          Initialization method.
protected  void initFactory(javax.servlet.ServletContext servletContext, java.lang.String proposedFilename)
          Initialization method.
 java.lang.String toString()
          Return String representation.
 
Methods inherited from class com.macvu.tiles.xmlDefinition.CacheFactorySet
getDefinition, getFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Commons Logging instance.


INSTANCES_CONFIG_PARAMETER_NAME

public static final java.lang.String INSTANCES_CONFIG_PARAMETER_NAME
Config file parameter name.

See Also:
Constant Field Values

DEFINITIONS_CONFIG_PARAMETER_NAME

public static final java.lang.String DEFINITIONS_CONFIG_PARAMETER_NAME
Config file parameter name.

See Also:
Constant Field Values

PARSER_DETAILS_PARAMETER_NAME

public static final java.lang.String PARSER_DETAILS_PARAMETER_NAME
Config file parameter name.

See Also:
Constant Field Values

PARSER_VALIDATE_PARAMETER_NAME

public static final java.lang.String PARSER_VALIDATE_PARAMETER_NAME
Config file parameter name.

See Also:
Constant Field Values

DEFAULT_DEFINITION_FILENAMES

public static final java.lang.String[] DEFAULT_DEFINITION_FILENAMES
Possible definition filenames.


defaultFactory

protected CacheDefinitionFactory defaultFactory
Default factory.


xmlParser

protected transient XmlCacheParser xmlParser
Xml parser used. Attribute is transient to allow serialization. In this implementaiton, XmlCacheParser is created each time we need it ;-(.


isValidatingParser

protected boolean isValidatingParser
Do we want validating parser. Default is false. Can be set from servlet config file.


parserDetailLevel

protected int parserDetailLevel
Parser detail level. Default is 0. Can be set from servlet config file.


FILENAME_EXTENSION

public static final java.lang.String FILENAME_EXTENSION
Default filenames extension.

See Also:
Constant Field Values
Constructor Detail

CacheI18nFactorySet

public CacheI18nFactorySet()
Parameterless Constructor. Method initFactory(javax.servlet.ServletContext, java.util.Map) must be called prior to any use of created factory.


CacheI18nFactorySet

public CacheI18nFactorySet(javax.servlet.ServletContext servletContext,
                           java.util.Map properties)
                    throws org.apache.struts.tiles.DefinitionsFactoryException
Constructor. Init the factory by reading appropriate configuration file.

Parameters:
servletContext - Servlet context.
properties - Map containing all properties.
Throws:
org.apache.struts.tiles.FactoryNotFoundException - Can't find factory configuration file.
org.apache.struts.tiles.DefinitionsFactoryException
Method Detail

initFactory

public void initFactory(javax.servlet.ServletContext servletContext,
                        java.util.Map properties)
                 throws org.apache.struts.tiles.DefinitionsFactoryException
Initialization method. Init the factory by reading appropriate configuration file. This method is called exactly once immediately after factory creation in case of internal creation (by DefinitionUtil).

Specified by:
initFactory in interface org.apache.struts.tiles.ComponentDefinitionsFactory
Specified by:
initFactory in class CacheFactorySet
Parameters:
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.
Throws:
org.apache.struts.tiles.DefinitionsFactoryException - An error occur during initialization.

initFactory

protected void initFactory(javax.servlet.ServletContext servletContext,
                           java.lang.String proposedFilename)
                    throws org.apache.struts.tiles.DefinitionsFactoryException,
                           java.io.FileNotFoundException
Initialization method. Init the factory by reading appropriate configuration file. This method is called exactly once immediately after factory creation in case of internal creation (by DefinitionUtil).

Parameters:
servletContext - Servlet Context passed to newly created factory.
proposedFilename - File names, comma separated, to use as base file names.
Throws:
org.apache.struts.tiles.DefinitionsFactoryException - An error occur during initialization.
java.io.FileNotFoundException

getDefaultFactory

protected CacheDefinitionFactory getDefaultFactory()
Get default factory.

Specified by:
getDefaultFactory in class CacheFactorySet
Returns:
Default factory

createDefaultFactory

protected CacheDefinitionFactory createDefaultFactory(javax.servlet.ServletContext servletContext)
                                               throws org.apache.struts.tiles.DefinitionsFactoryException,
                                                      java.io.FileNotFoundException
Create default factory . Create InstancesMapper for specified Locale. If creation failes, use default mapper and log error message.

Parameters:
servletContext - Current servlet context. Used to open file.
Returns:
Created default definition factory.
Throws:
org.apache.struts.tiles.DefinitionsFactoryException - If an error occur while creating factory.
java.io.FileNotFoundException - if factory can't be loaded from filenames.

getDefinitionsFactoryKey

protected java.lang.Object getDefinitionsFactoryKey(java.lang.String name,
                                                    javax.servlet.ServletRequest request,
                                                    javax.servlet.ServletContext servletContext)
Extract key that will be used to get the sub factory.

Specified by:
getDefinitionsFactoryKey in class CacheFactorySet
Parameters:
name - Name of requested definition
request - Current servlet request.
servletContext - Current servlet context.
Returns:
the key or null if not found.

createFactory

protected CacheDefinitionFactory createFactory(java.lang.Object key,
                                               javax.servlet.ServletRequest request,
                                               javax.servlet.ServletContext servletContext)
                                        throws org.apache.struts.tiles.DefinitionsFactoryException
Create a factory for specified key. If creation failes, return default factory and log an error message.

Specified by:
createFactory in class CacheFactorySet
Parameters:
key - The key.
request - Servlet request.
servletContext - Servlet context.
Returns:
Definition factory for specified key.
Throws:
org.apache.struts.tiles.DefinitionsFactoryException - If an error occur while creating factory.

toString

public java.lang.String toString()
Return String representation.

Overrides:
toString in class CacheFactorySet
Returns:
String representation.


Copyright © 2005 MacVu group. All Rights Reserved.