1 16 package org.apache.cocoon.sitemap; 17 18 import java.util.Map ; 19 import java.io.IOException ; 20 21 import org.apache.avalon.framework.parameters.Parameters; 22 import org.apache.cocoon.components.notification.Notifying; 23 import org.apache.cocoon.components.notification.Notifier; 24 import org.apache.cocoon.generation.AbstractGenerator; 25 import org.apache.cocoon.environment.SourceResolver; 26 import org.apache.cocoon.ProcessingException; 27 import org.apache.cocoon.Constants; 28 29 import org.xml.sax.SAXException ; 30 31 39 public class NotifyingGenerator extends AbstractGenerator { 40 41 44 private Notifying notification; 45 46 public void setup(SourceResolver resolver, Map objectModel, String src, 47 Parameters par) throws ProcessingException, SAXException , IOException { 48 super.setup(resolver, objectModel, src, par); 49 50 this.notification = (Notifying)objectModel.get(Constants.NOTIFYING_OBJECT); 51 52 if ( this.notification == null) { 53 throw new ProcessingException("Expected Constants.NOTIFYING_OBJECT not found in object model"); 54 } 55 } 56 57 63 public void generate() throws SAXException { 64 Notifier.notify(notification, this.contentHandler, "text/xml"); 65 } 66 67 70 public void recycle() { 71 super.recycle(); 72 this.notification = null; 73 } 74 } 75 76 | Popular Tags |