sul-dlss-labs / ld4p-marc21-to-xml

convert marc21 data into marcxml, with authority ids resolved to URIs via Symphony
Other
0 stars 1 forks source link

use properties file for output dir? #14

Open ndushay opened 7 years ago

ndushay commented 7 years ago

Note that the code (java/src/main/edu/stanford/MarcToXML.java - lines 74 and 160) is looking for a value from an environment variable, LD4P_MARCXML. This is actually a poorly named variable, as it is really the output directory to receive the marcxml files.

The java way is to use a java property that can be set at the command line when executing code and/or via a java properties file.

The code could ship with a default properties file with settings that work in a local (laptop) installation; there should be a shared_config branch for that contains a properties file named something like ld4p-marc21-to-xml that contains appropriate settings for our scripts.

Note that at the time of writing this ticket, we hardcode the value in our only working script:

In fact, there are three FIXME comments in that script and they all pertain to this notion of properties.

dazza-codes commented 7 years ago

The MarcToXML class accepts command line arguments for this parameter. That is a valid pattern and it is used by the shell scripts that call this class. (It accepts several command line options.)

The default value for an output path is still a concern. An ENV value is used as a fallback position but could be removed or replaced with something else. A hard-coded default value for this in the java code does not make a lot of sense, because it depends entirely on the file system the code runs on. A possible default that might work on any system is to create a temp directory, as the unit tests do. But only use such a default temp directory when no command line arg is given. If all of this is nonsense, then ensure the command line arg is required or raise an exception.