initParameters: Initialisation parameters

Initialisation parameters are name-value relations that define values for variables accessed by "name" from source code, e.g. Jsp or Java code The purpose of these relations is that values can be changed in the source code without editing the source code. The syntax and operation of these variable definitions is based on that used by Tomcat in its "web.xml" file with its "context-param" definitions. The Tomcat version of these has not been used, as Tomcat has a flat structure for its variables which are all held in the application's web.xml file, making this file hard to read and overly large. The system implemented here spreads initialisation parameters over a large number of files. There is one file, "defaultInitParameters.xml", that contains variables applied across the whole system and then any number of other files with initialistion paramaters for packages, sub-packages and individual Java objects with a hierarchical naming scheme. The name space is flat however, but with redefinitions of variables hiding earlier definitions. The Tomcat initialisation parameters are still used for a small number of variables as some variables are needed to be set before the "initParameter" system is available, i.e. in the "ApplicationListener" that executes when Tomcat starts an application

The syntax of initialisation parameters is exactly the same as that used by Tomcat for its "context-param" parameters:-


        
    <context-param>
        <param-name>userBannerString</param-name>
        <param-value>online Coursework</param-value>
    </context-param>
        
  
. This associates the string "online Coursework" with the variable name "userBannerString".

The value "online Coursework" can be obtained by looking up the variable name in current list of variable definitions:-


        
        String userBanner = initParametersList.findParameter("userBannerString") ;
        
  
.

The hierarchical naming scheme for defining initParameter files and search order is inconsistent and slightly bizarre. It is most straight forward for those files associated with the user interface and with question files. For these the file names are the package paths with "." characters replaced by "_" characters. Thus, the initialisation parameter file defined for the Java object, user.userInterface.EMail.java is called user_userInterface_EMail_java.xml. An initialisation parameter file associated with the Java package user.userInterface would be called user_userInterface.xml, while one associated with the Java package user would be called user.xml. When the Java object user.userInterface.EMail.java is instantiated for use, all 3 initialisation files, user.xml, user_userInterface.xml, and user_userInterface_EMail_java.xml are read into separate hash tables are become part of the initialisation parameters list for the Object instance: not all these files have to exist. When the object code goes to look a variable name, the hash tables are searched in reverse order for the name, using the first reference found. Thus the search order would be first the names from user_userInterface_EMail_java.xml and would last search the names defined in "defaultInitParameters.xml". This allows later variable definitions to hide earlier more global less Object-specific variable definitions.

Other references to initialisation parameters can be found in and .