Back to index

wims  3.65+svn20090927
Public Member Functions | Private Member Functions | Private Attributes
fr.ove.utils.ResourcesManager Class Reference

A resources manager. More...

Inheritance diagram for fr.ove.utils.ResourcesManager:
Inheritance graph
[legend]
Collaboration diagram for fr.ove.utils.ResourcesManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ResourcesManager (String resourcesName)
 Constructor.
String getResourceString (String prop)
 Get the raw string for the given property.
String[] getResourceStrings (String prop)
 Get the resource strings for the given property.

Private Member Functions

String[] tokenize (String input)
 Take the given string and chop it up into a series of strings on whitespace boundries.

Private Attributes

ResourceBundle resources

Detailed Description

A resources manager.


All the resources are specified in a properties file, each property defined in a key = val1:val2:....:valn.
The key represents the name of the property. The different vali the parameters identifying the property.
Each parameter is separated by the ':' character.

Author:
1999 DIRAT Laurent
Version:
2.0 17/12/1999

Definition at line 20 of file ResourcesManager.java.


Constructor & Destructor Documentation

fr.ove.utils.ResourcesManager.ResourcesManager ( String  resourcesName) [inline]

Constructor.

Parameters:
resourcesNamethe name of the resources file.
he name is specified without the ".properties" extension. If the property file is located in a package, the fully qualified name (e.g. my.package.filename) must be used.

Definition at line 29 of file ResourcesManager.java.

                                                  {
        try {
            //resources = ResourceBundle.getBundle(resourcesName, Locale.getDefault());
            resources = ResourceBundle.getBundle(resourcesName);
        } 
            catch (MissingResourceException mre) {
                System.err.println(resourcesName+".properties not found");
                System.exit(1);
        }
    }

Member Function Documentation

String fr.ove.utils.ResourcesManager.getResourceString ( String  prop) [inline]

Get the raw string for the given property.

Definition at line 43 of file ResourcesManager.java.

                                                 {
        String str;
        try {
            str = resources.getString(prop);
        } 
        catch (MissingResourceException mre) {
            str = null;
        }

        return str;
    }

Here is the caller graph for this function:

String [] fr.ove.utils.ResourcesManager.getResourceStrings ( String  prop) [inline]

Get the resource strings for the given property.

Definition at line 58 of file ResourcesManager.java.

                                                     {
        return tokenize(getResourceString (prop));
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String [] fr.ove.utils.ResourcesManager.tokenize ( String  input) [inline, private]

Take the given string and chop it up into a series of strings on whitespace boundries.

This is useful for trying to get an array of strings out of the resource file.

Definition at line 68 of file ResourcesManager.java.

                                            {
        if (input != null) {
            Vector v = new Vector();
            StringTokenizer t = new StringTokenizer (input, ":");
            String cmd[];

            while (t.hasMoreTokens())
                v.addElement(t.nextToken());
                
            cmd = new String[v.size()];
            for (int i = 0; i < cmd.length; i++)
                cmd[i] = (String) v.elementAt(i);

            return cmd;
        }
        else
            return new String [0];
    }

Here is the caller graph for this function:


Member Data Documentation

ResourceBundle fr.ove.utils.ResourcesManager.resources [private]

Definition at line 21 of file ResourcesManager.java.


The documentation for this class was generated from the following file: