[jsword-devel] Patch for book stuff

Joe Walker jsword-devel@crosswire.org
Thu, 01 Apr 2004 07:20:48 +0100


Hi,

Thanks for this.
I'm not 100% sure about moving the method from OptionsAction to Books. 
The method is fairly specific to OptionsAction and there is a danger 
that we crowd Books with too many quick utility functions.

The changes to Books didn't apply cleanly so I'll have to spend a bit of 
time merging and it's past my bedtime, so I'll have to leave it to 
tomorrow. I'm out at a Bible reading group tomorrow eve, but I hope I'll 
get time afterwards.
Sorry,

Joe.

P.S. so past my bedtime that i forgot to send it! hope I'll get time 
later today.

DM Smith wrote:

> I have made a few more changes.
> I added isSupported to Backend and implemented it in each derived class. 
> This returns true if the backend is implemented.
> 
> I added isSupported(SwordBookMetaData sbmd) to ModuleType to have it 
> return whether it or its backend is supported.
> I modified SwordBookMetaData.isSupported to:
>    see if it has a name
>    see if it has a supported ModuleType (it used to just check to see 
> the ModuleType had a BookType)
>    see if it is locked
>    to output all the reasons the book is not supported. (I moved 
> diagnostics here from the ctor and from SwordInstaller)
> 
> I added more constants for HISTORY to ConfigEntry so that I could add 
> the diagnostic on unknown ConfigEntries to SBMD.
> 
> I changed the parsing in SBMD to be tolerant of the errors I mentioned 
> in an earlier e-mail.
> 
> I changed the writing of the SBMD to file to be a copy of the original.
> 
> I modified SwordInstaller
>    to not install a book if it is already installed (This fixes a bug)
>    by moving the check for locked into SBMD.isSupported
> 
> I changed APIexamples by adding a main to it and changing the book to 
> KJV (I could not find AV).
> 
> I also made numerous changes to Books. Basically, Books had two 
> different contracts/patterns. One of a class factory or utility class w/ 
> the static methods and the other of a singlton. It should use one or the 
> other. So I did the singleton.
> First, I made all the static methods except installed() to be member 
> methods.
> Likewise for all the static fields, except installed and log.
> This resulted in trivial changes to files which called the static 
> methods to use the installed() method.
> I moved the static initialization of the drivers into member methods and 
> called them from the constructor.
> As is my habit, I constructed fields in the constructor.
> I finished the synchronization of the class since some of the accessors 
> could be used at the same time as the modifiers.
> 
> I added getFullNameArray to Books because it seemed to belong ther and 
> not in OptionsAction
> 
> I changed the method getBookMetaData(String name) to check getInitials 
> as well. This is what was expected by APIExamples.
> 
> Finally, I merged Joe's latest changes to Books.
> 
> The zip file contains the patch and Books.java in case the patch does 
> not work.
> 
> _________________________________________________________________
> 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/