Top Description Fields Constructors Methods
org.h2.security.auth

public Class H2AuthConfigXml

extends DefaultHandler
Class Inheritance
Imports
java.io.IOException, .InputStream, .StringReader, java.net.URL, javax.xml.XMLConstants, javax.xml.parsers.ParserConfigurationException, .SAXParser, .SAXParserFactory, org.xml.sax.Attributes, .InputSource, .SAXException, org.xml.sax.helpers.DefaultHandler

Parser of external authentication XML configuration file

Field Summary

Modifier and TypeField and Description
private HasConfigProperties
private H2AuthConfig

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
endElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
)

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

private static String
getAttributeValueOr(String attributeName, Attributes attributes, String defaultValue)

private static String
getMandatoryAttributeValue(String attributeName, Attributes attributes)

public H2AuthConfig

Returns:

Authenticator configuration.
getResult
()

Returns parsed authenticator configuration.

public static H2AuthConfig

Returns:

Authenticator configuration.
parseFrom
(URL
the source of the xml configuration.
url
)

Parse the xml.

public static H2AuthConfig

Returns:

Authenticator configuration.
parseFrom
(InputStream
the source of the xml configuration.
inputStream
)

Parse the xml.

public InputSource
resolveEntity(String
The public identifier, or null if none is available.
publicId
,
String
The system identifier provided in the XML document.
systemId
)

Overrides org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements org.xml.sax.EntityResolver.resolveEntity.

Resolve an external entity.

public void
startElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
,
Attributes
The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
attributes
)

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the start of an element.

Inherited from org.xml.sax.helpers.DefaultHandler:
charactersendDocumentendPrefixMappingerrorfatalErrorignorableWhitespacenotationDeclprocessingInstructionsetDocumentLocatorskippedEntitystartDocumentstartPrefixMappingunparsedEntityDeclwarning

Field Detail

lastConfigPropertiesback to summary
private HasConfigProperties lastConfigProperties
resultback to summary
private H2AuthConfig result

Constructor Detail

H2AuthConfigXmlback to summary
public H2AuthConfigXml()

Method Detail

endElementback to summary
public void endElement(String uri, String localName, String qName) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.helpers.DefaultHandler.endElement.

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Parameters
uri:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

localName:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName:String

The qualified name (with prefix), or the empty string if qualified names are not available.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
getAttributeValueOrback to summary
private static String getAttributeValueOr(String attributeName, Attributes attributes, String defaultValue)
getMandatoryAttributeValueback to summary
private static String getMandatoryAttributeValue(String attributeName, Attributes attributes) throws SAXException
getResultback to summary
public H2AuthConfig getResult()

Returns parsed authenticator configuration.

Returns:H2AuthConfig

Authenticator configuration.

parseFromback to summary
public static H2AuthConfig parseFrom(URL url) throws SAXException, IOException, ParserConfigurationException

Parse the xml.

Parameters
url:URL

the source of the xml configuration.

Returns:H2AuthConfig

Authenticator configuration.

Exceptions
SAXException:
for SAX errors.
IOException:
If an I/O error occurs
ParserConfigurationException:
if a parser cannot be created.
parseFromback to summary
public static H2AuthConfig parseFrom(InputStream inputStream) throws SAXException, IOException, ParserConfigurationException

Parse the xml.

Parameters
inputStream:InputStream

the source of the xml configuration.

Returns:H2AuthConfig

Authenticator configuration.

Exceptions
SAXException:
for SAX errors.
IOException:
If an I/O error occurs
ParserConfigurationException:
if a parser cannot be created.
resolveEntityback to summary
public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException

Overrides org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements org.xml.sax.EntityResolver.resolveEntity.

Doc from org.xml.sax.helpers.DefaultHandler.resolveEntity.

Resolve an external entity.

Always return null, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.

Parameters
publicId:String

The public identifier, or null if none is available.

systemId:String

The system identifier provided in the XML document.

Returns:InputSource

The new input source, or null to require the default behaviour.

Annotations
@Override
Exceptions
IOException:
If there is an error setting up the new input source.
SAXException:
Any SAX exception, possibly wrapping another exception.
startElementback to summary
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.DefaultHandler.startElement.

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Parameters
uri:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

localName:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName:String

The qualified name (with prefix), or the empty string if qualified names are not available.

attributes:Attributes

The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.