org.norther.tammi.core.locale
Interface ResourceMap

All Superinterfaces:
CacheClient, Localizer, Refreshable
All Known Subinterfaces:
FallbackMap, HostFilter, Logger, PipeFilter, ResourceFilter, ServiceFilter, ThreadedLogger
All Known Implementing Classes:
AbstractLogger, AbstractThreadedLogger, DefaultFallbackMap, DefaultHostFilter, DefaultPipeFilter, DefaultResourceFilter, DefaultResourceMap, DefaultServiceFilter, JDK4Logger, Log4JLogger

public interface ResourceMap
extends Localizer, CacheClient

An interface to localized resource maps maintaining mappings between qualified object or package names and base names fo resource bundles. Resource mapping provides more flexibility to the localization mechanism than to apply the qualified name directly to the base name as the package structure of functional objects is usually inconvenient for organizing application specific localized resources.

Author:
Ilkka Priha

Field Summary
 
Fields inherited from interface org.norther.tammi.acorn.locale.Localizer
ANY_NAME
 
Method Summary
 void clearResourceBundleNames()
          Clears all resource bundle names.
 String getDefaultBaseName()
          Gets the default base name.
 ObjectName getFallbackResourcesName()
          Gets the fallback resources of this map.
 String getPlugInBaseName(String key)
          Gets the base name of the resource bundle class associated with the specified plug-in key.
 LookupResourceBundle getResourceBundle(String baseName)
          Gets a resource bundle for the specified base name.
 LookupResourceBundle getResourceBundle(String baseName, Locale locale)
          Gets a resource bundle for the specified base name and locale.
 String getResourceBundleName(String qualifier)
          Gets the qualified resource bundle name.
 ObjectName getResourceFinderName()
          Gets the resource finder of this map.
 Set qualifierSet()
          Returns a read-only set of resource qualifiers.
 void removeResourceBundleName(String qualifier)
          Removes the resource bundle name of the qualified name.
 LookupResourceBundle resolveResourceBundle(String name)
          Resolves a resource bundle for the qualified name.
 LookupResourceBundle resolveResourceBundle(String name, Locale locale)
          Resolves a resource bundle for the qualified name and locale.
 String resolveResourceBundleName(String name)
          Resolves a resource bundle name for the qualified name.
 void setDefaultBaseName(String baseName)
          Sets the default base name.
 void setFallbackResourcesName(ObjectName map)
          Sets the fallback resources of this map.
 void setResourceBundleName(String qualifier, String baseName)
          Sets the resource bundle name of the qualified name.
 void setResourceFinderName(ObjectName finder)
          Sets the resource finder of this map.
 
Methods inherited from interface org.norther.tammi.acorn.locale.Localizer
resolveLocalizedObject, resolveLocalizedObject, resolveLocalizedResource, resolveLocalizedResource, resolveLocalizedString, resolveLocalizedString, resolveLocalizedStrings, resolveLocalizedStrings
 
Methods inherited from interface org.norther.tammi.core.cache.CacheClient
clearCached, expireCached, expireFraction, getCache, isCachingDisabled, removeCache, setCachingDisabled
 
Methods inherited from interface org.norther.tammi.core.base.Refreshable
getRefreshed, refresh
 

Method Detail

getResourceFinderName

ObjectName getResourceFinderName()
Gets the resource finder of this map.

Returns:
the object name of the resource finder or a query.

setResourceFinderName

void setResourceFinderName(ObjectName finder)
Sets the resource finder of this map. If it is not set, the default one will be used.

Parameters:
finder - the object name of the resource finder or a query.

getPlugInBaseName

String getPlugInBaseName(String key)
Gets the base name of the resource bundle class associated with the specified plug-in key.

Parameters:
key - the plug-in key.
Returns:
the base name of the resource bundle class.

getFallbackResourcesName

ObjectName getFallbackResourcesName()
Gets the fallback resources of this map.

Returns:
the object name of the fallback resources or a query.

setFallbackResourcesName

void setFallbackResourcesName(ObjectName map)
Sets the fallback resources of this map.

Parameters:
map - the object name of the fallback resources or a query.

getDefaultBaseName

String getDefaultBaseName()
Gets the default base name.

Returns:
the base name of the default bundle or null.

setDefaultBaseName

void setDefaultBaseName(String baseName)
Sets the default base name.

Parameters:
baseName - the base name of the default bundle.

getResourceBundleName

String getResourceBundleName(String qualifier)
Gets the qualified resource bundle name.

Parameters:
qualifier - the resource qualifier.
Returns:
the base name of the resource bundle or null.

setResourceBundleName

void setResourceBundleName(String qualifier,
                           String baseName)
Sets the resource bundle name of the qualified name.

Parameters:
qualifier - the resource qualifier.
baseName - the base name of the resource bundle.

removeResourceBundleName

void removeResourceBundleName(String qualifier)
Removes the resource bundle name of the qualified name.

Parameters:
qualifier - the resource qualifier.

clearResourceBundleNames

void clearResourceBundleNames()
Clears all resource bundle names.


qualifierSet

Set qualifierSet()
Returns a read-only set of resource qualifiers.

Returns:
a set of qualifiers.

getResourceBundle

LookupResourceBundle getResourceBundle(String baseName)
Gets a resource bundle for the specified base name.

Parameters:
baseName - the base name.
Returns:
the resource bundle or null.

getResourceBundle

LookupResourceBundle getResourceBundle(String baseName,
                                       Locale locale)
Gets a resource bundle for the specified base name and locale.

Parameters:
baseName - the base name.
locale - the locale.
Returns:
the resource bundle or null.

resolveResourceBundleName

String resolveResourceBundleName(String name)
Resolves a resource bundle name for the qualified name. The fully qualified name is checked first. If it fails, the plain base name is tried. If it fails too, the packages of the qualified name are applied to defined base names by starting from the most specific one. If also the packages fail, fallback resources are applied. Finally, the default base name is applied if nothing else matches.

Parameters:
name - the qualified name.
Returns:
the base name of the resource bundle or null.

resolveResourceBundle

LookupResourceBundle resolveResourceBundle(String name)
Resolves a resource bundle for the qualified name.

Parameters:
name - the qualified name.
Returns:
the resource bundle or null.

resolveResourceBundle

LookupResourceBundle resolveResourceBundle(String name,
                                           Locale locale)
Resolves a resource bundle for the qualified name and locale. The fully qualified name is checked first. If it fails, the plain base name is tried. If it fails too, the packages of the qualified name are applied to defined base names by starting from the most specific one. If also the packages fail, fallback resources are applied. Finally, the default base name is applied if nothing else matches.

Parameters:
name - the qualified name.
locale - the locale.
Returns:
the resource bundle or null.


Copyright © 2004 The Norther Organization. All rights reserved.