|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectIndexUtil
public class IndexUtil
This class provides methods related to, but not always part of, a text index. For instance, there are methods to calculate document keys (as used in an index), or lazy file paths. It also maintains a publicly accessible cache of index info entries read from the index config file(s).
Field Summary | |
---|---|
private static ConfigCache |
configCache
|
private static SAXParserFactory |
saxParserFactory
|
private static TransformerFactory |
transformerFactory
|
Constructor Summary | |
---|---|
IndexUtil()
|
Method Summary | |
---|---|
static void |
applyPreFilters(Templates[] prefilterStylesheets,
XMLReader reader,
InputSource xmlSource,
Result ultimateResult)
Apply one or more prefilter stylesheets to an XML input source. |
static String |
calcDocKey(File xtfHome,
File idxConfigFile,
String idxName,
File srcTextFile)
Given an index within a config file and the path to the source XML text of a document, this method infers the correct document key that should be stored in the index. |
static String |
calcDocKey(File xtfHomeFile,
IndexInfo idxInfo,
File srcTextFile)
Given an index within a config file and the path to the source XML text of a document, this method infers the correct document key that should be stored in the index. |
static File |
calcLazyPath(File xtfHome,
File idxConfigFile,
String idxName,
File srcTextFile,
boolean createDir)
Given an index within a config file and the path to the source XML text of a document, this method infers the correct path to the lazy version of that source document. |
static File |
calcLazyPath(File xtfHome,
IndexInfo idxInfo,
File srcTextFile,
boolean createDir)
Given an index within a config file and the path to the source XML text of a document, this method infers the correct path to the lazy version of that source document. |
static SAXParser |
createSAXParser()
Create a SAX parser using the best implementation we can find. |
static Transformer |
createTransformer()
Create a Saxon transformer. |
static XMLReader |
createXMLReader()
Create an XML reader using the best implementation we can find. |
static InputStream |
filterXMLDocument(InputStream inStream,
boolean applyCrimsonWorkaround,
boolean removeDoctypeDecl)
Applies the standard set of filters for an XML document. |
static InputStream |
filterXMLDocument(InputStream inStream,
SAXParser saxParser,
boolean removeDoctypeDecl)
Applies the standard set of filters for an XML document. |
static IndexInfo |
getIndexInfo(File idxConfigFile,
String idxName)
Given an index configuration file and the name of an index within that file, fetch the configuration info. |
private static TransformerFactory |
getTransformerFactory()
Get a TransformerFactory. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static ConfigCache configCache
private static SAXParserFactory saxParserFactory
private static TransformerFactory transformerFactory
Constructor Detail |
---|
public IndexUtil()
Method Detail |
---|
public static IndexInfo getIndexInfo(File idxConfigFile, String idxName) throws Exception
idxConfigFile
- Index configuration file to readidxName
- Name of the index within that file
Exception
- If there is a problem reading the config file.public static File calcLazyPath(File xtfHome, File idxConfigFile, String idxName, File srcTextFile, boolean createDir) throws IOException
idxConfigFile
- File to load index configuration fromidxName
- Index name within the configsrcTextFile
- Source text file of interestcreateDir
- true to create the directory for the lazy file
if it doesn't exist; false to never create the
directory.
IOException
public static File calcLazyPath(File xtfHome, IndexInfo idxInfo, File srcTextFile, boolean createDir) throws IOException
xtfHome
- File at the root of the XTF directory treeidxInfo
- Configuration info for the index in question.srcTextFile
- Source text file of interestcreateDir
- true to create the directory for the lazy file
if it doesn't exist; false to never create the
directory.
IOException
public static String calcDocKey(File xtfHome, File idxConfigFile, String idxName, File srcTextFile) throws IOException
idxConfigFile
- File to load index configuration fromidxName
- Index name within the configsrcTextFile
- Source text file of interest
IOException
public static String calcDocKey(File xtfHomeFile, IndexInfo idxInfo, File srcTextFile) throws IOException
xtfHomeFile
- The XTF_HOME directoryidxInfo
- Configuration info for the index in question.srcTextFile
- Source text file of interest
IOException
public static SAXParser createSAXParser()
public static XMLReader createXMLReader()
private static TransformerFactory getTransformerFactory()
public static Transformer createTransformer()
public static InputStream filterXMLDocument(InputStream inStream, boolean applyCrimsonWorkaround, boolean removeDoctypeDecl)
inStream
- Document stream to filterapplyCrimsonWorkaround
- true to apply the workaround for the
8193-byte bug in the Crimson XML parser.removeDoctypeDecl
- true to remove DOCTYPE declaration; false to
leave them alone.
public static InputStream filterXMLDocument(InputStream inStream, SAXParser saxParser, boolean removeDoctypeDecl)
inStream
- Document stream to filtersaxParser
- Parser that will be used to parse the document; used
to determine whether or not to apply the Crimson
parser workaround.removeDoctypeDecl
- true to remove DOCTYPE declaration; false to
leave them alone.
public static void applyPreFilters(Templates[] prefilterStylesheets, XMLReader reader, InputSource xmlSource, Result ultimateResult) throws SAXException, TransformerException, TransformerConfigurationException
prefilterStylesheets
- Stylesheets to processreader
- Reader to use for parsing the input XMLxmlSource
- Source of XML dataultimateResult
- Where to send the output
SAXException
TransformerException
TransformerConfigurationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |