org.jabber.jabberbeans.sax
Class HandlerFactory

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

public class HandlerFactory
extends java.lang.Object

This class is responsible for translating xmlns="*" tags into appropriate object builders for creating Extension-derived objects. The objects returned from this factory are SAX handlers, which are then put in charge of the stream from the server until the extension is officially 'over'


Constructor Summary
HandlerFactory()
          constructor, loads property file and fills in hash table
 
Method Summary
 SubHandler getHandlerInstance(java.lang.String name, AttributeList attributes)
          locates and constructs the appropriate class handling the xmlns.
 HandlerEntry locateDefaultEntry()
          locates the default handler, the global handler that just contains the XML data and does not parse it into a java object.
 HandlerEntry locateEntry(java.lang.String XMLNS)
          locateEntry returns all information on the handler for a particular xmlns, if a handler is present.
 HandlerEntry locateEntry(java.lang.String name, AttributeList attributes)
          locateEntry scans for an appropriate handler, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerFactory

public HandlerFactory()
               throws java.io.FileNotFoundException,
                      java.io.IOException
constructor, loads property file and fills in hash table

Throws:
FileNotFounntException - if the properties file is not found
IOException - if there is another I/O problem getting the properties file
java.io.FileNotFoundException
Method Detail

getHandlerInstance

public SubHandler getHandlerInstance(java.lang.String name,
                                     AttributeList attributes)
locates and constructs the appropriate class handling the xmlns. If none is located, throws an exception. The default handler (i.e. one that just represents the xmlns and internal data as XML) is not included here, if you would like to use that handler aquire it with locateDefault

Parameters:
name - element name for lookup
attributes - attributes for lookup (scans for xmlns)
Returns:
SubHandler if an appropriate handler is found, otherwise null

locateEntry

public HandlerEntry locateEntry(java.lang.String XMLNS)
locateEntry returns all information on the handler for a particular xmlns, if a handler is present.

Parameters:
XMLNS - a String value
Returns:
an HandlerEntry value, or null if none available.

locateDefaultEntry

public HandlerEntry locateDefaultEntry()
locates the default handler, the global handler that just contains the XML data and does not parse it into a java object. Unhandled extensions are contained by these objects

Returns:
HandlerEntry of the default handler

locateEntry

public HandlerEntry locateEntry(java.lang.String name,
                                AttributeList attributes)
locateEntry scans for an appropriate handler, if any. It searches based on the element information passed from SAX on startElement event.

Parameters:
name - a String holding an element name
attributes - an AttributeList holding attributes, including XML namespaces
Returns:
a HandlerEntry, if an appropriate one exists.