|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generic document searcher.
Implementations of this interface provide the capability of searching for documents. The term document is used in a very generic sense, referring to any object that contains data that can be read and/or written.
import tribble.search.*; public class MyDocSearcher implements tribble.search.DocumentSearcherI { ... }
A document searcher allows client classes to apply a set of search criteria in order to locate documents. Information about each found document can then be retrieved, as well as it data contents. This model assumes a very simple hierarchical arrangement of searchers being able to locate one or more documents, each of which contains data of some sort.
Examples of the kinds of entities handled by document searcher implementations
include:
The find() method of a document searcher object returns an enumeration which is used to interate through the complete list of matching document entries found by the searcher.
MyDocSearcher src; Hashtable props; MyNameFilter filt; Enumeration iter; // Create and initialize a new searcher object src = new MyDocSearcher(...); props = new Hashtable(); props.put(..., ...); src.initialize(props); src.open(...); // Find zero or more documents filt = new MyNameFilter(...); iter = src.find(filt); // Iterate through the list of matching documents while (iter.hasMoreElements()) { MyDoc doc; // Get the next matching document doc = (MyDoc) iter.nextElement(); ... process document 'doc' ... }
Some of the methods of this interface were modelled after the
ZipFile
class.
DocumentI
,
DocumentFilterI
,
DocumentStorerI
Field Summary | |
static java.lang.String |
REV
Revision information. |
static int |
SERIES
Series number. |
Method Summary | |
void |
close()
Close this searcher. |
java.util.Enumeration |
find(DocumentFilterI filt)
Locate and retrieve documents from this searcher matching given filtering criteria. |
void |
initialize(java.util.Hashtable parms)
Initialize this searcher. |
void |
open(java.lang.String path)
Open a given search path for this searcher. |
boolean |
outputSupported()
Determine if documents can be written to this searcher. |
Field Detail |
public static final java.lang.String REV
public static final int SERIES
Method Detail |
public void initialize(java.util.Hashtable parms) throws java.lang.Exception
This must be the first method to be called on this searcher object, prior
to calling the open(java.lang.String)
method.
The implementation of this interface may allow this method to be called more than once.
parms
- A hash table containing name/value pairs with which to initialize this
document searcher. This argument may be allowed to be null, depending on
the implementation of this interface.
java.lang.Exception
- Thrown if the specified hash table entries are malformed, or if some other
error occurs.open(java.lang.String)
public void open(java.lang.String path) throws java.lang.Exception
path
- The name of a path (which can be anything meaningfully interpreted as a
path, such as a filename or URL) specifying the location of the
searcher to open and search.
java.lang.Exception
- Thrown if the specified path does not exist or is not accessible, or if it
is malformed, or if some other error occurs.close()
,
initialize(java.util.Hashtable)
public void close() throws java.lang.Exception
This must be the last method to be called on this searcher object.
java.lang.Exception
- Thrown if an error occurs.open(java.lang.String)
public java.util.Enumeration find(DocumentFilterI filt) throws java.lang.Exception
It is up to the implementation of this interface whether this method retrieves all of the matching documents at once or whether it retrieves them one at a time through the enumeration that is returned.
filt
- A filter specifying document searching criteria. This can be null, in
which case all possible documents from this searcher are returned.
DocumentI
objects representing the list of
documents found by this searcher, or null if there are no matching
documents to be found.
java.lang.Exception
- Thrown if the specified criteria are malformed, or if some other error
occurs.public boolean outputSupported()
DocumentI#getOutputStream
method is supported by
document objects found by this searcher, otherwise false.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |