[jsword-devel] SwordBookMetaData
DM Smith
jsword-devel@crosswire.org
Sat, 27 Mar 2004 11:16:29 -0500
It really was not a biggie, but I wanted to get rid of the trailing comma in
the tree of installed and installable books in the books dialog.
I found that it is a simple change to getFullName().
But one thing got me looking at another, and that, yet another.
First thing I noticed was that the listing of the BookMetaData when a book
is selected seems to be randomly ordered. I traced this down to the use of
Properties, which is unordered. So I found that in Java 1.4 there is a new
Map called LinkedHashMap that will provide its keys or values in insertion
order. If this were used to maintain the properties then they could be
listed as they were in the file.
I found that there is one other implementation of BookMetaData, called
DefaultBookMetaData. I examined the use of the Properties object in it and
found that it has a problem in the various set routines. It tries to "put"
the value in the properties as objects and not strings, which is stongly
discouraged in the documentation. And the object stored against a key is
sometimes a string and sometimes an other kind of object. The access of the
value would be suspect with that. If it were expected to be a string when it
is not or is expected to be a Date when it is a string may cause a runtime
error. In tracing the use of DefaultBookMetaData, it seemed to be in classes
intended for future use.
In looking at how the BookMetaData properties were used I could not find a
real use beyond displaying the contents. Every KEY_* stored in it was double
stored in a member variable. My guess is that the various KEY_* are present
for a future use.
I also found the following about SwordBookMetaData *.conf files:
The first line is blank. Is there any reason to store that?
The second line is of the form [KJV]. This looks like a MS windows style
section identifier. Is this really needed to be kept? I think that if we are
trying to preserve the output, then yes.
Some keys are repeated and are simply concatenated together in the
properties. Should these be separated?
Some lines look like continuation lines. (See Webster's Revised Unabridged
Dictionary of the English Language.) The key line ends with a \ which seems
to indicate that the next line should be concatenated, if it is not of the
form key=value.
Anyway, I am working on some changes to this and will send a patch later,
maybe tomorrow.
_________________________________________________________________
Find a broadband plan that fits. Great local deals on high-speed Internet
access.
https://broadband.msn.com/?pgmarket=en-us/go/onm00200360ave/direct/01/