org.apache.struts.tiles.xmlDefinition
クラス I18nFactorySet

java.lang.Object
  拡張org.apache.struts.tiles.xmlDefinition.FactorySet
      拡張org.apache.struts.tiles.xmlDefinition.I18nFactorySet
すべての実装インタフェース:
ComponentDefinitionsFactory, java.io.Serializable

public class I18nFactorySet
extends FactorySet

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.

関連項目:
直列化された形式

フィールドの概要
static java.lang.String[] DEFAULT_DEFINITION_FILENAMES
          Possible definition filenames.
protected  DefinitionsFactory defaultFactory
          Default factory.
static java.lang.String DEFINITIONS_CONFIG_PARAMETER_NAME
          Config file parameter name.
static java.lang.String FILENAME_EXTENSION
          Default filenames extension.
private  java.util.List filenames
          Names of files containing instances descriptions.
static java.lang.String INSTANCES_CONFIG_PARAMETER_NAME
          推奨されていません。 use DEFINITIONS_CONFIG_PARAMETER_NAME
protected  boolean isValidatingParser
          Do we want validating parser.
private  java.util.Map loaded
          Collection of already loaded definitions set, referenced by their suffix.
protected static org.apache.commons.logging.Log log
          Commons Logging instance.
private static int MAX_BUNDLES_SEARCHED
          Maximum length of one branch of the resource search path tree.
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  XmlParser xmlParser
          Xml parser used.
 
クラス org.apache.struts.tiles.xmlDefinition.FactorySet から継承したフィールド
factories
 
コンストラクタの概要
I18nFactorySet()
          Parameterless Constructor.
I18nFactorySet(javax.servlet.ServletContext servletContext, java.util.Map properties)
          Constructor.
 
メソッドの概要
private static java.util.List calculatePostixes(java.lang.String baseName, java.util.Locale locale)
          Calculate the postixes along the search path from the base bundle to the bundle specified by baseName and locale.
private  java.lang.String concatPostfix(java.lang.String name, java.lang.String postfix)
          Concat postfix to the name.
protected  DefinitionsFactory createDefaultFactory(javax.servlet.ServletContext servletContext)
          Create default factory .
protected  DefinitionsFactory createFactory(java.lang.Object key, javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Create a factory for specified key.
protected  DefinitionsFactory 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.
private  XmlDefinitionsSet parseXmlFile(javax.servlet.ServletContext servletContext, java.lang.String filename, XmlDefinitionsSet xmlDefinitions)
          Parse specified xml file and add definition to specified definitions set.
private  XmlDefinitionsSet parseXmlFiles(javax.servlet.ServletContext servletContext, java.lang.String postfix, XmlDefinitionsSet xmlDefinitions)
          Parse files associated to postix if they exist.
 java.lang.String toString()
          Return String representation.
 
クラス org.apache.struts.tiles.xmlDefinition.FactorySet から継承したメソッド
getDefinition, getFactory
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

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
推奨されていません。 use DEFINITIONS_CONFIG_PARAMETER_NAME

Config file parameter name.

関連項目:
定数フィールド値

DEFINITIONS_CONFIG_PARAMETER_NAME

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

関連項目:
定数フィールド値

PARSER_DETAILS_PARAMETER_NAME

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

関連項目:
定数フィールド値

PARSER_VALIDATE_PARAMETER_NAME

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

関連項目:
定数フィールド値

DEFAULT_DEFINITION_FILENAMES

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


defaultFactory

protected DefinitionsFactory defaultFactory
Default factory.


xmlParser

protected transient XmlParser xmlParser
Xml parser used. Attribute is transient to allow serialization. In this implementaiton, xmlParser 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.


MAX_BUNDLES_SEARCHED

private static final int MAX_BUNDLES_SEARCHED
Maximum length of one branch of the resource search path tree. Used in getBundle().

関連項目:
定数フィールド値

FILENAME_EXTENSION

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

関連項目:
定数フィールド値

filenames

private java.util.List filenames
Names of files containing instances descriptions.


loaded

private java.util.Map loaded
Collection of already loaded definitions set, referenced by their suffix.

コンストラクタの詳細

I18nFactorySet

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


I18nFactorySet

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

パラメータ:
servletContext - Servlet context.
properties - Map containing all properties.
例外:
FactoryNotFoundException - Can't find factory configuration file.
DefinitionsFactoryException
メソッドの詳細

initFactory

public void initFactory(javax.servlet.ServletContext servletContext,
                        java.util.Map properties)
                 throws 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).

定義:
インタフェース ComponentDefinitionsFactory 内の initFactory
定義:
クラス FactorySet 内の initFactory
パラメータ:
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.

initFactory

protected void initFactory(javax.servlet.ServletContext servletContext,
                           java.lang.String proposedFilename)
                    throws 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).

パラメータ:
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.
java.io.FileNotFoundException

getDefaultFactory

protected DefinitionsFactory getDefaultFactory()
Get default factory.

定義:
クラス FactorySet 内の getDefaultFactory
戻り値:
Default factory

createDefaultFactory

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

パラメータ:
servletContext - Current servlet context. Used to open file.
戻り値:
Created default definition factory.
例外:
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.

定義:
クラス FactorySet 内の getDefinitionsFactoryKey
パラメータ:
name - Name of requested definition
request - Current servlet request.
servletContext - Current servlet context.
戻り値:
the key or null if not found.

createFactory

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

定義:
クラス FactorySet 内の createFactory
パラメータ:
key - The key.
request - Servlet request.
servletContext - Servlet context.
戻り値:
Definition factory for specified key.
例外:
DefinitionsFactoryException - If an error occur while creating factory.

calculatePostixes

private static java.util.List calculatePostixes(java.lang.String baseName,
                                                java.util.Locale locale)
Calculate the postixes along the search path from the base bundle to the bundle specified by baseName and locale. Method copied from java.util.ResourceBundle

パラメータ:
baseName - the base bundle name
locale - the locale

parseXmlFiles

private XmlDefinitionsSet parseXmlFiles(javax.servlet.ServletContext servletContext,
                                        java.lang.String postfix,
                                        XmlDefinitionsSet xmlDefinitions)
                                 throws DefinitionsFactoryException
Parse files associated to postix if they exist. For each name in filenames, append postfix before file extension, then try to load the corresponding file. If file doesn't exist, try next one. Each file description is added to the XmlDefinitionsSet description. The XmlDefinitionsSet description is created only if there is a definition file. Inheritance is not resolved in the returned XmlDefinitionsSet. If no description file can be opened and no definiion set is provided, return 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.
戻り値:
XmlDefinitionsSet The definitions set created or passed as parameter.
例外:
DefinitionsFactoryException - On errors parsing file.

parseXmlFile

private XmlDefinitionsSet parseXmlFile(javax.servlet.ServletContext servletContext,
                                       java.lang.String filename,
                                       XmlDefinitionsSet xmlDefinitions)
                                throws DefinitionsFactoryException
Parse specified xml file and add definition to specified definitions set. This method is used to load several description files in one instances list. If filename exists and definition set is 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.
戻り値:
XmlDefinitionsSet The definitions set created or passed as parameter.
例外:
DefinitionsFactoryException - On errors parsing file.

concatPostfix

private java.lang.String concatPostfix(java.lang.String name,
                                       java.lang.String postfix)
Concat postfix to the name. Take care of existing filename extension. Transform the given name "name.ext" to have "name" + "postfix" + "ext". If there is no ext, return "name" + "postfix".

パラメータ:
name - Filename.
postfix - Postfix to add.
戻り値:
Concatenated filename.

toString

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

オーバーライド:
クラス FactorySet 内の toString
戻り値:
String representation.


このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2003 - Apache Software Foundation