org.talika.tarsis.command.factory.xml
Class XmlCommandsHandler

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

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

Implementation of SAX handlers for Tarsis MVC Commands XML files.

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

Field Summary
static java.lang.String ACTION_TAG
          <action> tag.
static java.lang.String CACHEABLE_ATTR
          Cacheable atribute.
static java.lang.String CLASS_NAME_ATTR
          Class name atribute.
static java.lang.String COMMAND_TAG
          <command> tag.
static java.lang.String COMMANDS_TAG
          <commands> tag.
static java.lang.String DEFAULT_ATTR
          Default atribute.
static java.lang.String DTD_CLASSPATH
          DTD class path.
static java.lang.String DTD_PUBLICID
          DTD public id.
static java.lang.String DUPLICABLE_ATTR
          Duplicable atribute.
static java.lang.String FALSE_VALUE
          False value.
static java.lang.String FORWARD_VALUE
          Forward atribute.
static java.lang.String INCLUDE_VALUE
          Include atribute.
static java.lang.String INPUT_TAG
          <input> tag.
static java.lang.String MULTIPLE_ATTR
          Multiple atribute.
static java.lang.String NAME_ATTR
          Name atribute.
static java.lang.String PACKAGE_TAG
          <package> tag.
static java.lang.String PARAMETER_TAG
          <parameter> tag.
static java.lang.String PATH_ATTR
          Path atribute.
static java.lang.String REDIRECT_VALUE
          Redirect atribute.
static java.lang.String REQUIRED_ATTR
          Required atribute.
static java.lang.String SECURE_ATTR
          Secure atribute.
static java.lang.String SRC_ATTR
          Source attribute.
static java.lang.String STATEFULL_VALUE
          Statefull atribute.
static java.lang.String STATELESS_VALUE
          Stateless atribute.
static java.lang.String TRUE_VALUE
          True value.
static java.lang.String TYPE_ATTR
          Type atribute.
static java.lang.String VALIDABLE_ATTR
          Validable atribute.
static java.lang.String VIEW_TAG
          <view> tag.
 
Constructor Summary
XmlCommandsHandler(XmlCommandPackageLoader packageLoader)
          Creates a new XmlCommandsHandler 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.
 java.util.Map getCommands()
          Returns map of parsed commands.
protected  void processActionTag(org.xml.sax.Attributes atts)
          Process <action> tag.
protected  void processCommandTag(org.xml.sax.Attributes atts)
          Process <command> tag.
protected  void processInputTag(org.xml.sax.Attributes atts)
          Process <input> tag.
protected  void processPackageTag(org.xml.sax.Attributes atts)
          Process <package> tag.
protected  void processParameterTag(org.xml.sax.Attributes atts)
          Process <parameter> tag.
protected  void processViewTag(org.xml.sax.Attributes atts)
          Process <view> tag.
 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

COMMANDS_TAG

public static final java.lang.String COMMANDS_TAG
<commands> tag.

See Also:
Constant Field Values

PACKAGE_TAG

public static final java.lang.String PACKAGE_TAG
<package> tag.

See Also:
Constant Field Values

COMMAND_TAG

public static final java.lang.String COMMAND_TAG
<command> tag.

See Also:
Constant Field Values

ACTION_TAG

public static final java.lang.String ACTION_TAG
<action> tag.

See Also:
Constant Field Values

VIEW_TAG

public static final java.lang.String VIEW_TAG
<view> tag.

See Also:
Constant Field Values

INPUT_TAG

public static final java.lang.String INPUT_TAG
<input> tag.

See Also:
Constant Field Values

PARAMETER_TAG

public static final java.lang.String PARAMETER_TAG
<parameter> tag.

See Also:
Constant Field Values

NAME_ATTR

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

See Also:
Constant Field Values

SRC_ATTR

public static final java.lang.String SRC_ATTR
Source attribute.

See Also:
Constant Field Values

CACHEABLE_ATTR

public static final java.lang.String CACHEABLE_ATTR
Cacheable atribute.

See Also:
Constant Field Values

DUPLICABLE_ATTR

public static final java.lang.String DUPLICABLE_ATTR
Duplicable atribute.

See Also:
Constant Field Values

VALIDABLE_ATTR

public static final java.lang.String VALIDABLE_ATTR
Validable atribute.

See Also:
Constant Field Values

SECURE_ATTR

public static final java.lang.String SECURE_ATTR
Secure atribute.

See Also:
Constant Field Values

CLASS_NAME_ATTR

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

See Also:
Constant Field Values

PATH_ATTR

public static final java.lang.String PATH_ATTR
Path atribute.

See Also:
Constant Field Values

TYPE_ATTR

public static final java.lang.String TYPE_ATTR
Type atribute.

See Also:
Constant Field Values

REQUIRED_ATTR

public static final java.lang.String REQUIRED_ATTR
Required atribute.

See Also:
Constant Field Values

DEFAULT_ATTR

public static final java.lang.String DEFAULT_ATTR
Default atribute.

See Also:
Constant Field Values

MULTIPLE_ATTR

public static final java.lang.String MULTIPLE_ATTR
Multiple atribute.

See Also:
Constant Field Values

STATELESS_VALUE

public static final java.lang.String STATELESS_VALUE
Stateless atribute.

See Also:
Constant Field Values

STATEFULL_VALUE

public static final java.lang.String STATEFULL_VALUE
Statefull atribute.

See Also:
Constant Field Values

FORWARD_VALUE

public static final java.lang.String FORWARD_VALUE
Forward atribute.

See Also:
Constant Field Values

REDIRECT_VALUE

public static final java.lang.String REDIRECT_VALUE
Redirect atribute.

See Also:
Constant Field Values

INCLUDE_VALUE

public static final java.lang.String INCLUDE_VALUE
Include atribute.

See Also:
Constant Field Values

TRUE_VALUE

public static final java.lang.String TRUE_VALUE
True value.

See Also:
Constant Field Values

FALSE_VALUE

public static final java.lang.String FALSE_VALUE
False 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

XmlCommandsHandler

public XmlCommandsHandler(XmlCommandPackageLoader packageLoader)
Creates a new XmlCommandsHandler object.

Parameters:
packageLoader - XmlCommandPackageLoader package loader.
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)

getCommands

public java.util.Map getCommands()
Returns map of parsed commands.

Returns:
Map map of commands.

processPackageTag

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

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

processCommandTag

protected void processCommandTag(org.xml.sax.Attributes atts)
                          throws org.xml.sax.SAXParseException
Process <command> tag.

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

processActionTag

protected void processActionTag(org.xml.sax.Attributes atts)
                         throws org.xml.sax.SAXParseException
Process <action> tag.

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

processViewTag

protected void processViewTag(org.xml.sax.Attributes atts)
Process <view> tag.

Parameters:
atts - Attributes tag attributes.

processInputTag

protected void processInputTag(org.xml.sax.Attributes atts)
Process <input> tag.

Parameters:
atts - Attributes tag attributes.

processParameterTag

protected void processParameterTag(org.xml.sax.Attributes atts)
                            throws org.xml.sax.SAXParseException
Process <parameter> tag.

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


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