org.codehaus.spice.salt.i18n
Class I18nResourceManager

java.lang.Object
  extended byorg.codehaus.spice.salt.i18n.I18nResourceManager

public class I18nResourceManager
extends Object

Manager for I18nResources objects. The manager caches the I18nResources object based on the ClassLoader and Locale that the I18nResources is loaded from.

Author:
Peter Donald

Constructor Summary
I18nResourceManager()
           
 
Method Summary
static void clearResourceCache()
          Clear the cache of all resources currently loaded into the system.
static I18nResources getBaseResources(String basename, ClassLoader classLoader)
          Retrieve resource with specified basename.
static I18nResources getBaseResources(String basename, Locale locale, ClassLoader classLoader)
          Retrieve resource with specified basename in specified locale.
static I18nResources getClassResources(Class clazz)
          Retrieve resource for specified Class.
static I18nResources getClassResources(Class clazz, Locale locale)
          Retrieve resource for specified Class.
static I18nResources getPackageResources(Class clazz)
          Retrieve resource for specified Classes package.
static I18nResources getPackageResources(Class clazz, Locale locale)
          Retrieve resource for specified Classes package.
static I18nResources getResources(String resource, ClassLoader classLoader)
          Retrieve resource for specified name.
static I18nResources getResources(String resource, Locale locale, ClassLoader classLoader)
          Retrieve resource for specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I18nResourceManager

public I18nResourceManager()
Method Detail

clearResourceCache

public static final void clearResourceCache()
                                     throws SecurityException
Clear the cache of all resources currently loaded into the system. This method is useful if you need to dump the complete cache and because part of the application is reloading and thus the resources may need to be reloaded.

Note that the caller must have been granted the "i18n.clearCompleteCache" RuntimePermission or else a security exception will be thrown.

Throws:
SecurityException - if the caller does not have permission to clear cache

getBaseResources

public static final I18nResources getBaseResources(String basename,
                                                   ClassLoader classLoader)
Retrieve resource with specified basename.

Parameters:
basename - the basename
Returns:
the Resources

getBaseResources

public static final I18nResources getBaseResources(String basename,
                                                   Locale locale,
                                                   ClassLoader classLoader)
Retrieve resource with specified basename in specified locale.

Parameters:
basename - the basename
Returns:
the Resources

getResources

public static final I18nResources getResources(String resource,
                                               ClassLoader classLoader)
Retrieve resource for specified name. The baseName is determined by name postfixed with ".Resources".

Parameters:
resource - the base location
Returns:
the Resources

getResources

public static final I18nResources getResources(String resource,
                                               Locale locale,
                                               ClassLoader classLoader)
Retrieve resource for specified name. The baseName is determined by name postfixed with ".Resources".

Parameters:
resource - the base location
Returns:
the Resources

getPackageResources

public static final I18nResources getPackageResources(Class clazz)
Retrieve resource for specified Classes package. The baseName is determined by name of classes package postfixed with ".Resources".

Parameters:
clazz - the Class
Returns:
the Resources

getPackageResources

public static final I18nResources getPackageResources(Class clazz,
                                                      Locale locale)
Retrieve resource for specified Classes package. The baseName is determined by name of classes package postfixed with ".Resources".

Parameters:
clazz - the Class
Returns:
the Resources

getClassResources

public static final I18nResources getClassResources(Class clazz)
Retrieve resource for specified Class. The baseName is determined by name of Class postfixed with ".Resources".

Parameters:
clazz - the Class
Returns:
the Resources

getClassResources

public static final I18nResources getClassResources(Class clazz,
                                                    Locale locale)
Retrieve resource for specified Class. The baseName is determined by name of Class postfixed with ".Resources".

Parameters:
clazz - the Class
Returns:
the Resources


Copyright © 1999-2007 Codehaus. All Rights Reserved.