Package org.h2.security.auth
Class H2AuthConfigXml
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.h2.security.auth.H2AuthConfigXml
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
Parser of external authentication XML configuration file
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
endElement
(String uri, String localName, String qName) private static String
getAttributeValueOr
(String attributeName, Attributes attributes, String defaultValue) private static String
getMandatoryAttributeValue
(String attributeName, Attributes attributes) Returns parsed authenticator configuration.static H2AuthConfig
parseFrom
(InputStream inputStream) Parse the xml.static H2AuthConfig
Parse the xml.void
startElement
(String uri, String localName, String qName, Attributes attributes) Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
result
-
lastConfigProperties
-
-
Constructor Details
-
H2AuthConfigXml
public H2AuthConfigXml()
-
-
Method Details
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
getMandatoryAttributeValue
private static String getMandatoryAttributeValue(String attributeName, Attributes attributes) throws SAXException - Throws:
SAXException
-
getAttributeValueOr
private static String getAttributeValueOr(String attributeName, Attributes attributes, String defaultValue) -
getResult
Returns parsed authenticator configuration.- Returns:
- Authenticator configuration.
-
parseFrom
public static H2AuthConfig parseFrom(URL url) throws SAXException, IOException, ParserConfigurationException Parse the xml.- Parameters:
url
- the source of the xml configuration.- Returns:
- Authenticator configuration.
- Throws:
ParserConfigurationException
- if a parser cannot be created.SAXException
- for SAX errors.IOException
- If an I/O error occurs
-
parseFrom
public static H2AuthConfig parseFrom(InputStream inputStream) throws SAXException, IOException, ParserConfigurationException Parse the xml.- Parameters:
inputStream
- the source of the xml configuration.- Returns:
- Authenticator configuration.
- Throws:
ParserConfigurationException
- if a parser cannot be created.SAXException
- for SAX errors.IOException
- If an I/O error occurs
-