net.sourceforge.drpetrea.jsettings
Class SettingsLoader

Object
  extended by SettingsLoader

public class SettingsLoader
extends Object

This class is used for loading the settings of the program. It is very similar to what the DefaultSettingsLoader class does, but still the conceptual differences made me create a new class. It reads a zip archive that contains one file for each settings category that the program needs and/or separate files with settings (not in archives). Each of these files has the extension .ini for an ini-style settings category and .fstab for a fstab-style category. In this case, the ini- and the fstab- files have different structures - please see their corresponding classes for details. Also, the class reads non-archived .ini and .fstab files. The choice between zip and/or regular files lays with the user and is made through the choice of extensions in the file names.

The class will check for the supplied file names in the supplied paths (or in the defaults if nothing is supplied) and to load the settings found there. Also default is to only allow the modification of existing 'ini' settings and the addition of 'fstab' lines to the existing sections, both having previously being loaded from the default files. However, the user can easily overwrite this.

The naming convention is that the first level name of a section is the name of the file. If the user wants a different name, he can add AS FIRST LINE (also before any comments) a statemenet of the form

Name:New name

where Name is defined in Constants.NAMECHANGE and anything after the colon sign (":"), less the surrounding whitespaces, is the new used name.

Author:
Dragos Petre
See Also:
DefaultSettingsLoader, IniSettings, FstabSettings

Field Summary
static LocaleTools lt
          The LocaleTools object.
 
Constructor Summary
SettingsLoader()
          The constructor that takes the possible paths from the SETTINGSPATH filed in the Constants class and the possible names from the INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE.
SettingsLoader(ArrayList<String> paths)
          The constructor that takes as arguments ArrayLists of possible paths.
SettingsLoader(ArrayList<String> paths, ArrayList<String> files)
          The constructor that takes as arguments ArrayLists of possible paths and file names.
SettingsLoader(ArrayList<String> paths, ArrayList<String> files, boolean hierarchical)
          The constructor that takes as arguments ArrayLists of possible paths and file names.
SettingsLoader(ArrayList<String> paths, boolean hierarchical)
          The constructor that takes as arguments ArrayLists of possible paths.
SettingsLoader(ArrayList<String> paths, String file)
          The constructor that takes as arguments an ArrayList of possible paths and the file name.
SettingsLoader(ArrayList<String> paths, String file, boolean hierarchical)
          The constructor that takes as arguments an ArrayList of possible paths and one file name.
SettingsLoader(boolean hierarchical)
          The constructor that takes the possible paths from the SETTINGSPATH filed in the Constants class and the possible names from the INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE.
SettingsLoader(boolean hierarchical, ArrayList<String> files)
          The constructor that takes as arguments an ArrayList of possible file names.
SettingsLoader(boolean dummy1, ArrayList<String> file, boolean dummy2)
          The constructor that takes as arguments the possible names of the settings file and no hierarchical flag.
SettingsLoader(boolean hierarchical, String file)
          The constructor that takes as arguments the name of the settings file and the hierarchical flag.
SettingsLoader(boolean dummy1, String file, boolean dummy2)
          The constructor that takes as arguments the name of the settings file and no hierarchical flag.
SettingsLoader(String path)
          The constructor that takes as argument the possible path.
SettingsLoader(String path, ArrayList<String> files)
          The constructor that takes as arguments the path and an ArrayList of possible file names.
SettingsLoader(String path, ArrayList<String> files, boolean hierarchical)
          The constructor that takes as arguments the path and an ArrayList of possible file names.
SettingsLoader(String path, boolean hierarchical)
          The constructor that takes as argument the possible path.
SettingsLoader(String path, String file)
          The constructor that takes as arguments the path and the file name.
SettingsLoader(String path, String file, boolean hierarchical)
          The constructor that takes as arguments the path and the file name.
 
Method Summary
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lt

public static LocaleTools lt
The LocaleTools object.

Constructor Detail

SettingsLoader

public SettingsLoader(ArrayList<String> paths,
                      ArrayList<String> files)
The constructor that takes as arguments ArrayLists of possible paths and file names.

Parameters:
paths - A String ArrayList containing all the possible paths where the settings files could be found.
files - A String ArrayList containing the possible names of the settings files

SettingsLoader

public SettingsLoader(ArrayList<String> paths,
                      ArrayList<String> files,
                      boolean hierarchical)
The constructor that takes as arguments ArrayLists of possible paths and file names.

Parameters:
paths - A String ArrayList containing all the possible paths where the settings regular files and archives could be found.
files - A String ArrayList containing the possible names of the settings files
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader(ArrayList<String> paths,
                      boolean hierarchical)
The constructor that takes as arguments ArrayLists of possible paths. It uses the Constants declaration of INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE for the possible file names.

Parameters:
paths - A String ArrayList containing all the possible paths where the settings zip file could be found.
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)
See Also:
Constants

SettingsLoader

public SettingsLoader(String path,
                      ArrayList<String> files,
                      boolean hierarchical)
The constructor that takes as arguments the path and an ArrayList of possible file names.

Parameters:
path - A String containing the path where the settings files could be found.
files - A String ArrayList containing the possible names of the settings files
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader(String path,
                      boolean hierarchical)
The constructor that takes as argument the possible path. It uses the Constants declaration of INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE for the possible file names.

Parameters:
path - A String containing all the possible paths where the settings files could be found.
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)
See Also:
Constants

SettingsLoader

public SettingsLoader(ArrayList<String> paths,
                      String file,
                      boolean hierarchical)
The constructor that takes as arguments an ArrayList of possible paths and one file name.

Parameters:
paths - A String ArrayList containing all the possible paths where the settings files could be found.
file - A String with the name of the settings file.
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader(String path,
                      String file,
                      boolean hierarchical)
The constructor that takes as arguments the path and the file name.

Parameters:
path - A String with the path where the settings file could be found.
file - A String with the name of the settings file.
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader(ArrayList<String> paths)
The constructor that takes as arguments ArrayLists of possible paths. It uses the Constants declaration of INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE for the possible file names.

Parameters:
paths - A String ArrayList containing all the possible paths where the settings files could be found.
See Also:
Constants

SettingsLoader

public SettingsLoader(String path,
                      ArrayList<String> files)
The constructor that takes as arguments the path and an ArrayList of possible file names.

Parameters:
path - A String containing the path where the settings files could be found.
files - A String ArrayList containing the possible names of the settings files

SettingsLoader

public SettingsLoader(String path)
The constructor that takes as argument the possible path. It uses the Constants declaration of INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE for the possible file names.

Parameters:
path - A String containing all the possible paths where the settings files could be found.
See Also:
Constants

SettingsLoader

public SettingsLoader(ArrayList<String> paths,
                      String file)
The constructor that takes as arguments an ArrayList of possible paths and the file name.

Parameters:
paths - A String ArrayList containing all the possible paths where the settings files could be found.
file - A String with the name of the settings file.

SettingsLoader

public SettingsLoader(boolean hierarchical,
                      ArrayList<String> files)
The constructor that takes as arguments an ArrayList of possible file names. It takes the possible paths from the SETTINGSPATH filed in the Constants class

Parameters:
files - A String ArrayList containing all the possible names of the settings files
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader(boolean hierarchical,
                      String file)
The constructor that takes as arguments the name of the settings file and the hierarchical flag. It takes the possible paths from the SETTINGSPATH filed in the Constants class

Parameters:
file - The name of the settings file
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader(boolean dummy1,
                      String file,
                      boolean dummy2)
The constructor that takes as arguments the name of the settings file and no hierarchical flag. It takes the possible paths from the SETTINGSPATH filed in the Constants class.

Parameters:
file - The name of the settings file
dummy1 - Dummy variable used only to create a different signature
dummy2 - Dummy variable used only to create a different signature

SettingsLoader

public SettingsLoader(boolean dummy1,
                      ArrayList<String> file,
                      boolean dummy2)
The constructor that takes as arguments the possible names of the settings file and no hierarchical flag. It takes the possible paths from the SETTINGSPATH filed in the Constants class.

Parameters:
file - The name of the settings file
dummy1 - Dummy variable used only to create a different signature
dummy2 - Dummy variable used only to create a different signature

SettingsLoader

public SettingsLoader(boolean hierarchical)
The constructor that takes the possible paths from the SETTINGSPATH filed in the Constants class and the possible names from the INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE.

Parameters:
hierarchical - A flag indicating whether the settings structure is hierarchical (true) or not (false)

SettingsLoader

public SettingsLoader()
The constructor that takes the possible paths from the SETTINGSPATH filed in the Constants class and the possible names from the INISETTINGSFILE, FSTABSETTINGSFILE and ZIPSETTINGSFILE.


SettingsLoader

public SettingsLoader(String path,
                      String file)
The constructor that takes as arguments the path and the file name.

Parameters:
path - A String with the path where the settings file could be found.
file - A String with the name of the settings file.