1   /**
2    * Distribution License:
3    * JSword is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU Lesser General Public License, version 2.1 or later
5    * as published by the Free Software Foundation. This program is distributed
6    * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
7    * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU Lesser General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *      http://www.gnu.org/copyleft/lgpl.html
12   * or by writing to:
13   *      Free Software Foundation, Inc.
14   *      59 Temple Place - Suite 330
15   *      Boston, MA 02111-1307, USA
16   *
17   * © CrossWire Bible Society, 2005 - 2016
18   *
19   */
20  package org.crosswire.jsword.book;
21  
22  /**
23   * The BibleDriver class allows creation of new Books.
24   * 
25   * @see gnu.lgpl.License The GNU Lesser General Public License for details.
26   * @author Joe Walker
27   */
28  public interface BookDriver extends BookProvider {
29      /**
30       * Is this name capable of creating writing data in the correct format as
31       * well as reading it?
32       * 
33       * @return true/false to indicate ability to write data
34       */
35      boolean isWritable();
36  
37      /**
38       * Create a new Book based on a source.
39       * 
40       * @param source
41       *            The Book from which to copy data
42       * @return The new WritableBible
43       * @exception BookException
44       *                If the name is not valid
45       */
46      Book create(Book source) throws BookException;
47  
48      /**
49       * Is this book able to be deleted.
50       * 
51       * @param dead
52       *            the book to be deleted
53       * @return whether the book can be deleted.
54       */
55      boolean isDeletable(Book dead);
56  
57      /**
58       * Delete this Book from the system. Take care with this method for obvious
59       * reasons. For most implementations of Book etc, this method will throw up
60       * because most will be read-only.
61       * 
62       * @param dead
63       *            the book to be deleted
64       * @throws BookException
65       *             If the Book can't be deleted.
66       */
67      void delete(Book dead) throws BookException;
68  
69      /**
70       * A short name for this BookDriver
71       * 
72       * @return a short name for this BookDriver
73       */
74      String getDriverName();
75  }
76