Directory Structure
Installation Directory
Current Configuration
Currently Argo contains definitions of certain directories.
These are calculated at execution time and may be viewed on the
Environment
tab under the menu selection
Edit -> Settings.
The first three values shown in the list
(argo.root, argo.home, and argo.ext.dir)
are calculated.
These are currently defined as follows:
-
argo.root
is the location that the Argo code is loaded from.
This could be either a jar file or a directory.
-
argo.home
is the directory which contains argo.root.
-
argo.ext.dir
is a directory named ext in argo.home.
The following java fragment
from org.argouml.application.modules.ModuleLoader
calculates argo.root:
String extForm = org.argouml.application.Main.class.getResource(Argo.ARGOINI).toExternalForm();
argoRoot = extForm.substring(0, extForm.length()-Argo.ARGOINI.length());
Proposed Configuration
Rather than computing the value for argo.home,
ArgoUML should determine that location
from a system argument
passed on the command line,
or from a property file located in a "well-known" location.
These "well-known" locations would be selected from
the directories provided by the Java run-time through the
java.lang.System.getProperty(key) function.
These are:
- java.home (Java installation directory)
- user.dir (User's current working directory)
- user.home (User's home directory)
(Definitions of these properties are found under
java.lang.System.getProperties().)
argo.root would become obsolete,
and its value would only be used internally
if argo.home needed to be calculated
because it was not otherwise provided.
The initialization process would then become:
-
Check if argo.home was provided on the command line.
-
If argo.home has not been set yet,
attempt to retrieve its value from the property file
${java.home}/lib/argouml.initialization.properties.
-
If argo.home has not been set yet,
attempt to retrieve its value from the property file
${user.home}/lib/argouml.initialization.properties.
-
If argo.home has not been set yet,
calculate its value as currently being done,
but without exposing argo.root.
Note: We do not attempt to look in user.dir
since this could cause more issues than it solves.
This approach seems to provide sufficient flexibility
and operating system independence.
Additionally, the property file search approach
should allow continued support
for running ArgoUML under Java Web Start,
which does not currently allow users to add command line arguments.
Developers (and other fools)
could easily maintain multiple executable versions of Argo
on their systems
by using multiple startup scripts
each pointing to a different argo.home.
The tag "developer_snapshot" contained in build.xml
should be changed to "install",
and determine the location of argo.home
in a similar manner,
but also checking the directory
named by the ant built-in property basedir
for the file argouml.initialization.properties.
Example of proposed installed directory structure
Thus a typical installation on a *nix system
might have the following directory structure.
The software would be installed
in the /usr/share/argouml directory.
/usr/share/argouml/bin
/usr/share/argouml/lib
/usr/share/argouml/lib/ext
argo.home would be /usr/share/argouml.
argo.ext.dir would be /usr/share/argouml/lib/ext.
The files contained in argo.home/bin would be scripts
specialized for the installation
(with -Dargo.home=/usr/share/argouml on the java command, for example),
and could be copied to any directory
(such as /usr/local/bin) and executed directly.
|