|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pfsw.nls.NLSIniFileDetector
public class NLSIniFileDetector
This class is responsible to lookup the classpath for a specified base name to which it depends the file extension ".ini". All found files are read to retrieve the included metadata which defines which texts for which locale can be found in which file. Eventually it provides a FileLocator per locale which allows to load the associated texts with a NLSIniFileLoader.
Field Summary | |
---|---|
static boolean |
DEBUG
|
static java.lang.String |
DEFAULT_FILE_EXTENSTION
|
protected static java.lang.String |
FILE_MAPPING_SECTION
|
Constructor Summary | |
---|---|
NLSIniFileDetector()
Initialize the new instance with default values. |
Method Summary | |
---|---|
protected void |
addFileMappings(org.pfsw.settings.Settings settings)
|
protected org.pfsw.util.CollectionUtil |
coll()
|
boolean |
detect(java.lang.String baseName)
Detects all meta information files for the given base name on the current NLS lookup path. |
org.pfsw.file.FileLocator |
getFileForLocales(java.util.Locale locale)
Returns the file locator for the given locale or null if not found. |
protected java.util.Map |
getFileMappings()
|
org.pfsw.file.FileLocator[] |
getFilesForLocales(java.util.Locale[] locales)
Returns a file locators for wich a mapping to the given locales have been found. |
protected org.pfsw.file.Classpath |
getLookupPath()
|
protected NLSUtil |
nls()
|
protected void |
readFileMapping(org.pfsw.file.ClasspathElement element,
java.lang.String filename)
|
protected void |
readFileMappingsFor(java.lang.String filename,
org.pfsw.file.Classpath classpath)
Read all classes specified in the given file, if it exists in the specified classpath element. |
protected void |
reset()
|
protected void |
setFileMappings(java.util.Map newValue)
|
protected void |
setLookupPath(org.pfsw.file.Classpath newValue)
|
protected org.pfsw.text.StringUtil |
str()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean DEBUG
public static final java.lang.String DEFAULT_FILE_EXTENSTION
protected static final java.lang.String FILE_MAPPING_SECTION
Constructor Detail |
---|
public NLSIniFileDetector()
Method Detail |
---|
protected java.util.Map getFileMappings()
protected void setFileMappings(java.util.Map newValue)
protected org.pfsw.file.Classpath getLookupPath()
protected void setLookupPath(org.pfsw.file.Classpath newValue)
public boolean detect(java.lang.String baseName)
This path usually is the classpath. However, it can explicitly set with -Dorg.pf.nls.path=any classpath.
After calling this method the getFilesForLocales() can be used to get the names of the file that contain the NLS text data.
baseName
- The filename without file extension (".ini" will be appended)
public org.pfsw.file.FileLocator[] getFilesForLocales(java.util.Locale[] locales)
This method should be called only after detect() has been called at least once before.
locales
- The locales for which to return the corresponding file locatorspublic org.pfsw.file.FileLocator getFileForLocales(java.util.Locale locale)
protected void reset()
protected void readFileMappingsFor(java.lang.String filename, org.pfsw.file.Classpath classpath)
filename
- The name of the properties file that contains the class definitionsclasspath
- The classpath the specified filename to be looked up inprotected void readFileMapping(org.pfsw.file.ClasspathElement element, java.lang.String filename)
protected void addFileMappings(org.pfsw.settings.Settings settings)
protected org.pfsw.util.CollectionUtil coll()
protected NLSUtil nls()
protected org.pfsw.text.StringUtil str()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |