AbstractBookDriver.java |
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.basic; 21 22 import org.crosswire.jsword.JSOtherMsg; 23 import org.crosswire.jsword.book.Book; 24 import org.crosswire.jsword.book.BookDriver; 25 import org.crosswire.jsword.book.BookException; 26 27 /** 28 * The AbstractBookDriver class implements some BibleDriver methods, making a 29 * simple read-only BibleDriver. 30 * 31 * @see gnu.lgpl.License The GNU Lesser General Public License for details. 32 * @author Joe Walker 33 */ 34 public abstract class AbstractBookDriver implements BookDriver { 35 /* 36 * (non-Javadoc) 37 * 38 * @see org.crosswire.jsword.book.BookDriver#isWritable() 39 */ 40 public boolean isWritable() { 41 return false; 42 } 43 44 /* 45 * (non-Javadoc) 46 * 47 * @see 48 * org.crosswire.jsword.book.BookDriver#create(org.crosswire.jsword.book 49 * .Book, org.crosswire.jsword.book.events.WorkListener) 50 */ 51 public Book create(Book source) throws BookException { 52 throw new BookException(JSOtherMsg.lookupText("This Book is read-only.")); 53 } 54 55 /* 56 * (non-Javadoc) 57 * 58 * @see 59 * org.crosswire.jsword.book.BookDriver#isDeletable(org.crosswire.jsword 60 * .book.Book) 61 */ 62 public boolean isDeletable(Book dead) { 63 return false; 64 } 65 66 /* 67 * (non-Javadoc) 68 * 69 * @see 70 * org.crosswire.jsword.book.BookDriver#delete(org.crosswire.jsword.book 71 * .Book) 72 */ 73 public void delete(Book dead) throws BookException { 74 throw new BookException(JSOtherMsg.lookupText("This Book is read-only.")); 75 } 76 77 /* 78 * (non-Javadoc) 79 * 80 * @see org.crosswire.jsword.book.BookProvider#getFirstBook() 81 */ 82 public Book getFirstBook() { 83 Book[] books = getBooks(); 84 return books == null || books.length == 0 ? null : books[0]; 85 } 86 } 87