org.apache.avalon.excalibur.i18n
Class BundleSelector

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.avalon.excalibur.component.ExcaliburComponentSelector
              |
              +--org.apache.avalon.excalibur.i18n.BundleSelector
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.ComponentSelector, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.Loggable, LogKitManageable, org.apache.avalon.excalibur.component.RoleManageable, org.apache.avalon.framework.thread.ThreadSafe

public class BundleSelector
extends org.apache.avalon.excalibur.component.ExcaliburComponentSelector

This is the method for getting instances of ResourceBundles.

Version:
$Id: BundleSelector.java,v 1.10 2002/01/02 19:04:56 neeme Exp $
Author:
Neeme Praks, Mike Engelhart

Field Summary
protected  java.util.Map cache
           
protected  java.util.Map cacheNotFound
          Cache for the names of the bundles that were not found
protected  org.apache.avalon.framework.component.ComponentManager manager
          Component Manager
static java.lang.String ROLE
          The role implemented by an BundleSelector.
 
Fields inherited from class org.apache.avalon.excalibur.component.ExcaliburComponentSelector
m_context
 
Constructor Summary
BundleSelector()
           
 
Method Summary
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configure the component.
protected  boolean isNotFoundBundle(BundleInfo bundleInfo)
          Checks if the bundle is in the "not-found" cache.
 org.apache.avalon.framework.component.Component select(java.lang.Object hint)
          Select a bundle based on bundle name and locale.
 org.apache.avalon.framework.component.Component select(java.lang.String name, java.lang.String localeName)
          Select a bundle based on bundle name and locale name.
protected  org.apache.avalon.framework.component.Component selectCached(BundleInfo bundleInfo)
          Selects a bundle from the cache.
protected  void updateCache(BundleInfo bundleInfo, Bundle bundle)
          Checks if the bundle is in the "not-found" cache.
 
Methods inherited from class org.apache.avalon.excalibur.component.ExcaliburComponentSelector
addComponent, addComponentInstance, contextualize, dispose, hasComponent, initialize, release, setLogKitManager, setRoleManager
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLE

public static java.lang.String ROLE
The role implemented by an BundleSelector.

manager

protected org.apache.avalon.framework.component.ComponentManager manager
Component Manager

cacheNotFound

protected java.util.Map cacheNotFound
Cache for the names of the bundles that were not found

cache

protected java.util.Map cache
Constructor Detail

BundleSelector

public BundleSelector()
Method Detail

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
Overrides:
compose in class org.apache.avalon.excalibur.component.ExcaliburComponentSelector

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configure the component.
Overrides:
configure in class org.apache.avalon.excalibur.component.ExcaliburComponentSelector
Parameters:
configuration - the configuration

select

public org.apache.avalon.framework.component.Component select(java.lang.Object hint)
                                                       throws org.apache.avalon.framework.component.ComponentException
Select a bundle based on bundle name and locale.
Overrides:
select in class org.apache.avalon.excalibur.component.ExcaliburComponentSelector
Parameters:
name - bundle name
locale - locale
cacheAtStartup - cache all the keys when constructing?
Returns:
the bundle
Throws:
org.apache.avalon.framework.component.ComponentException - if a bundle is not found

select

public org.apache.avalon.framework.component.Component select(java.lang.String name,
                                                              java.lang.String localeName)
                                                       throws org.apache.avalon.framework.component.ComponentException
Select a bundle based on bundle name and locale name.
Parameters:
name - bundle name
localeName - locale name
Returns:
the bundle
Throws:
org.apache.avalon.framework.component.ComponentException - if a bundle is not found

selectCached

protected org.apache.avalon.framework.component.Component selectCached(BundleInfo bundleInfo)
Selects a bundle from the cache.
Parameters:
fileName - file name of the bundle
Returns:
the cached bundle; null, if not found

isNotFoundBundle

protected boolean isNotFoundBundle(BundleInfo bundleInfo)
Checks if the bundle is in the "not-found" cache.
Parameters:
fileName - file name of the bundle
Returns:
true, if the bundle wasn't found already before; otherwise, false.

updateCache

protected void updateCache(BundleInfo bundleInfo,
                           Bundle bundle)
Checks if the bundle is in the "not-found" cache.
Parameters:
fileName - file name of the bundle
Returns:
true, if the bundle wasn't found already before; otherwise, false.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.