fr.tireme.shared.param
Class Parameters

java.lang.Object
  extended by fr.tireme.shared.param.Parameters

public class Parameters
extends java.lang.Object

Responsible of managing external parameters. The following DTD is used:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE parameters [
<!ELEMENT parameters (section+|config+)>
<!ELEMENT config (section+)>
<!ELEMENT section (param+)>
<!ATTLIST section type CDATA #REQUIRED >
<!ELEMENT param (#PCDATA)>
<!ATTLIST param type CDATA #REQUIRED >
]>

The external file is called config.xml and is found within a data directory of the application directory, within a program directory.

Version:
2.0, november 2003
Author:
Pierre Attar

Constructor Summary
Parameters(java.lang.String enVarName, java.lang.String appName, int generatesFor)
          Constructor for the Parameters object using the default language
Parameters(java.lang.String interfaceLanguage, java.lang.String enVarName, java.lang.String appName, java.io.File paramFile, int generatesFor)
          Constructor for the Parameters object using a specific language
Parameters(java.lang.String interfaceLanguage, java.lang.String enVarName, java.lang.String appName, int generatesFor)
          Constructor for the Parameters object using a specific language
 
Method Summary
 Configuration addConfig(org.w3c.dom.Element elemToAdd)
          Create a configuration and makes it the current one
 Configuration addConfig(org.w3c.dom.Element elemToAdd, boolean manageSelection)
          Create a configuration and makes it the current one depending on parameter
 Configuration addConfig(java.lang.String configToAddName)
          Create a new configuration entry
 Configuration copyConfig(java.lang.String fromConfName, java.lang.String newConfName)
          Make a copy of a configuration
 void deleteConfig(java.lang.String confToDelete)
          Delete a configuration section
 java.io.File getApplDir()
          Gets the applDir attribute of the Parameters object
 java.io.File getApplDir(java.lang.String enVarName, java.lang.String appName)
          Find and validate the application directory
 Configuration getConfig(java.lang.String confName)
          Gets the configFromName attribute of the Parameters object
 java.lang.String[] getConfigList()
          Gets the configList attribute of the Parameters object
 java.lang.String getConfigName()
          Gets the configName attribute of the Parameters object
 Configuration getCurrentConfig()
          Gets the current configuration
 org.w3c.dom.Document getDocument()
          Gets the document attribute of the Parameters object
 java.lang.String getParamFileName()
          Gets the parameter file path attribute of the Parameters object
 boolean hasConfig(java.lang.String confName)
          Description of the Method
 void saveParameters()
          Save actual parameter set
 void setCurrentConfig(Configuration conf)
          Sets the currentConfig attribute of the Parameters object
 void setCurrentConfig(java.lang.String confName)
          Sets the currentConfig attribute of the Parameters object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters(java.lang.String enVarName,
                  java.lang.String appName,
                  int generatesFor)
           throws ParamException
Constructor for the Parameters object using the default language

Parameters:
enVarName - environment variable where to find the config.xml file
appName - name of the application for being able to find the right directory in the envVarName. May ne null if not needed
generatesFor - either Symbols.SCHEMADOC_MANAGEMENT or Symbols.ANALDOC_MANAGEMENT
Throws:
ParamException - Description of Exception

Parameters

public Parameters(java.lang.String interfaceLanguage,
                  java.lang.String enVarName,
                  java.lang.String appName,
                  java.io.File paramFile,
                  int generatesFor)
           throws ParamException
Constructor for the Parameters object using a specific language

Parameters:
interfaceLanguage - language of the user interface for messages
enVarName - environment variable where to find the config.xml file
appName - name of the application for being able to find the right directory in the envVarName. May ne null if not needed
paramFile - File
generatesFor - either Symbols.SCHEMADOC_MANAGEMENT or Symbols.ANALDOC_MANAGEMENT
Throws:
ParamException - Description of Exception

Parameters

public Parameters(java.lang.String interfaceLanguage,
                  java.lang.String enVarName,
                  java.lang.String appName,
                  int generatesFor)
           throws ParamException
Constructor for the Parameters object using a specific language

Parameters:
interfaceLanguage - language of the user interface for messages
enVarName - environment variable where to find the config.xml file
appName - name of the application for being able to find the right directory in the envVarName. May ne null if not needed
generatesFor - either Symbols.SCHEMADOC_MANAGEMENT or Symbols.ANALDOC_MANAGEMENT
Throws:
ParamException - Description of Exception
Method Detail

addConfig

public Configuration addConfig(org.w3c.dom.Element elemToAdd)
                        throws ParamException
Create a configuration and makes it the current one

Parameters:
elemToAdd - The configuration: ned to be a config node, conforming to the public DTD for Config
Returns:
Description of the Returned Value
Throws:
ParamException

addConfig

public Configuration addConfig(org.w3c.dom.Element elemToAdd,
                               boolean manageSelection)
                        throws ParamException
Create a configuration and makes it the current one depending on parameter

Parameters:
elemToAdd - The configuration: ned to be a config node, conforming to the public DTD for Config
manageSelection - do we want it to become selected or does it remains as it it defined in the element added
Returns:
Description of the Returned Value
Throws:
ParamException

addConfig

public Configuration addConfig(java.lang.String configToAddName)
                        throws ParamException
Create a new configuration entry

Parameters:
configToAddName - The feature to be added to the Config attribute
Returns:
Description of the Returned Value
Throws:
ParamException - Description of Exception

copyConfig

public Configuration copyConfig(java.lang.String fromConfName,
                                java.lang.String newConfName)
                         throws ParamException
Make a copy of a configuration

Parameters:
fromConfName - Description of Parameter
newConfName - Description of Parameter
Returns:
created configuration
Throws:
ParamException - Description of Exception

deleteConfig

public void deleteConfig(java.lang.String confToDelete)
                  throws ParamException
Delete a configuration section

Parameters:
confToDelete - Name of the configuration to delete
Throws:
ParamException - Description of Exception

getApplDir

public java.io.File getApplDir()
Gets the applDir attribute of the Parameters object

Returns:
The applDir value

getApplDir

public java.io.File getApplDir(java.lang.String enVarName,
                               java.lang.String appName)
                        throws ParamException
Find and validate the application directory

Parameters:
enVarName - Where is the main application directory
appName - application name, may be null if the envVarName is enough
Returns:
Description of the Returned Value
Throws:
ParamException - Description of Exception

getConfig

public Configuration getConfig(java.lang.String confName)
                        throws ParamException
Gets the configFromName attribute of the Parameters object

Parameters:
confName - Description of Parameter
Returns:
The configFromName value
Throws:
ParamException - Description of Exception

getConfigList

public java.lang.String[] getConfigList()
Gets the configList attribute of the Parameters object

Returns:
The configList value

getConfigName

public java.lang.String getConfigName()
Gets the configName attribute of the Parameters object

Returns:
The configName value

getCurrentConfig

public Configuration getCurrentConfig()
Gets the current configuration

Returns:
The configName value

getDocument

public org.w3c.dom.Document getDocument()
Gets the document attribute of the Parameters object

Returns:
The document value

getParamFileName

public java.lang.String getParamFileName()
Gets the parameter file path attribute of the Parameters object

Returns:
file path

hasConfig

public boolean hasConfig(java.lang.String confName)
Description of the Method

Parameters:
confName - Description of Parameter
Returns:
Description of the Returned Value

saveParameters

public void saveParameters()
                    throws StandardException
Save actual parameter set

Throws:
StandardException

setCurrentConfig

public void setCurrentConfig(Configuration conf)
Sets the currentConfig attribute of the Parameters object

Parameters:
conf - The new currentConfig value

setCurrentConfig

public void setCurrentConfig(java.lang.String confName)
                      throws ParamException
Sets the currentConfig attribute of the Parameters object

Parameters:
confName - The new currentConfig value
Throws:
ParamException - Description of Exception