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 TypeMethodDescriptionvoidendElement(String uri, String localName, String qName) private static StringgetAttributeValueOr(String attributeName, Attributes attributes, String defaultValue) private static StringgetMandatoryAttributeValue(String attributeName, Attributes attributes) Returns parsed authenticator configuration.static H2AuthConfigparseFrom(InputStream inputStream) Parse the xml.static H2AuthConfigParse the xml.voidstartElement(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin 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
-