public class ACSLogParserFactory
extends java.lang.Object
The purpose of this object is to hide the type of parser really used at run time.
The object could instantiate a new parser or use only one instance, a singleton.
There are 2 parsers available: DOM and VTD.
VTD is ACS/LGPL/Tools and installed by ACS. It is licensed under GPL and available
at http://vtd-xml.sourceforge.net/
VTD claims to be very fast (and effectively it performs better then DOM) so the factory
tries to instantiate a VTD parser if it is present.
Having this factory allows to transparently use a different implementation at run-time
depending on the real availability of the parsers.
| Modifier and Type | Class and Description |
|---|---|
static class |
ACSLogParserFactory.ParserTypes
The supported parsers.
|
| Constructor and Description |
|---|
ACSLogParserFactory() |
| Modifier and Type | Method and Description |
|---|---|
static ACSLogParser |
getParser()
Get a parser.
|
static ACSLogParser |
getParser(ACSLogParserFactory.ParserTypes parserType)
Get a parser of the given type.
|
static ACSLogParserFactory.ParserTypes |
getParserType()
Return the type of the parser in use.
|
static ACSLogParserFactory.ParserTypes |
getParserType(ACSLogParser parserToCheck)
Return the type of the passed parser.
|
public static ACSLogParser getParser() throws java.lang.Exception
The ACSLogParser returned by this method can be a new instance
or not, depending on the implementation.
Exception - in case of error building the parserjava.lang.Exceptionpublic static ACSLogParser getParser(ACSLogParserFactory.ParserTypes parserType) throws java.lang.Exception
This method allows to get a parser of a specific type and is thought for testing purposes.
If the type of the requested parser is not the type of the parser in use then a new parser is instantiated and returned but the parser in use remains untouched.
parserType - The type of the parser to instantiate. It can't be null.<{@link - Exception} in case of error instantiating the parser.java.lang.Exceptionpublic static ACSLogParserFactory.ParserTypes getParserType(ACSLogParser parserToCheck) throws java.lang.Exception
parser - The parser whose type has to be checked. It can't be null.java.lang.Exceptionpublic static ACSLogParserFactory.ParserTypes getParserType() throws java.lang.Exception
null if no parser is still in use
i.e. getParser() has not been executed yet.java.lang.Exception