Package org.h2.security.auth
Class H2AuthConfigXml
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.h2.security.auth.H2AuthConfigXml
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class H2AuthConfigXml extends org.xml.sax.helpers.DefaultHandler
Parser of external authentication XML configuration file
-
-
Field Summary
Fields Modifier and Type Field Description private HasConfigProperties
lastConfigProperties
private H2AuthConfig
result
-
Constructor Summary
Constructors Constructor Description H2AuthConfigXml()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
private static java.lang.String
getAttributeValueOr(java.lang.String attributeName, org.xml.sax.Attributes attributes, java.lang.String defaultValue)
private static java.lang.String
getMandatoryAttributeValue(java.lang.String attributeName, org.xml.sax.Attributes attributes)
H2AuthConfig
getResult()
Returns parsed authenticator configuration.static H2AuthConfig
parseFrom(java.io.InputStream inputStream)
Parse the xml.static H2AuthConfig
parseFrom(java.net.URL url)
Parse the xml.void
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
-
-
-
Field Detail
-
result
private H2AuthConfig result
-
lastConfigProperties
private HasConfigProperties lastConfigProperties
-
-
Method Detail
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
getMandatoryAttributeValue
private static java.lang.String getMandatoryAttributeValue(java.lang.String attributeName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
getAttributeValueOr
private static java.lang.String getAttributeValueOr(java.lang.String attributeName, org.xml.sax.Attributes attributes, java.lang.String defaultValue)
-
getResult
public H2AuthConfig getResult()
Returns parsed authenticator configuration.- Returns:
- Authenticator configuration.
-
parseFrom
public static H2AuthConfig parseFrom(java.net.URL url) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
Parse the xml.- Parameters:
url
- the source of the xml configuration.- Returns:
- Authenticator configuration.
- Throws:
javax.xml.parsers.ParserConfigurationException
- if a parser cannot be created.org.xml.sax.SAXException
- for SAX errors.java.io.IOException
- If an I/O error occurs
-
parseFrom
public static H2AuthConfig parseFrom(java.io.InputStream inputStream) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
Parse the xml.- Parameters:
inputStream
- the source of the xml configuration.- Returns:
- Authenticator configuration.
- Throws:
javax.xml.parsers.ParserConfigurationException
- if a parser cannot be created.org.xml.sax.SAXException
- for SAX errors.java.io.IOException
- If an I/O error occurs
-
-