[jsword-svn] r983 - in trunk/jsword/src/main/java/org/crosswire/jsword: . book book/basic book/index book/query book/query/basic book/search book/search/lucene book/sword index index/basic util

dmsmith at crosswire.org dmsmith at crosswire.org
Mon Jan 23 12:11:33 MST 2006


Author: dmsmith
Date: 2006-01-23 12:10:49 -0700 (Mon, 23 Jan 2006)
New Revision: 983

Added:
   trunk/jsword/src/main/java/org/crosswire/jsword/index/
   trunk/jsword/src/main/java/org/crosswire/jsword/index/Index.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.properties
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatus.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusListener.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/basic/
   trunk/jsword/src/main/java/org/crosswire/jsword/index/package.html
Removed:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/Index.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.properties
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManagerFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatus.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusEvent.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusListener.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/basic/
   trunk/jsword/src/main/java/org/crosswire/jsword/book/index/package.html
Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/Query.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndNotQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BaseQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BlurQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/NullQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/OrQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/RangeQuery.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/search/Searcher.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/search/SearcherFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndex.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndexManager.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneSearcher.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/basic/AbstractIndex.java
   trunk/jsword/src/main/java/org/crosswire/jsword/util/IndexDownloader.java
Log:
new home for index interface

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -23,8 +23,8 @@
 
 import java.util.Map;
 
-import org.crosswire.jsword.book.index.IndexStatus;
-import org.crosswire.jsword.book.index.IndexStatusListener;
+import org.crosswire.jsword.index.IndexStatus;
+import org.crosswire.jsword.index.IndexStatusListener;
 import org.jdom.Document;
 
 /**
@@ -160,14 +160,14 @@
 
     /**
      * Has anyone generated a search index for this Book?
-     * @see org.crosswire.jsword.book.index.IndexManager
+     * @see org.crosswire.jsword.index.IndexManager
      */
     IndexStatus getIndexStatus();
 
     /**
      * This method does not alter the index status, however it is for Indexers
      * that are responsible for indexing and have changed the status themselves.
-     * @see org.crosswire.jsword.book.index.IndexManager
+     * @see org.crosswire.jsword.index.IndexManager
      */
     void setIndexStatus(IndexStatus status);
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -30,12 +30,12 @@
 import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.book.BookMetaData;
 import org.crosswire.jsword.book.FeatureType;
-import org.crosswire.jsword.book.index.IndexStatus;
-import org.crosswire.jsword.book.index.IndexStatusListener;
 import org.crosswire.jsword.book.search.SearchRequest;
 import org.crosswire.jsword.book.search.Searcher;
 import org.crosswire.jsword.book.search.SearcherFactory;
 import org.crosswire.jsword.book.search.basic.DefaultSearchRequest;
+import org.crosswire.jsword.index.IndexStatus;
+import org.crosswire.jsword.index.IndexStatusListener;
 import org.crosswire.jsword.passage.Key;
 import org.jdom.Document;
 
@@ -245,7 +245,7 @@
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#removeIndexStatusListener(org.crosswire.jsword.book.index.IndexStatusListener)
+     * @see org.crosswire.jsword.book.BookMetaData#removeIndexStatusListener(org.crosswire.jsword.index.IndexStatusListener)
      */
     public void removeIndexStatusListener(IndexStatusListener li)
     {
@@ -253,7 +253,7 @@
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#addIndexStatusListener(org.crosswire.jsword.book.index.IndexStatusListener)
+     * @see org.crosswire.jsword.book.BookMetaData#addIndexStatusListener(org.crosswire.jsword.index.IndexStatusListener)
      */
     public void addIndexStatusListener(IndexStatusListener li)
     {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -36,9 +36,9 @@
 import org.crosswire.jsword.book.BookDriver;
 import org.crosswire.jsword.book.BookMetaData;
 import org.crosswire.jsword.book.FeatureType;
-import org.crosswire.jsword.book.index.IndexStatus;
-import org.crosswire.jsword.book.index.IndexStatusEvent;
-import org.crosswire.jsword.book.index.IndexStatusListener;
+import org.crosswire.jsword.index.IndexStatus;
+import org.crosswire.jsword.index.IndexStatusEvent;
+import org.crosswire.jsword.index.IndexStatusListener;
 import org.jdom.Document;
 
 /**
@@ -320,7 +320,7 @@
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#addIndexStatusListener(org.crosswire.jsword.book.index.IndexStatusListener)
+     * @see org.crosswire.jsword.book.BookMetaData#addIndexStatusListener(org.crosswire.jsword.index.IndexStatusListener)
      */
     public void addIndexStatusListener(IndexStatusListener listener)
     {
@@ -332,7 +332,7 @@
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#removeIndexStatusListener(org.crosswire.jsword.book.index.IndexStatusListener)
+     * @see org.crosswire.jsword.book.BookMetaData#removeIndexStatusListener(org.crosswire.jsword.index.IndexStatusListener)
      */
     public void removeIndexStatusListener(IndexStatusListener listener)
     {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -30,9 +30,9 @@
 import org.crosswire.jsword.book.BookDriver;
 import org.crosswire.jsword.book.BookMetaData;
 import org.crosswire.jsword.book.OSISUtil;
-import org.crosswire.jsword.book.index.IndexManager;
-import org.crosswire.jsword.book.index.IndexManagerFactory;
-import org.crosswire.jsword.book.index.IndexStatus;
+import org.crosswire.jsword.index.IndexManager;
+import org.crosswire.jsword.index.IndexManagerFactory;
+import org.crosswire.jsword.index.IndexStatus;
 import org.jdom.Document;
 import org.jdom.Element;
 

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/Index.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/Index.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/Index.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,73 +0,0 @@
-/**
- * Distribution License:
- * JSword is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License, version 2.1 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The License is available on the internet at:
- *       http://www.gnu.org/copyleft/lgpl.html
- * or by writing to:
- *      Free Software Foundation, Inc.
- *      59 Temple Place - Suite 330
- *      Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- *     The copyright to this program is held by it's authors.
- *
- * ID: $Id$
- */
-package org.crosswire.jsword.book.index;
-
-import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.search.SearchModifier;
-import org.crosswire.jsword.passage.Key;
-import org.crosswire.jsword.passage.NoSuchKeyException;
-
-/**
- * An index into a body of text that knows what words exist and where they are.
- *
- * @see gnu.lgpl.License for license details.
- *      The copyright to this program is held by it's authors.
- * @author Joe Walker [joe at eireneh dot com]
- */
-public interface Index
-{
-    /**
-     * Find the set of references that satisfy the query. Query is anything that
-     * the underlying index can handle.
-     * If the <code>query</code> being searched for is null then an empty Key
-     * <b>MUST</b> be returned. Users of this index may use this functionality
-     * to get empty KeyLists which they then use to aggregate other searches
-     * done on this index.
-     * @param query The text to search for
-     * @return The references to the word
-     */
-    Key find(String query) throws BookException;
-
-    /**
-     * An index must be able to create KeyLists for users in a similar way to
-     * the Book that it is indexing.
-     * @param name The string to convert to a Key
-     * @return A new Key representing the given string, if possible
-     * @throws NoSuchKeyException If the string can not be turned into a Key
-     * @see org.crosswire.jsword.passage.KeyFactory#getKey(String)
-     */
-    Key getKey(String name) throws NoSuchKeyException;
-
-    /**
-     * Set any modifier for the current and subsequent search.
-     * Using null will clear the search modifier.
-     *
-     * @param modifier how to modify the search and its results.
-     */
-    void setSearchModifier(SearchModifier modifier);
-
-    /**
-     * Get the current SearchModifier. If there is none then return null.
-     * @return the current search modifier, or null if there is not one.
-     */
-    SearchModifier getSearchModifier();
-}

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,67 +0,0 @@
-/**
- * Distribution License:
- * JSword is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License, version 2.1 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The License is available on the internet at:
- *       http://www.gnu.org/copyleft/lgpl.html
- * or by writing to:
- *      Free Software Foundation, Inc.
- *      59 Temple Place - Suite 330
- *      Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- *     The copyright to this program is held by it's authors.
- *
- * ID: $Id$
- */
-package org.crosswire.jsword.book.index;
-
-import java.net.URL;
-
-import org.crosswire.jsword.book.Book;
-import org.crosswire.jsword.book.BookException;
-
-/**
- * A way of managing a way of creating a search index for a book.
- * 
- * @see gnu.lgpl.License for license details.
- *      The copyright to this program is held by it's authors.
- * @author Joe Walker [joe at eireneh dot com]
- */
-public interface IndexManager
-{
-    /**
-     * Detects if index data has been stored for this Bible already
-     */
-    boolean isIndexed(Book book);
-
-    /**
-     * Create a new Searcher.
-     */
-    Index getIndex(Book book) throws BookException;
-
-    /**
-     * Read from the given source version to generate ourselves. On completion
-     * of this method the index should be usable.
-     */
-    void scheduleIndexCreation(Book book);
-
-    /**
-     * We have downloaded a search index to a zip file. It should be installed
-     * from here.
-     * @param book The book that we downloaded an index for
-     * @param tempDest The URL of a zip file to install
-     */
-    void installDownloadedIndex(Book book, URL tempDest) throws BookException;
-
-    /**
-     * Tidy up after yourself and remove all the files that make up any indexes
-     * you created.
-     */
-    void deleteIndex(Book book) throws BookException;
-}

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.properties
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.properties	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.properties	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,2 +0,0 @@
-
-default=org.crosswire.jsword.book.search.lucene.LuceneIndexManager

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManagerFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManagerFactory.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManagerFactory.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,77 +0,0 @@
-/**
- * Distribution License:
- * JSword is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License, version 2.1 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The License is available on the internet at:
- *       http://www.gnu.org/copyleft/lgpl.html
- * or by writing to:
- *      Free Software Foundation, Inc.
- *      59 Temple Place - Suite 330
- *      Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- *     The copyright to this program is held by it's authors.
- *
- * ID: $Id$
- */
-package org.crosswire.jsword.book.index;
-
-import org.crosswire.common.util.ClassUtil;
-import org.crosswire.common.util.Logger;
-
-/**
- * A Factory class for IndexManagers.
- * 
- * @see gnu.lgpl.License for license details.
- *      The copyright to this program is held by it's authors.
- * @author Joe Walker [joe at eireneh dot com]
-
- */
-public final class IndexManagerFactory
-{
-    /**
-     * Prevent Instansiation
-     */
-    private IndexManagerFactory()
-    {
-    }
-
-    /**
-     * Create a new IndexManager.
-     */
-    public static IndexManager getIndexManager()
-    {
-        return instance;
-    }
-
-    /**
-     * The singleton
-     */
-    private static IndexManager instance;
-
-    /**
-     * The log stream
-     */
-    private static final Logger log = Logger.getLogger(IndexManagerFactory.class);
-
-    /**
-     * Setup the instance
-     */
-    static
-    {
-        try
-        {
-            Class impl = ClassUtil.getImplementor(IndexManager.class);
-            instance = (IndexManager) impl.newInstance();
-        }
-        catch (Exception ex)
-        {
-            log.error("createIndexManager failed", ex); //$NON-NLS-1$
-        }
-    }
-}

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatus.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatus.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatus.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,146 +0,0 @@
-/**
- * Distribution License:
- * JSword is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License, version 2.1 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The License is available on the internet at:
- *       http://www.gnu.org/copyleft/lgpl.html
- * or by writing to:
- *      Free Software Foundation, Inc.
- *      59 Temple Place - Suite 330
- *      Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- *     The copyright to this program is held by it's authors.
- *
- * ID: $Id$
- */
-package org.crosswire.jsword.book.index;
-
-import java.io.Serializable;
-
-/**
- * An Enumeration of the possible types of Book.
- * 
- * <p>NOTE(joe): consider giving each a number (1,2,4,8) and allowing combinations
- * 
- * @see gnu.lgpl.License for license details.
- *      The copyright to this program is held by it's authors.
- * @author Joe Walker [joe at eireneh dot com]
- */
-public final class IndexStatus implements Serializable
-{
-    /**
-     * There is a complete and ready to use search index
-     */
-    public static final IndexStatus DONE = new IndexStatus("Indexed"); //$NON-NLS-1$
-
-    /**
-     * There is no search index, and no plans to create one
-     */
-    public static final IndexStatus UNDONE = new IndexStatus("No Index");  //$NON-NLS-1$
-
-    /**
-     * This Book has been scheduled for index creation
-     */
-    public static final IndexStatus SCHEDULED = new IndexStatus("Scheduled"); //$NON-NLS-1$
-
-    /**
-     * An index is currently being generated for this Book
-     */
-    public static final IndexStatus CREATING = new IndexStatus("Creating"); //$NON-NLS-1$
-
-    /**
-     * All the known values
-     */
-    private static final IndexStatus[] VALUES =
-    {
-        DONE,
-        UNDONE,
-        SCHEDULED,
-        CREATING,
-    };
-
-    /**
-     * @param name The name of the BookCategory
-     */
-    private IndexStatus(String name)
-    {
-        this.name = name;
-    }
-
-    /**
-     * Lookup method to convert from a String
-     */
-    public static IndexStatus fromString(String name)
-    {
-        for (int i = 0; i < VALUES.length; i++)
-        {
-            IndexStatus o = VALUES[i];
-            if (o.name.equalsIgnoreCase(name))
-            {
-                return o;
-            }
-        }
-        // cannot get here
-        assert false;
-        return null;
-    }
-
-    /**
-     * Lookup method to convert from an integer
-     */
-    public static IndexStatus fromInteger(int i)
-    {
-        return VALUES[i];
-    }
-
-    /**
-     * Prevent subclasses from overriding canonical identity based Object methods
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    public boolean equals(Object o)
-    {
-        return super.equals(o);
-    }
-
-    /**
-     * Prevent subclasses from overriding canonical identity based Object methods
-     * @see java.lang.Object#hashCode()
-     */
-    public int hashCode()
-    {
-        return super.hashCode();
-    }
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return name;
-    }
-
-    /**
-     * The name of the BookCategory
-     */
-    private String name;
-
-    // Support for serialization
-    private static int nextObj;
-    private final int obj = nextObj++;
-
-    Object readResolve()
-    {
-        return VALUES[obj];
-    }
-
-    /**
-     * Serialization ID
-     */
-    private static final long serialVersionUID = 3256718472791537204L;
-}

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusEvent.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusEvent.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusEvent.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,66 +0,0 @@
-/**
- * Distribution License:
- * JSword is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License, version 2.1 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The License is available on the internet at:
- *       http://www.gnu.org/copyleft/lgpl.html
- * or by writing to:
- *      Free Software Foundation, Inc.
- *      59 Temple Place - Suite 330
- *      Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- *     The copyright to this program is held by it's authors.
- *
- * ID: $Id: BooksEvent.java 763 2005-07-27 23:26:43Z dmsmith $
- */
-package org.crosswire.jsword.book.index;
-
-import java.util.EventObject;
-
-
-/**
- * An IndexStatusEvent is fired whenever the IndexStatus
- * of a book has changed.
- * 
- * @see gnu.lgpl.License for license details.
- *      The copyright to this program is held by it's authors.
- * @author DM Smith [dmsmith555 at yahoo dot com]
- */
-public class IndexStatusEvent extends EventObject
-{
-    /**
-     * Basic constructor
-     * @param status The new status of the book.
-     */
-    public IndexStatusEvent(Object source, IndexStatus status)
-    {
-        super(source);
-
-        indexStatus = status;
-    }
-
-    /**
-     * @return Returns the indexStatus.
-     */
-    public IndexStatus getIndexStatus()
-    {
-        return indexStatus;
-    }
-
-    /**
-     * The indexStatus of the book.
-     */
-    private transient IndexStatus indexStatus;
-
-    /**
-     * Serialization ID
-     */
-    private static final long serialVersionUID = 3834876879554819894L;
-
-}

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusListener.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusListener.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusListener.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,42 +0,0 @@
-/**
- * Distribution License:
- * JSword is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License, version 2.1 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The License is available on the internet at:
- *       http://www.gnu.org/copyleft/lgpl.html
- * or by writing to:
- *      Free Software Foundation, Inc.
- *      59 Temple Place - Suite 330
- *      Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- *     The copyright to this program is held by it's authors.
- *
- * ID: $Id: BooksListener.java 763 2005-07-27 23:26:43Z dmsmith $
- */
-package org.crosswire.jsword.book.index;
-
-import java.util.EventListener;
-
-
-/**
- * IndexStatusListeners are able to be notified about changes to the
- * IndexStatus of a book.
- * 
- * @see gnu.lgpl.License for license details.
- *      The copyright to this program is held by it's authors.
- * @author DM Smith [dmsmith555 at yahoo dot com]
- */
-public interface IndexStatusListener extends EventListener
-{
-    /**
-     * Called whenever the IndexStatus of a book has changed.
-     * @param ev A description of the change
-     */
-    void statusChanged(IndexStatusEvent ev);
-}

Deleted: trunk/jsword/src/main/java/org/crosswire/jsword/book/index/package.html
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/package.html	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/index/package.html	2006-01-23 19:10:49 UTC (rev 983)
@@ -1,9 +0,0 @@
-<html>
-<body>
-
-<p>
-  Abstraction of an Index.
-</p>
-
-</body>
-</html>

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/Query.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/Query.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/Query.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,7 +22,7 @@
 package org.crosswire.jsword.book.query;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndNotQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndNotQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndNotQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,8 +22,8 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/AndQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,8 +22,8 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BaseQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BaseQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BaseQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,7 +22,7 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BlurQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BlurQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/BlurQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,8 +22,8 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 import org.crosswire.jsword.passage.RestrictionType;
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/NullQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/NullQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/NullQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,8 +22,8 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/OrQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/OrQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/OrQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,8 +22,8 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/RangeQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/RangeQuery.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/query/basic/RangeQuery.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,7 +22,7 @@
 package org.crosswire.jsword.book.query.basic;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 import org.crosswire.jsword.passage.NoSuchKeyException;
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/search/Searcher.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/search/Searcher.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/search/Searcher.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,8 +22,8 @@
 package org.crosswire.jsword.book.search;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/search/SearcherFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/search/SearcherFactory.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/search/SearcherFactory.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -24,9 +24,9 @@
 import org.crosswire.common.util.ClassUtil;
 import org.crosswire.common.util.Logger;
 import org.crosswire.jsword.book.Book;
-import org.crosswire.jsword.book.index.Index;
-import org.crosswire.jsword.book.index.IndexManager;
-import org.crosswire.jsword.book.index.IndexManagerFactory;
+import org.crosswire.jsword.index.Index;
+import org.crosswire.jsword.index.IndexManager;
+import org.crosswire.jsword.index.IndexManagerFactory;
 
 /**
  * Factory method for creating a new Searcher.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndex.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndex.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndex.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -50,9 +50,9 @@
 import org.crosswire.jsword.book.Book;
 import org.crosswire.jsword.book.BookData;
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.IndexStatus;
-import org.crosswire.jsword.book.index.basic.AbstractIndex;
 import org.crosswire.jsword.book.search.SearchModifier;
+import org.crosswire.jsword.index.IndexStatus;
+import org.crosswire.jsword.index.basic.AbstractIndex;
 import org.crosswire.jsword.passage.AbstractPassage;
 import org.crosswire.jsword.passage.BibleInfo;
 import org.crosswire.jsword.passage.Key;

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndexManager.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndexManager.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneIndexManager.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -35,9 +35,9 @@
 import org.crosswire.jsword.book.Book;
 import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.book.BookMetaData;
-import org.crosswire.jsword.book.index.Index;
-import org.crosswire.jsword.book.index.IndexManager;
-import org.crosswire.jsword.book.index.IndexStatus;
+import org.crosswire.jsword.index.Index;
+import org.crosswire.jsword.index.IndexManager;
+import org.crosswire.jsword.index.IndexStatus;
 import org.crosswire.jsword.util.Project;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneSearcher.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneSearcher.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/search/lucene/LuceneSearcher.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -22,12 +22,12 @@
 package org.crosswire.jsword.book.search.lucene;
 
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.query.Query;
 import org.crosswire.jsword.book.query.QueryBuilderFactory;
 import org.crosswire.jsword.book.search.SearchRequest;
 import org.crosswire.jsword.book.search.Searcher;
 import org.crosswire.jsword.book.search.basic.DefaultSearchRequest;
+import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.passage.Key;
 
 /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -37,9 +37,9 @@
 import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.book.Books;
 import org.crosswire.jsword.book.basic.AbstractBookDriver;
-import org.crosswire.jsword.book.index.IndexManager;
-import org.crosswire.jsword.book.index.IndexManagerFactory;
-import org.crosswire.jsword.book.index.IndexStatus;
+import org.crosswire.jsword.index.IndexManager;
+import org.crosswire.jsword.index.IndexManagerFactory;
+import org.crosswire.jsword.index.IndexStatus;
 import org.crosswire.jsword.util.Project;
 
 /**

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/Index.java (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/Index.java)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/Index.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/Index.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,73 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.jsword.index;
+
+import org.crosswire.jsword.book.BookException;
+import org.crosswire.jsword.book.search.SearchModifier;
+import org.crosswire.jsword.passage.Key;
+import org.crosswire.jsword.passage.NoSuchKeyException;
+
+/**
+ * An index into a body of text that knows what words exist and where they are.
+ *
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public interface Index
+{
+    /**
+     * Find the set of references that satisfy the query. Query is anything that
+     * the underlying index can handle.
+     * If the <code>query</code> being searched for is null then an empty Key
+     * <b>MUST</b> be returned. Users of this index may use this functionality
+     * to get empty KeyLists which they then use to aggregate other searches
+     * done on this index.
+     * @param query The text to search for
+     * @return The references to the word
+     */
+    Key find(String query) throws BookException;
+
+    /**
+     * An index must be able to create KeyLists for users in a similar way to
+     * the Book that it is indexing.
+     * @param name The string to convert to a Key
+     * @return A new Key representing the given string, if possible
+     * @throws NoSuchKeyException If the string can not be turned into a Key
+     * @see org.crosswire.jsword.passage.KeyFactory#getKey(String)
+     */
+    Key getKey(String name) throws NoSuchKeyException;
+
+    /**
+     * Set any modifier for the current and subsequent search.
+     * Using null will clear the search modifier.
+     *
+     * @param modifier how to modify the search and its results.
+     */
+    void setSearchModifier(SearchModifier modifier);
+
+    /**
+     * Get the current SearchModifier. If there is none then return null.
+     * @return the current search modifier, or null if there is not one.
+     */
+    SearchModifier getSearchModifier();
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/Index.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.java)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,67 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.jsword.index;
+
+import java.net.URL;
+
+import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookException;
+
+/**
+ * A way of managing a way of creating a search index for a book.
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public interface IndexManager
+{
+    /**
+     * Detects if index data has been stored for this Bible already
+     */
+    boolean isIndexed(Book book);
+
+    /**
+     * Create a new Searcher.
+     */
+    Index getIndex(Book book) throws BookException;
+
+    /**
+     * Read from the given source version to generate ourselves. On completion
+     * of this method the index should be usable.
+     */
+    void scheduleIndexCreation(Book book);
+
+    /**
+     * We have downloaded a search index to a zip file. It should be installed
+     * from here.
+     * @param book The book that we downloaded an index for
+     * @param tempDest The URL of a zip file to install
+     */
+    void installDownloadedIndex(Book book, URL tempDest) throws BookException;
+
+    /**
+     * Tidy up after yourself and remove all the files that make up any indexes
+     * you created.
+     */
+    void deleteIndex(Book book) throws BookException;
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.properties (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.properties)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManager.properties	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.properties	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,2 @@
+
+default=org.crosswire.jsword.book.search.lucene.LuceneIndexManager


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.properties
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManagerFactory.java)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexManagerFactory.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,77 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.jsword.index;
+
+import org.crosswire.common.util.ClassUtil;
+import org.crosswire.common.util.Logger;
+
+/**
+ * A Factory class for IndexManagers.
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+
+ */
+public final class IndexManagerFactory
+{
+    /**
+     * Prevent Instansiation
+     */
+    private IndexManagerFactory()
+    {
+    }
+
+    /**
+     * Create a new IndexManager.
+     */
+    public static IndexManager getIndexManager()
+    {
+        return instance;
+    }
+
+    /**
+     * The singleton
+     */
+    private static IndexManager instance;
+
+    /**
+     * The log stream
+     */
+    private static final Logger log = Logger.getLogger(IndexManagerFactory.class);
+
+    /**
+     * Setup the instance
+     */
+    static
+    {
+        try
+        {
+            Class impl = ClassUtil.getImplementor(IndexManager.class);
+            instance = (IndexManager) impl.newInstance();
+        }
+        catch (Exception ex)
+        {
+            log.error("createIndexManager failed", ex); //$NON-NLS-1$
+        }
+    }
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatus.java (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatus.java)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatus.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatus.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,146 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.jsword.index;
+
+import java.io.Serializable;
+
+/**
+ * An Enumeration of the possible types of Book.
+ * 
+ * <p>NOTE(joe): consider giving each a number (1,2,4,8) and allowing combinations
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+public final class IndexStatus implements Serializable
+{
+    /**
+     * There is a complete and ready to use search index
+     */
+    public static final IndexStatus DONE = new IndexStatus("Indexed"); //$NON-NLS-1$
+
+    /**
+     * There is no search index, and no plans to create one
+     */
+    public static final IndexStatus UNDONE = new IndexStatus("No Index");  //$NON-NLS-1$
+
+    /**
+     * This Book has been scheduled for index creation
+     */
+    public static final IndexStatus SCHEDULED = new IndexStatus("Scheduled"); //$NON-NLS-1$
+
+    /**
+     * An index is currently being generated for this Book
+     */
+    public static final IndexStatus CREATING = new IndexStatus("Creating"); //$NON-NLS-1$
+
+    /**
+     * All the known values
+     */
+    private static final IndexStatus[] VALUES =
+    {
+        DONE,
+        UNDONE,
+        SCHEDULED,
+        CREATING,
+    };
+
+    /**
+     * @param name The name of the BookCategory
+     */
+    private IndexStatus(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Lookup method to convert from a String
+     */
+    public static IndexStatus fromString(String name)
+    {
+        for (int i = 0; i < VALUES.length; i++)
+        {
+            IndexStatus o = VALUES[i];
+            if (o.name.equalsIgnoreCase(name))
+            {
+                return o;
+            }
+        }
+        // cannot get here
+        assert false;
+        return null;
+    }
+
+    /**
+     * Lookup method to convert from an integer
+     */
+    public static IndexStatus fromInteger(int i)
+    {
+        return VALUES[i];
+    }
+
+    /**
+     * Prevent subclasses from overriding canonical identity based Object methods
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object o)
+    {
+        return super.equals(o);
+    }
+
+    /**
+     * Prevent subclasses from overriding canonical identity based Object methods
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return super.hashCode();
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return name;
+    }
+
+    /**
+     * The name of the BookCategory
+     */
+    private String name;
+
+    // Support for serialization
+    private static int nextObj;
+    private final int obj = nextObj++;
+
+    Object readResolve()
+    {
+        return VALUES[obj];
+    }
+
+    /**
+     * Serialization ID
+     */
+    private static final long serialVersionUID = 3256718472791537204L;
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatus.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusEvent.java)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusEvent.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,66 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: BooksEvent.java 763 2005-07-27 23:26:43Z dmsmith $
+ */
+package org.crosswire.jsword.index;
+
+import java.util.EventObject;
+
+
+/**
+ * An IndexStatusEvent is fired whenever the IndexStatus
+ * of a book has changed.
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class IndexStatusEvent extends EventObject
+{
+    /**
+     * Basic constructor
+     * @param status The new status of the book.
+     */
+    public IndexStatusEvent(Object source, IndexStatus status)
+    {
+        super(source);
+
+        indexStatus = status;
+    }
+
+    /**
+     * @return Returns the indexStatus.
+     */
+    public IndexStatus getIndexStatus()
+    {
+        return indexStatus;
+    }
+
+    /**
+     * The indexStatus of the book.
+     */
+    private transient IndexStatus indexStatus;
+
+    /**
+     * Serialization ID
+     */
+    private static final long serialVersionUID = 3834876879554819894L;
+
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java
___________________________________________________________________
Name: astChangedRevision
   + 

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusListener.java (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusListener.java)
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/IndexStatusListener.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusListener.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -0,0 +1,42 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: BooksListener.java 763 2005-07-27 23:26:43Z dmsmith $
+ */
+package org.crosswire.jsword.index;
+
+import java.util.EventListener;
+
+
+/**
+ * IndexStatusListeners are able to be notified about changes to the
+ * IndexStatus of a book.
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public interface IndexStatusListener extends EventListener
+{
+    /**
+     * Called whenever the IndexStatus of a book has changed.
+     * @param ev A description of the change
+     */
+    void statusChanged(IndexStatusEvent ev);
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusListener.java
___________________________________________________________________
Name: astChangedRevision
   + 

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/basic (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/basic)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/basic/AbstractIndex.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/index/basic/AbstractIndex.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/basic/AbstractIndex.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -19,10 +19,10 @@
  *
  * ID: $Id$
  */
-package org.crosswire.jsword.book.index.basic;
+package org.crosswire.jsword.index.basic;
 
-import org.crosswire.jsword.book.index.Index;
 import org.crosswire.jsword.book.search.SearchModifier;
+import org.crosswire.jsword.index.Index;
 
 /**
  * A simple implementation of an Index that provides the

Copied: trunk/jsword/src/main/java/org/crosswire/jsword/index/package.html (from rev 982, trunk/jsword/src/main/java/org/crosswire/jsword/book/index/package.html)


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/index/package.html
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/util/IndexDownloader.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/IndexDownloader.java	2006-01-23 19:00:56 UTC (rev 982)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/IndexDownloader.java	2006-01-23 19:10:49 UTC (rev 983)
@@ -27,10 +27,10 @@
 import org.crosswire.common.util.NetUtil;
 import org.crosswire.jsword.book.Book;
 import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.index.IndexManager;
-import org.crosswire.jsword.book.index.IndexManagerFactory;
 import org.crosswire.jsword.book.install.InstallException;
 import org.crosswire.jsword.book.install.Installer;
+import org.crosswire.jsword.index.IndexManager;
+import org.crosswire.jsword.index.IndexManagerFactory;
 
 /**
  * .



More information about the jsword-svn mailing list