org.norther.tammi.core.locale
Interface ResourceMap

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

public interface ResourceMap
extends Localizer, CacheClient<String,String>

An interface to localized resource maps maintaining mappings between qualified object or package names and base names for 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.

Version:
$Id: ResourceMap.java,v 1.21 2009/11/13 22:03:40 cvsimp Exp $
Author:
Ilkka Priha

Field Summary
 
Fields inherited from interface org.norther.tammi.acorn.locale.Localizer
ANY_NAME
 
Method Summary
 void addResourceBundleName(String qualifier, String baseName)
          Adds a resource bundle name for the qualified name.
 void addResourceBundleNames(String qualifier, String[] baseNames)
          Adds resource bundle names for the qualified name.
 void clearResourceBundleNames()
          Clears all resource bundle names.
 void clearResourceBundleNames(String qualifier)
          Clears all resource bundle names of the qualified name.
 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.
 String[] getResourceBundleNames(String qualifier)
          Gets the qualified resource bundle names.
 ObjectName getResourceFinderName()
          Gets the resource finder of this map.
 Set<String> qualifierSet()
          Returns a read-only set of resource qualifiers.
 void removeResourceBundleName(String qualifier, String baseName)
          Removes a resource bundle name of 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 a resource bundle name for the qualified name.
 void setResourceBundleNames(String qualifier, String[] baseNames)
          Sets the resource bundle names 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, resolveLocalizedResource, resolveLocalizedString, resolveLocalizedStrings
 
Methods inherited from interface org.norther.tammi.core.cache.CacheClient
clearCached, expireCached, expireFraction, getCache, getSharedCacheName, isCachingDisabled, removeCache, setCachingDisabled, setSharedCacheName
 
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.

getResourceBundleNames

String[] getResourceBundleNames(String qualifier)
Gets the qualified resource bundle names.

Parameters:
qualifier - the resource qualifier.
Returns:
the base names of the resource bundles or null.

setResourceBundleNames

void setResourceBundleNames(String qualifier,
                            String[] baseNames)
Sets the resource bundle names of the qualified name.

Parameters:
qualifier - the resource qualifier.
baseNames - the base names of the resource bundles.

setResourceBundleName

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

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

addResourceBundleNames

void addResourceBundleNames(String qualifier,
                            String[] baseNames)
Adds resource bundle names for the qualified name.

Parameters:
qualifier - the resource qualifier.
baseNames - the base names of the resource bundles.

addResourceBundleName

void addResourceBundleName(String qualifier,
                           String baseName)
Adds a resource bundle name for the qualified name.

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

removeResourceBundleName

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

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

clearResourceBundleNames

void clearResourceBundleNames(String qualifier)
Clears all resource bundle names of the qualified name.

Parameters:
qualifier - the resource qualifier.

clearResourceBundleNames

void clearResourceBundleNames()
Clears all resource bundle names.


qualifierSet

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

Returns:
a set of qualifiers.

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,
                                           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.