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'
- Version:
- $Revision: 1.1.1.1 $
- Author:
- David Waite
<dwaite@jabber.com>, $Author: lucky $
Field Summary |
private HandlerEntry |
defaultHandler
default Handler for tags and extensions which do not have a custom
handler |
private static java.lang.String |
FILENAME
filename for the Extension properties file, which is used
to generate the HandlerEntry hash |
private java.util.Hashtable |
hash
lookup list for tag -> HandlerEntry |
Constructor Summary |
HandlerFactory()
constructor, loads property file and fills in hash table |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
hash
private java.util.Hashtable hash
- lookup list for tag -> HandlerEntry
FILENAME
private static final java.lang.String FILENAME
- filename for the Extension properties file, which is used
to generate the HandlerEntry hash
defaultHandler
private HandlerEntry defaultHandler
- default Handler for tags and extensions which do not have a custom
handler
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
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 lookupattributes
- 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 nameattributes
- an AttributeList
holding attributes,
including XML namespaces- Returns:
- a
HandlerEntry
, if an appropriate one
exists.