17
16
import org.crosswire.jsword.passage.Passage;
18
17
import org.crosswire.jsword.passage.PassageFactory;
19
18
import org.crosswire.jsword.passage.Verse;
20
import org.crosswire.common.config.Config;
21
import org.crosswire.common.config.choices.TextViewChoice;
22
19
import org.crosswire.common.util.LogicError;
23
20
import org.crosswire.common.util.NetUtil;
26
* The VersewiseMutableBook class makes it easier to implement
27
* MutableBook by splitting the job up into a Verse by Verse effort.
28
* setDocument() is called once for every verse in the Bible in order,
29
* and flush() is called when done.
31
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
32
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
33
* Distribution Licence:<br />
34
* Project B is free software; you can redistribute it
35
* and/or modify it under the terms of the GNU General Public License,
36
* version 2 as published by the Free Software Foundation.<br />
37
* This program is distributed in the hope that it will be useful,
38
* but WITHOUT ANY WARRANTY; without even the implied warranty of
39
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
40
* General Public License for more details.<br />
41
* The License is available on the internet
42
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
43
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
44
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
45
* The copyright to this program is held by it's authors.
46
* </font></td></tr></table>
47
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
48
* @see <{docs.Licence}>
23
* The VersewiseMutableBook class makes it easier to implement
24
* MutableBook by splitting the job up into a Verse by Verse effort.
25
* setDocument() is called once for every verse in the Bible in order,
26
* and flush() is called when done.
28
* <p><table border='1' cellPadding='3' cellSpacing='0'>
29
* <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
31
* Distribution Licence:<br />
32
* JSword is free software; you can redistribute it
33
* and/or modify it under the terms of the GNU General Public License,
34
* version 2 as published by the Free Software Foundation.<br />
35
* This program is distributed in the hope that it will be useful,
36
* but WITHOUT ANY WARRANTY; without even the implied warranty of
37
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38
* General Public License for more details.<br />
39
* The License is available on the internet
40
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
41
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
42
* MA 02111-1307, USA<br />
43
* The copyright to this program is held by it's authors.
44
* </font></td></tr></table>
46
* @author Joe Walker [joe at eireneh dot com]
52
49
public abstract class VersewiseBible extends AbstractWritableBible
55
* Write the XML to disk. Children will almost certainly want to
57
* @param verse The verse to write
58
* @param text The data to write
52
* Write the XML to disk. Children will almost certainly want to
54
* @param verse The verse to write
55
* @param text The data to write
60
57
public abstract void setDocument(BibleData text) throws BookException;
63
* Save a list of found words. Children will probably want to
65
* @param word The word to write
66
* @param ref The data to write
60
* Save a list of found words. Children will probably want to
62
* @param word The word to write
63
* @param ref The data to write
68
65
public abstract void foundPassage(String word, Passage ref) throws BookException;
71
* Setup the Version information
72
* @param version The version that this Bible is becoming
68
* Setup the Version information
69
* @param version The version that this Bible is becoming
74
71
public abstract void setVersion(BookMetaData version);
77
* Flush the data written to disk
74
* Flush the data written to disk
79
76
public void flush() throws BookException
84
* Get a URL in which we can save a generation report
85
* @return A directory URL into which we can save files
81
* Get a URL in which we can save a generation report
82
* @return A directory URL into which we can save files
87
84
public abstract URL getBaseURL();
90
* This returns a simple Config, that displays the generation notes
92
public Config getProperties() throws BookException
96
URL dir = NetUtil.lengthenURL(getBaseURL(), "generate.log");
98
Config config = new Config("Bible Settings");
99
config.add("Notes.Log", new TextViewChoice(dir));
103
catch (MalformedURLException ex)
105
throw new BookException("book_prop", ex);
110
* Read from the given source version to generate ourselves
111
* @param version The source
87
* Read from the given source version to generate ourselves
88
* @param version The source
113
90
public void generate(Bible version) throws BookException