Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dinopolis.util
Class ResourceManager  view ResourceManager download ResourceManager.java

java.lang.Object
  extended byorg.dinopolis.util.ResourceManager

public class ResourceManager
extends java.lang.Object

This class can be asked to create a ResourceManager instance using one of the getResourceManager methods.

Version:
$Revision: 1.4 $

Constructor Summary
ResourceManager()
           
 
Method Summary
static Resources getResources(java.lang.Class caller, java.lang.String base_name)
          Get the appropriate ResourceBundle for the given base_name and searches the system bundle in the callers package name.
static Resources getResources(java.lang.Class caller, java.lang.String base_name, java.util.Locale locale)
          Get the appropriate ResourceBundle for the given base_name and locale and searches the system bundle in the callers package name.
static Resources getResources(java.lang.Class caller, java.lang.String base_name, java.lang.String dir_name)
          Get the appropriate ResourceBundle for the given base_name and the given dir_name and searches the system bundle in the callers package name.
static Resources getResources(java.lang.Class caller, java.lang.String base_name, java.lang.String dir_name, java.util.Locale locale)
          Get the appropriate ResourceBundle.
static Resources getResources(java.lang.Class caller, java.lang.String base_name, java.lang.String dir_name, java.util.Locale locale, java.lang.ClassLoader loader)
          Get the appropriate ResourceBundle for the given base_name, the given dir_name and the given locale.
static Resources getResources(java.lang.String base_name)
          Get the appropriate ResourceBundle for the given base_name.
static Resources getResources(java.lang.String base_name, java.util.Locale locale)
          Get the appropriate ResourceBundle for the given base_name and the given locale.
static Resources getResources(java.lang.String base_name, java.lang.String dir_name)
          Get the appropriate ResourceBundle for the given base_name and the given dir_name.
static Resources getResources(java.lang.String base_name, java.lang.String dir_name, java.util.Locale locale)
          Get the appropriate ResourceManager for the given base_name, the given dir_name and the given locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManager

public ResourceManager()
Method Detail

getResources

public static Resources getResources(java.lang.String base_name)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name.


getResources

public static Resources getResources(java.lang.Class caller,
                                     java.lang.String base_name)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name and searches the system bundle in the callers package name.


getResources

public static Resources getResources(java.lang.String base_name,
                                     java.util.Locale locale)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name and the given locale.


getResources

public static Resources getResources(java.lang.Class caller,
                                     java.lang.String base_name,
                                     java.util.Locale locale)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name and locale and searches the system bundle in the callers package name.


getResources

public static Resources getResources(java.lang.String base_name,
                                     java.lang.String dir_name)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name and the given dir_name. The dir_name specifies the directory name of the users resource file, relative to the users home directory.


getResources

public static Resources getResources(java.lang.Class caller,
                                     java.lang.String base_name,
                                     java.lang.String dir_name)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name and the given dir_name and searches the system bundle in the callers package name. The dir_name specifies the directory name of the users resource file, relative to the users home directory.


getResources

public static Resources getResources(java.lang.String base_name,
                                     java.lang.String dir_name,
                                     java.util.Locale locale)
                              throws java.util.MissingResourceException
Get the appropriate ResourceManager for the given base_name, the given dir_name and the given locale. The dir_name specifies the directory name of the users resource file, relative to the users home directory.


getResources

public static Resources getResources(java.lang.Class caller,
                                     java.lang.String base_name,
                                     java.lang.String dir_name,
                                     java.util.Locale locale)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle. The ResourceBundle consists of two parts, the system resources (for default settings) and user specific settings. Any given properties in the users resources will overwrite the system resources! The users resources are searched in the following order: $user_home/dir_name/base_name.properties, $user_home/.dir_name/base_name.properties, $user_home/dir_name.toLowerCase()/base_name.properties, $user_home/.dir_name.toLowerCase()/base_name.properties

The system resources are expected to be in the same package than the caller!

Example:
caller: org.dinopolis.util.ResourceManager
base_name: TestResourceManager
dir_name: test_resources
locale: Locale.getDefault()
users home dir: ~dfreis

then, the users bundle is suspected to be:
"~dfreis/test_resources/TestResourceManager.properties", or if not found:
"~dfreis/.test_resources/TestResourceManager.properties" the system resources are expected to be in:
"org.dinopolis.util.ResourceManager.TestResourceManager.properties" within your classpath!

The sample code of the caller for the given example will look like this:

ResourceManager resources = ResourceManager.getResources(getClass(), "TestResourceManager", "test_resources");


getResources

public static Resources getResources(java.lang.Class caller,
                                     java.lang.String base_name,
                                     java.lang.String dir_name,
                                     java.util.Locale locale,
                                     java.lang.ClassLoader loader)
                              throws java.util.MissingResourceException
Get the appropriate ResourceBundle for the given base_name, the given dir_name and the given locale. The dir_name specifies the directory name of the users resource file, relative to the users home directory.