org.jabber.jabberbeans.sax
Class HandlerEntry

java.lang.Object
  |
  +--org.jabber.jabberbeans.sax.HandlerEntry

public class HandlerEntry
extends java.lang.Object

Each instance of this class is responsible for handling a single XML namesapce, or element type, All packet and extension types are represented by SubHandlers, and each subhandler per connection has an HandlerEntry.

Version:
$Revision: 1.1.1.1 $
Author:
David Waite <dwaite@jabber.com>, $Author: lucky $

Field Summary
private  java.lang.String builder
          String holding the name of the Class which is used to build an instance of this type, if one is easily identified.
private  java.lang.String description
          textual description of extension
private  java.lang.String element
          element, if this is an element (packet) type, otherwise null
private  java.lang.String handler
          String holding the name of the Class which is handler for XML parsing of this packet or extension
private  SubHandler handlerClass
          simple lazy cache of the handler to save on expensive Class.forName.newInstance() calls when doing a create.
private  java.lang.String product
          String holding the name of the Class which is the output of the handler (and builder, if there is one) of this Class
private  java.lang.String propPrefix
          The prefix of the entries in the .properties file, used for two-round lookup
private  java.lang.String xmlns
          xmlns, if this is an extension type, otherwise null
 
Constructor Summary
HandlerEntry(java.lang.String propPrefix, java.lang.String xmlns, java.lang.String element)
          Creates a new HandlerEntry instance.
 
Method Summary
 java.lang.String getBuilder()
          get the name of the class which is used to build instances of the product
 java.lang.String getDescription()
          get the textual description of what this element or namespace is used for
 java.lang.String getElement()
          gets the element associated with this entry, if any
 java.lang.String getHandler()
          get the name of the handler which is used to process XML and create instances of the product
 SubHandler getHandlerClass()
          get an instance of the handler for this entry - if none exists so far, one will be instantiated.
 java.lang.String getPrefix()
          get the Prefix associated with this entry in the .properties file
 java.lang.String getProduct()
          get the name of the class which is the product of the builder and handler, if only one class is the result
 java.lang.String getXMLNS()
          gets the XML namespace of associated with this entry, if any
 int hashCode()
          returns a hash value for entry into a HashTable
 SubHandler newInstance()
          creates a new instance of the handler for this entry, independant of the internal one-item cache.
 void setBuilder(java.lang.String b)
          set the name of the class which is used to build instances of the product
 void setDescription(java.lang.String desc)
          set the textual description of what this element or namespace is used for
 void setHandler(java.lang.String handler)
          set the name of the handler which is used to process XML and create instances of the product
 void setProduct(java.lang.String product)
          set the name of the class which is the product of the builder and handler, if only one class is the result
 java.lang.String toString()
          used to output a debug of the data in the Entry
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

description

private java.lang.String description
textual description of extension

element

private java.lang.String element
element, if this is an element (packet) type, otherwise null

xmlns

private java.lang.String xmlns
xmlns, if this is an extension type, otherwise null

handler

private java.lang.String handler
String holding the name of the Class which is handler for XML parsing of this packet or extension

builder

private java.lang.String builder
String holding the name of the Class which is used to build an instance of this type, if one is easily identified. Otherwise null

product

private java.lang.String product
String holding the name of the Class which is the output of the handler (and builder, if there is one) of this Class

handlerClass

private SubHandler handlerClass
simple lazy cache of the handler to save on expensive Class.forName.newInstance() calls when doing a create. Note that because this is one instance, there will be duplication of the HandlerEntry classes per connection

propPrefix

private java.lang.String propPrefix
The prefix of the entries in the .properties file, used for two-round lookup
Constructor Detail

HandlerEntry

public HandlerEntry(java.lang.String propPrefix,
                    java.lang.String xmlns,
                    java.lang.String element)
Creates a new HandlerEntry instance.
Parameters:
propPrefix - a String with the prefix in the .properties file
xmlns - a String with the XML namespace of the element, if any.
element - a String with the element name, if any
Method Detail

toString

public java.lang.String toString()
used to output a debug of the data in the Entry
Overrides:
toString in class java.lang.Object
Returns:
String with some data on this Entry

hashCode

public int hashCode()
returns a hash value for entry into a HashTable
Overrides:
hashCode in class java.lang.Object
Returns:
int hash value

getXMLNS

public java.lang.String getXMLNS()
gets the XML namespace of associated with this entry, if any
Returns:
a String value, or null if no namespace

getElement

public java.lang.String getElement()
gets the element associated with this entry, if any
Returns:
a String value, or null if no element

getPrefix

public java.lang.String getPrefix()
get the Prefix associated with this entry in the .properties file
Returns:
a String value

getBuilder

public java.lang.String getBuilder()
get the name of the class which is used to build instances of the product
Returns:
a String value, or null if none needed

setBuilder

public void setBuilder(java.lang.String b)
set the name of the class which is used to build instances of the product
Parameters:
b - a String value, or null if none needed

getHandler

public java.lang.String getHandler()
get the name of the handler which is used to process XML and create instances of the product
Returns:
a String value

setHandler

public void setHandler(java.lang.String handler)
set the name of the handler which is used to process XML and create instances of the product
Parameters:
handler - a String value

getProduct

public java.lang.String getProduct()
get the name of the class which is the product of the builder and handler, if only one class is the result
Returns:
a String value, or null if more than one possible

setProduct

public void setProduct(java.lang.String product)
set the name of the class which is the product of the builder and handler, if only one class is the result
Parameters:
product - a String value, or null if more than one possible

getDescription

public java.lang.String getDescription()
get the textual description of what this element or namespace is used for
Returns:
a String description

setDescription

public void setDescription(java.lang.String desc)
set the textual description of what this element or namespace is used for
Parameters:
desc - a String description

getHandlerClass

public SubHandler getHandlerClass()
                           throws java.lang.ClassNotFoundException,
                                  java.lang.InstantiationException,
                                  java.lang.IllegalAccessException
get an instance of the handler for this entry - if none exists so far, one will be instantiated. Note that you will need to create a new instance if you are going to do something like handle the same type of tag twice.
Returns:
a SubHandler value
Throws:
java.lang.ClassNotFoundException - if the class does not exist
java.lang.InstantiationException - if there is a problem creating the class
java.lang.IllegalAccessException - if there is an access problem with the class (such as it not being declared public)

newInstance

public SubHandler newInstance()
                       throws java.lang.ClassNotFoundException,
                              java.lang.InstantiationException,
                              java.lang.IllegalAccessException
creates a new instance of the handler for this entry, independant of the internal one-item cache.
Returns:
a new SubHandler
Throws:
java.lang.ClassNotFoundException - if the class does not exist
java.lang.InstantiationException - if there is a problem creating the class
java.lang.IllegalAccessException - if there is an access problem with the class (such as it not being declared public)