Unidata IDV Workshop for version 6.3 > Java Developer Topics > IDV Startup
5.2.0 Initialization and Properties
The IDV starts up with the following sequence:
- The starting point (e.g., main) of the IDV is
an application specific class derived
from ucar.unidata.idv.IntegratedDataViewer, e.g.,
ucar.unidata.apps.example.ExampleIdv.
- When the IDV starts up a singleton instance of this
main class is created and the IntegratedDataViewer.init method is called.
public static void main(String[] args) throws Exception {
LogUtil.configure();
ExampleIdv idv = new ExampleIdv(args);
}
- The application is configured by first defining an initial set of
property files in the code.
//Put the default property file in the list before we parse args
getArgsManager().propertyFiles.add(
"/ucar/unidata/idv/resources/idv.properties");
initPropertyFiles(getArgsManager().propertyFiles);
The initPropertyFiles method is called to allow subclasses to modify the list.
e.g., from ExampleIdv:
public void initPropertyFiles(List files) {
/*
files.clear();
files.add("/ucar/unidata/apps/example/example.properties");
*/
}
- The command line arguments are parsed by the ArgsManager.
- The class, StateManager, is used to initialize the state.
- Any property files on the command line are added to the list.
- All of the properties are merged together.
- A second pass is done loading any any property files
that were defined by the idv.properties property.
- Then any -Dname=value command line arguments are added
to the properties.
- Default system properties file.
- Let's look at the default system properties file: idv.properties.
- Note: the ".proplabel", ".propdesc", etc., are used in the Plugin Creator.
- The idv.properties property defines the other properties files to use:
idv.properties = %APPPATH%/idv.properties;%SITEPATH%/idv.properties;%USERPATH%/idv.properties;
- The macros %APPPATH%, %SITEPATH%, %USERPATH% and %IDVPATH% are defined as:
## %USERPATH% The file system path of the user's .unidata/idv/application directory
## %SITEPATH% If defined (usually by the -sitepath argument) the directory path
## or url of where to find site resources
## %IDVPATH% The internal (to the jars) /ucar/unidata/idv/resources path
## %APPPATH% The value of the idv.resourcepath property or the package of the IDV class
- Let's go change the example idv.properties file.
- cd to /home/idv/idv/ucar/unidata/apps/example/resources
- Copy the file: idv.properties up one level to
ucar/unidata/apps/example. This is the APPPATH.
- Run the Example Idv (runExample.sh)
Unidata IDV Workshop for version 6.3 > Java Developer Topics > IDV Startup