org.jasig.portal.layout.dlm.processing
Class ExampleBookmarksRemover

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by org.jasig.portal.layout.dlm.processing.ExampleBookmarksRemover
All Implemented Interfaces:
ISaxProcessor, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader

public class ExampleBookmarksRemover
extends XMLFilterImpl
implements ISaxProcessor

A sample processor that strips all SAX events related to the Bookmarks channel from the SAX stream representing the user's layout to portray how an implementation of ISaxProcessor can affect the SAX event stream by removing, changing, or injecting events. This is accomplished by watching for a channel with a "name" attributed of "Bookmarks".

Author:
Mark Boyd

Constructor Summary
ExampleBookmarksRemover()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Handle character content by stripping character events if they are nested within the Bookmarks channel's events.
 void endElement(String uri, String localName, String qName)
          Watches for the end of events of the Bookmarks channel stripping out those nested within and passing those that are without.
 String getCacheKey()
          Return a suitable cache key indicative of the SAX event stream passing through this class.
 ContentHandler getContentHandler(ContentHandler handler)
          Returns this class wrapping the passed-in ContentHandler to which events are pushed.
 void startElement(String uri, String localName, String qName, Attributes atts)
          Watches for the start of events related to a Bookmarks channel and strips off all starting events for elements nested within while passing all those that are without.
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleBookmarksRemover

public ExampleBookmarksRemover()
Method Detail

getCacheKey

public String getCacheKey()
Return a suitable cache key indicative of the SAX event stream passing through this class. Since it will always remove an instance of the Bookmarks channel if one is seen in the stream, this returned cache key will never be empty.

Specified by:
getCacheKey in interface ISaxProcessor
Returns:
String
See Also:
ProcessingPipe.getCacheKey()

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Handle character content by stripping character events if they are nested within the Bookmarks channel's events.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class XMLFilterImpl
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Watches for the end of events of the Bookmarks channel stripping out those nested within and passing those that are without.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class XMLFilterImpl
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Watches for the start of events related to a Bookmarks channel and strips off all starting events for elements nested within while passing all those that are without.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class XMLFilterImpl
Throws:
SAXException

getContentHandler

public ContentHandler getContentHandler(ContentHandler handler)
Returns this class wrapping the passed-in ContentHandler to which events are pushed.

Specified by:
getContentHandler in interface ISaxProcessor
See Also:
ISaxProcessor.getContentHandler(org.xml.sax.ContentHandler)


Copyright © 2010 Jasig. All Rights Reserved.