org.talika.tarsis.context
Class XmlConfigHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.talika.tarsis.context.XmlConfigHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public final class XmlConfigHandler
extends org.xml.sax.helpers.DefaultHandler

Loads context configuration from an XML file.

Version:
$Revision: 117 $
Author:
Jose M. Palomar

Field Summary
static java.lang.String AUTH_PARAM_TAG
          <auth-param> tag.
static java.lang.String AUTHC_TAG
          <authenticator> tag.
static java.lang.String AUTHZ_TAG
          <authorizator> tag.
static java.lang.String CLASS_NAME_ATTR
          Class name attribute.
static java.lang.String CMD_FACTORY_PARAM_TAG
          <command-factory-param> tag.
static java.lang.String CMD_FACTORY_TAG
          <command-factory> tag.
static java.lang.String CONFIG_TAG
          <tarsis-config> tag.
static java.lang.String DEBUG_VALUE
          Debug log level value.
static java.lang.String DTD_CLASSPATH
          DTD class path.
static java.lang.String DTD_PUBLICID
          DTD public id.
static java.lang.String ERROR_VALUE
          Error log level value.
static java.lang.String FACTORY_PARAM_TAG
          <factory-param> tag.
static java.lang.String FACTORY_TAG
          <factory> tag.
static java.lang.String INFO_VALUE
          Info log level value.
static java.lang.String INIT_PARAM_TAG
          <init-param> tag.
static java.lang.String LOG_LVL_ATTR
          Log level attribute.
static java.lang.String LOG_PARAM_TAG
          <log-param> tag.
static java.lang.String LOG_TAG
          <log> tag.
static java.lang.String NAME_ATTR
          Name attribute.
static java.lang.String PANIC_VALUE
          Panic log level value.
static java.lang.String PRELOAD_ATTR
          Preload attribute.
static java.lang.String SECURITY_TAG
          <security> tag.
static java.lang.String VALUE_ATTR
          Value attribute.
static java.lang.String WARNING_VALUE
          Warning log level value.
 
Constructor Summary
XmlConfigHandler()
          Creates a new XmlConfigHandler object.
 
Method Summary
 void endDocument()
          Receive notification of the end of a document.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name)
          Receive notification of the end of an element.
 void error(org.xml.sax.SAXParseException spe)
          Receive notification of a recoverable error.
 void fatalError(org.xml.sax.SAXParseException spe)
          Receive notification of a non-recoverable error.
 AuthenticatorService getAuthenticathor()
          Returns parsed Authenticator instance.
 AuthorizatorService getAuthorizator()
          Returns parsed Authorizator instance.
 CommandFactoryService getCommandFactory()
          Returns parsed CommandFactory instance.
 java.util.Map getFactories()
          Returns parsed Factory isntances map.
 java.util.Map getInitParameters()
          Returns parsed init parameters map.
 java.util.Collection getLoggers()
          Returns parsed Logger instances list.
protected  void processAuthenticatorTag(org.xml.sax.Attributes atts)
          Process <authenticator> tag.
protected  void processAuthorizatorTag(org.xml.sax.Attributes atts)
          Process <authorizator> tag.
protected  void processCommandFactoryTag(org.xml.sax.Attributes atts)
          Process <command-factory> tag.
protected  void processFactoryTag(org.xml.sax.Attributes atts)
          Process <factory> tag.
protected  void processInitParamTag(org.xml.sax.Attributes atts)
          Process <init-param> tag.
protected  void processLogTag(org.xml.sax.Attributes atts)
          Process <log> tag.
protected  void processParamTag(org.xml.sax.Attributes atts)
          Process <XXXX-param> tags.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Allow the application to resolve external entities.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes atts)
          Receive notification of the beginning of an element.
 void warning(org.xml.sax.SAXParseException spe)
          Receive notification of a warning.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_TAG

public static final java.lang.String CONFIG_TAG
<tarsis-config> tag.

See Also:
Constant Field Values

INIT_PARAM_TAG

public static final java.lang.String INIT_PARAM_TAG
<init-param> tag.

See Also:
Constant Field Values

SECURITY_TAG

public static final java.lang.String SECURITY_TAG
<security> tag.

See Also:
Constant Field Values

AUTHC_TAG

public static final java.lang.String AUTHC_TAG
<authenticator> tag.

See Also:
Constant Field Values

AUTHZ_TAG

public static final java.lang.String AUTHZ_TAG
<authorizator> tag.

See Also:
Constant Field Values

AUTH_PARAM_TAG

public static final java.lang.String AUTH_PARAM_TAG
<auth-param> tag.

See Also:
Constant Field Values

LOG_TAG

public static final java.lang.String LOG_TAG
<log> tag.

See Also:
Constant Field Values

LOG_PARAM_TAG

public static final java.lang.String LOG_PARAM_TAG
<log-param> tag.

See Also:
Constant Field Values

FACTORY_TAG

public static final java.lang.String FACTORY_TAG
<factory> tag.

See Also:
Constant Field Values

FACTORY_PARAM_TAG

public static final java.lang.String FACTORY_PARAM_TAG
<factory-param> tag.

See Also:
Constant Field Values

CMD_FACTORY_TAG

public static final java.lang.String CMD_FACTORY_TAG
<command-factory> tag.

See Also:
Constant Field Values

CMD_FACTORY_PARAM_TAG

public static final java.lang.String CMD_FACTORY_PARAM_TAG
<command-factory-param> tag.

See Also:
Constant Field Values

NAME_ATTR

public static final java.lang.String NAME_ATTR
Name attribute.

See Also:
Constant Field Values

CLASS_NAME_ATTR

public static final java.lang.String CLASS_NAME_ATTR
Class name attribute.

See Also:
Constant Field Values

VALUE_ATTR

public static final java.lang.String VALUE_ATTR
Value attribute.

See Also:
Constant Field Values

LOG_LVL_ATTR

public static final java.lang.String LOG_LVL_ATTR
Log level attribute.

See Also:
Constant Field Values

PRELOAD_ATTR

public static final java.lang.String PRELOAD_ATTR
Preload attribute.

See Also:
Constant Field Values

DEBUG_VALUE

public static final java.lang.String DEBUG_VALUE
Debug log level value.

See Also:
Constant Field Values

INFO_VALUE

public static final java.lang.String INFO_VALUE
Info log level value.

See Also:
Constant Field Values

WARNING_VALUE

public static final java.lang.String WARNING_VALUE
Warning log level value.

See Also:
Constant Field Values

ERROR_VALUE

public static final java.lang.String ERROR_VALUE
Error log level value.

See Also:
Constant Field Values

PANIC_VALUE

public static final java.lang.String PANIC_VALUE
Panic log level value.

See Also:
Constant Field Values

DTD_PUBLICID

public static final java.lang.String DTD_PUBLICID
DTD public id.

See Also:
Constant Field Values

DTD_CLASSPATH

public static final java.lang.String DTD_CLASSPATH
DTD class path.

See Also:
Constant Field Values
Constructor Detail

XmlConfigHandler

public XmlConfigHandler()
Creates a new XmlConfigHandler object.

Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of a document.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of a document.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endDocument()

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String name,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI - 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.
name - String The qualified name (with prefix), or the empty string if qualified names are not available.
atts - Attributes The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startElement(String, String, String, Attributes)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String name)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI - 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.
name - String The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endElement(String, String, String)

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
Allow the application to resolve external entities.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Parameters:
publicId - String The public identifier of the external entity being referenced, or null if none was supplied.
systemId - String The system identifier of the external entity being referenced.
Returns:
InputSource A Java-specific IO exception, possibly the result of creating a new InputStream or Reader for the InputSource.
See Also:
EntityResolver.resolveEntity(String, String)

warning

public void warning(org.xml.sax.SAXParseException spe)
             throws org.xml.sax.SAXException
Receive notification of a warning.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - SAXParseException The warning information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(SAXParseException)

error

public void error(org.xml.sax.SAXParseException spe)
           throws org.xml.sax.SAXException
Receive notification of a recoverable error.

Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - SAXParseException The error information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.error(SAXParseException)

fatalError

public void fatalError(org.xml.sax.SAXParseException spe)
                throws org.xml.sax.SAXException
Receive notification of a non-recoverable error.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - SAXParseException The error information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.fatalError(SAXParseException)

getInitParameters

public java.util.Map getInitParameters()
Returns parsed init parameters map.

Returns:
Map parsed init parameters map.

getLoggers

public java.util.Collection getLoggers()
Returns parsed Logger instances list.

Returns:
Collection parsed Logger instances list.

getAuthenticathor

public AuthenticatorService getAuthenticathor()
Returns parsed Authenticator instance.

Returns:
AuthenticatorService parsed Authenticator instance or null if none have been parsed.

getAuthorizator

public AuthorizatorService getAuthorizator()
Returns parsed Authorizator instance.

Returns:
AuthorizatorService parsed AuthorizatorService instance or null if non hava been parsed.

getFactories

public java.util.Map getFactories()
Returns parsed Factory isntances map.

Returns:
Map parsed Factory isntances map.

getCommandFactory

public CommandFactoryService getCommandFactory()
Returns parsed CommandFactory instance.

Returns:
CommandFactoryService parsed CommandFactory instance.

processInitParamTag

protected void processInitParamTag(org.xml.sax.Attributes atts)
Process <init-param> tag.

Parameters:
atts - Attributes tag attributes.

processAuthenticatorTag

protected void processAuthenticatorTag(org.xml.sax.Attributes atts)
                                throws org.xml.sax.SAXException
Process <authenticator> tag.

Parameters:
atts - Attributes tag attributes.
Throws:
org.xml.sax.SAXException - if there is an error while processing tag.

processAuthorizatorTag

protected void processAuthorizatorTag(org.xml.sax.Attributes atts)
                               throws org.xml.sax.SAXException
Process <authorizator> tag.

Parameters:
atts - Attributes tag attributes.
Throws:
org.xml.sax.SAXException - if there is an error while processing tag.

processLogTag

protected void processLogTag(org.xml.sax.Attributes atts)
                      throws org.xml.sax.SAXException
Process <log> tag.

Parameters:
atts - Attributes tag attributes.
Throws:
org.xml.sax.SAXException - if there is an error while processing tag.

processFactoryTag

protected void processFactoryTag(org.xml.sax.Attributes atts)
                          throws org.xml.sax.SAXException
Process <factory> tag.

Parameters:
atts - Attributes tag attributes.
Throws:
org.xml.sax.SAXException - if there is an error while processing tag.

processCommandFactoryTag

protected void processCommandFactoryTag(org.xml.sax.Attributes atts)
                                 throws org.xml.sax.SAXException
Process <command-factory> tag.

Parameters:
atts - Attributes tag attributes.
Throws:
org.xml.sax.SAXException - if there is an error while processing tag.

processParamTag

protected void processParamTag(org.xml.sax.Attributes atts)
Process <XXXX-param> tags.

Parameters:
atts - Attributes tag attributes.


Copyright © 2002-2012 Talika Open Source Group. All Rights Reserved.