public class DefaultDocLocator extends Object implements DocLocator
Modifier and Type | Class and Description |
---|---|
private static class |
DefaultDocLocator.LazyPassthru
Passes SAX events to a ContentHandler.
|
Modifier and Type | Field and Description |
---|---|
private TextServlet |
servlet
Servlet we are part of
|
Constructor and Description |
---|
DefaultDocLocator() |
Modifier and Type | Method and Description |
---|---|
private void |
buildLazyStore(File lazyFile,
String sourcePath,
Templates preFilter,
boolean removeDoctypeDecl,
boolean stripWhitespace)
Create a lazy document by loading the original, building the lazy
tree, and writing it out.
|
File |
calcLazyPath(File xtfHome,
File idxConfigFile,
String idxName,
File srcTextFile,
boolean createDir)
Wrapper for IndexUtil.calcLazyPath(); useful for derived classes to supply their
own implementation.
|
InputSource |
getInputSource(String sourcePath,
boolean removeDoctypeDecl)
Retrieve the data stream for an XML source document.
|
StructuredStore |
getLazyStore(String indexConfigPath,
String indexName,
String sourcePath,
Templates preFilter,
boolean removeDoctypeDecl)
Search for a StructuredStore containing the "lazy" or persistent
representation of a given document.
|
private boolean |
isPostIndexLazyFile(File f)
Check if the given lazy file was created after the indexing process
(i.e. by this doc locator)
|
void |
setServlet(TextServlet servlet)
Attach to a servlet
|
private TextServlet servlet
public void setServlet(TextServlet servlet)
setServlet
in interface DocLocator
servlet
- Servlet to attach topublic StructuredStore getLazyStore(String indexConfigPath, String indexName, String sourcePath, Templates preFilter, boolean removeDoctypeDecl) throws IOException
getInputSource(String, boolean)
will be called as a fall-back.
Note: synchronized to prevent the situation where multiple threads
might try to create the same lazy store at the same time and interfere
with each other.getLazyStore
in interface DocLocator
indexConfigPath
- Path to the index configuration fileindexName
- Name of the index being searchedsourcePath
- Path to the source documentpreFilter
- Prefilter stylesheet to run (or null for none)removeDoctypeDecl
- Set to true to remove DOCTYPE declaration from
the XML document.IOException
public File calcLazyPath(File xtfHome, File idxConfigFile, String idxName, File srcTextFile, boolean createDir) throws IOException
IOException
public InputSource getInputSource(String sourcePath, boolean removeDoctypeDecl) throws IOException
getInputSource
in interface DocLocator
sourcePath
- Path to the source documentremoveDoctypeDecl
- Set to true to remove DOCTYPE declaration from
the XML document.IOException
private void buildLazyStore(File lazyFile, String sourcePath, Templates preFilter, boolean removeDoctypeDecl, boolean stripWhitespace) throws IOException
lazyFile
- Lazy file to createsourcePath
- Path to the source documentpreFilter
- A prefilter stylesheet (or null for no pre-filtering.)removeDoctypeDecl
- true to remove DOCTYPE declarations from the
XML documentstripWhitespace
- If set, whitespace will be removed between elements
in the lazy file.IOException
private boolean isPostIndexLazyFile(File f)