org.jasig.portal.car
Class ChannelDefinitionTagHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.jasig.portal.car.ChannelDefinitionTagHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class ChannelDefinitionTagHandler
extends org.xml.sax.helpers.DefaultHandler

Processes all channel definitions located in a CAR and instantiates and delegates to an inner content handler for each block to do the real work of publishing.

Version:
$Revision: 1.3.4.1 $
Author:
Mark Boyd

Field Summary
private static java.lang.reflect.Constructor cDefaultConstructor
           
private static java.lang.reflect.Constructor cExtendedConstructor
           
private static java.lang.Class cHandlerClass
           
private  ParsingContext ctx
           
private static java.lang.String HANDLER_PROPERTY
           
private  org.xml.sax.ContentHandler handlerInstance
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
ChannelDefinitionTagHandler(ParsingContext ctx)
          Construct a ChannelDefinitionHandler that receives events from parsing a channel archive deployment descriptor but only for any contained channel-definition elements and their children.
 
Method Summary
private  org.xml.sax.ContentHandler castToContentHandler(java.lang.Object obj)
          Casts the object to a ContentHandler and logs any error that occurs.
 void characters(char[] ch, int start, int length)
          Handle the characters event to capture textual content for elements.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Handle the closing element event.
private  void getTheConstructor()
           
private  void initialize()
          Load an appropriate class for handling the channel definition content and publishing the channel specified therein.
private  java.lang.Object instantiateTheClass()
          Attempt to load an instance of the class.
private  void loadTheClass(java.lang.String handlerClass)
          Attempt to load the class specified.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Handle start element events.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

cHandlerClass

private static java.lang.Class cHandlerClass

cDefaultConstructor

private static java.lang.reflect.Constructor cDefaultConstructor

cExtendedConstructor

private static java.lang.reflect.Constructor cExtendedConstructor

handlerInstance

private org.xml.sax.ContentHandler handlerInstance

ctx

private ParsingContext ctx

HANDLER_PROPERTY

private static final java.lang.String HANDLER_PROPERTY
See Also:
Constant Field Values
Constructor Detail

ChannelDefinitionTagHandler

ChannelDefinitionTagHandler(ParsingContext ctx)
Construct a ChannelDefinitionHandler that receives events from parsing a channel archive deployment descriptor but only for any contained channel-definition elements and their children.

Parameters:
ctx -
Method Detail

initialize

private void initialize()
Load an appropriate class for handling the channel definition content and publishing the channel specified therein.


loadTheClass

private void loadTheClass(java.lang.String handlerClass)
Attempt to load the class specified.

Parameters:
handlerClass -

getTheConstructor

private void getTheConstructor()

instantiateTheClass

private java.lang.Object instantiateTheClass()
Attempt to load an instance of the class. The classes must support a default constructor but can optionally provide a constructor with a single argument of type DescriptorHandler. If found that constructor will be used. If not found then the default constructor wil be used.

Returns:

castToContentHandler

private org.xml.sax.ContentHandler castToContentHandler(java.lang.Object obj)
Casts the object to a ContentHandler and logs any error that occurs.

Parameters:
obj -
Returns:

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Handle start element events.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Handle the characters event to capture textual content for elements.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Handle the closing element event.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException