[jsword-svn]
jsword/java/jsword/org/crosswire/jsword/book/install/sword s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Fri Mar 18 18:56:49 MST 2005
Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/sword
In directory www.crosswire.org:/tmp/cvs-serv10359/java/jsword/org/crosswire/jsword/book/install/sword
Modified Files:
HttpSwordInstaller.java FtpSwordInstaller.java
AbstractSwordInstaller.java
Log Message:
Made Book the primary interface to a module and put BookMetaData within it. All of BookMetaData is accessible through the Book interface.
Index: AbstractSwordInstaller.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AbstractSwordInstaller.java 8 Mar 2005 02:31:45 -0000 1.7
--- AbstractSwordInstaller.java 19 Mar 2005 01:56:47 -0000 1.8
***************
*** 22,27 ****
import org.crosswire.common.util.NetUtil;
import org.crosswire.common.util.Reporter;
import org.crosswire.jsword.book.BookDriver;
- import org.crosswire.jsword.book.BookMetaData;
import org.crosswire.jsword.book.Books;
import org.crosswire.jsword.book.basic.AbstractBookList;
--- 22,27 ----
import org.crosswire.common.util.NetUtil;
import org.crosswire.common.util.Reporter;
+ import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookDriver;
import org.crosswire.jsword.book.Books;
import org.crosswire.jsword.book.basic.AbstractBookList;
***************
*** 29,32 ****
--- 29,33 ----
import org.crosswire.jsword.book.install.Installer;
import org.crosswire.jsword.book.sword.ConfigEntry;
+ import org.crosswire.jsword.book.sword.SwordBook;
import org.crosswire.jsword.book.sword.SwordBookDriver;
import org.crosswire.jsword.book.sword.SwordBookMetaData;
***************
*** 75,85 ****
* @see org.crosswire.jsword.book.install.Installer#isNewer(org.crosswire.jsword.book.BookMetaData)
*/
! public boolean isNewer(BookMetaData bmd)
{
- SwordBookMetaData sbmd = (SwordBookMetaData) bmd;
File dldir = SwordBookDriver.getDownloadDir();
! File confdir = new File(dldir, SwordConstants.DIR_CONF);
! File conf = new File(confdir, sbmd.getDiskName() + SwordConstants.EXTENSION_CONF);
URL configurl = null;
--- 76,92 ----
* @see org.crosswire.jsword.book.install.Installer#isNewer(org.crosswire.jsword.book.BookMetaData)
*/
! public boolean isNewer(Book book)
{
File dldir = SwordBookDriver.getDownloadDir();
! SwordBookMetaData sbmd = (SwordBookMetaData) book.getBookMetaData();
! File conf = new File(dldir, sbmd.getConfPath());
!
! // The conf may not exist in our download dir.
! // In this case we say that it should not be downloaded again.
! if (!conf.exists())
! {
! return false;
! }
URL configurl = null;
***************
*** 96,107 ****
}
! URL remote = toRemoteURL(bmd);
return NetUtil.isNewer(remote, configurl);
}
/* (non-Javadoc)
! * @see org.crosswire.jsword.book.BookList#getBookMetaDatas()
*/
! public List getBookMetaDatas()
{
try
--- 103,114 ----
}
! URL remote = toRemoteURL(book);
return NetUtil.isNewer(remote, configurl);
}
/* (non-Javadoc)
! * @see org.crosswire.jsword.book.BookList#getBooks()
*/
! public List getBooks()
{
try
***************
*** 126,146 ****
/* (non-Javadoc)
! * @see org.crosswire.jsword.book.install.Installer#install(org.crosswire.jsword.book.BookMetaData)
*/
! public void install(BookMetaData bmd)
{
- if (!(bmd instanceof SwordBookMetaData))
- {
- assert false;
- return;
- }
-
// Is the book already installed? Then nothing to do.
! if (Books.installed().getBookMetaData(bmd.getName()) != null)
{
return;
}
! final SwordBookMetaData sbmd = (SwordBookMetaData) bmd;
// So now we know what we want to install - all we need to do
--- 133,147 ----
/* (non-Javadoc)
! * @see org.crosswire.jsword.book.install.Installer#install(org.crosswire.jsword.book.Book)
*/
! public void install(Book book)
{
// Is the book already installed? Then nothing to do.
! if (Books.installed().getBook(book.getBookMetaData().getName()) != null)
{
return;
}
! final SwordBookMetaData sbmd = (SwordBookMetaData) book.getBookMetaData();
// So now we know what we want to install - all we need to do
***************
*** 219,223 ****
* @see org.crosswire.jsword.book.install.Installer#downloadSearchIndex(org.crosswire.jsword.book.BookMetaData, java.net.URL)
*/
! public void downloadSearchIndex(BookMetaData bmd, URL localDest) throws InstallException
{
Job job = JobManager.createJob(Msg.JOB_DOWNLOADING.toString(), Thread.currentThread(), false);
--- 220,224 ----
* @see org.crosswire.jsword.book.install.Installer#downloadSearchIndex(org.crosswire.jsword.book.BookMetaData, java.net.URL)
*/
! public void downloadSearchIndex(Book book, URL localDest) throws InstallException
{
Job job = JobManager.createJob(Msg.JOB_DOWNLOADING.toString(), Thread.currentThread(), false);
***************
*** 225,229 ****
try
{
! download(job, directory + '/' + SEARCH_DIR, bmd.getInitials() + ZIP_SUFFIX, localDest);
}
catch (Exception ex)
--- 226,230 ----
try
{
! download(job, directory + '/' + SEARCH_DIR, book.getInitials() + ZIP_SUFFIX, localDest);
}
catch (Exception ex)
***************
*** 292,299 ****
SwordBookMetaData sbmd = new SwordBookMetaData(rin, internal);
sbmd.setDriver(fake);
if (sbmd.isSupported())
{
! entries.put(sbmd.getName(), sbmd);
}
}
--- 293,301 ----
SwordBookMetaData sbmd = new SwordBookMetaData(rin, internal);
sbmd.setDriver(fake);
+ Book book = new SwordBook(sbmd, null);
if (sbmd.isSupported())
{
! entries.put(book.getName(), book);
}
}
Index: HttpSwordInstaller.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** HttpSwordInstaller.java 6 Mar 2005 20:21:47 -0000 1.18
--- HttpSwordInstaller.java 19 Mar 2005 01:56:47 -0000 1.19
***************
*** 11,17 ****
import org.crosswire.common.util.IOUtil;
import org.crosswire.common.util.NetUtil;
! import org.crosswire.jsword.book.BookMetaData;
import org.crosswire.jsword.book.install.InstallException;
- import org.crosswire.jsword.book.sword.SwordBookMetaData;
/**
--- 11,16 ----
import org.crosswire.common.util.IOUtil;
import org.crosswire.common.util.NetUtil;
! import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.install.InstallException;
/**
***************
*** 53,69 ****
* @see org.crosswire.jsword.book.install.Installer#toURL(org.crosswire.jsword.book.BookMetaData)
*/
! public URL toRemoteURL(BookMetaData bmd)
{
- if (!(bmd instanceof SwordBookMetaData))
- {
- assert false;
- return null;
- }
-
- SwordBookMetaData sbmd = (SwordBookMetaData) bmd;
-
try
{
! return new URL(NetUtil.PROTOCOL_HTTP, host, directory + '/' + PACKAGE_DIR + '/' + sbmd.getInitials() + ZIP_SUFFIX);
}
catch (MalformedURLException ex)
--- 52,60 ----
* @see org.crosswire.jsword.book.install.Installer#toURL(org.crosswire.jsword.book.BookMetaData)
*/
! public URL toRemoteURL(Book book)
{
try
{
! return new URL(NetUtil.PROTOCOL_HTTP, host, directory + '/' + PACKAGE_DIR + '/' + book.getBookMetaData().getInitials() + ZIP_SUFFIX);
}
catch (MalformedURLException ex)
Index: FtpSwordInstaller.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/sword/FtpSwordInstaller.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** FtpSwordInstaller.java 6 Mar 2005 20:21:47 -0000 1.11
--- FtpSwordInstaller.java 19 Mar 2005 01:56:47 -0000 1.12
***************
*** 12,15 ****
--- 12,16 ----
import org.crosswire.common.util.Logger;
import org.crosswire.common.util.NetUtil;
+ import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookMetaData;
import org.crosswire.jsword.book.install.InstallException;
***************
*** 53,58 ****
* @see org.crosswire.jsword.book.install.Installer#toURL(org.crosswire.jsword.book.BookMetaData)
*/
! public URL toRemoteURL(BookMetaData bmd)
{
if (!(bmd instanceof SwordBookMetaData))
{
--- 54,60 ----
* @see org.crosswire.jsword.book.install.Installer#toURL(org.crosswire.jsword.book.BookMetaData)
*/
! public URL toRemoteURL(Book book)
{
+ BookMetaData bmd = book.getBookMetaData();
if (!(bmd instanceof SwordBookMetaData))
{
More information about the jsword-svn
mailing list