net.dpml.i18n
Class ResourceManager

java.lang.Object
  extended by net.dpml.i18n.ResourceManager

public final class ResourceManager
extends Object

Manager for resources.

Version:
1.0.0
Author:
Digital Product Meta Library

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

Method Detail

getBaseResources

public static final Resources getBaseResources(String baseName)
Retrieve resource with specified basename.

Parameters:
baseName - the basename
Returns:
the Resources

getBaseResources

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

Parameters:
baseName - the basename
classLoader - the classLoader to load resources from
Returns:
the Resources

getBaseResources

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

Parameters:
baseName - the basename
locale - the locale
classLoader - the classLoader to load resources from
Returns:
the Resources

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

getResources

public static final Resources getResources(String name)
Retrieve resource for specified name. The basename is determined by name postfixed with ".Resources".

Parameters:
name - the name to use when looking up resources
Returns:
the Resources

getPackageResources

public static final Resources 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 Resources 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
locale - the locale
Returns:
the Resources

getClassResources

public static final Resources 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 Resources 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
locale - the requested Locale.
Returns:
the Resources

getPackageResourcesBaseName

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

Parameters:
clazz - the Class
Returns:
the resource basename

getClassResourcesBaseName

public static final String getClassResourcesBaseName(Class clazz)
Retrieve resource basename for specified Class. The basename is determined by name of Class postfixed with "Resources".

Parameters:
clazz - the Class
Returns:
the resource basename