cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/sitemap NotifyingGenerator.java
Date Sun, 30 Dec 2001 21:51:32 GMT
giacomo     01/12/30 13:51:32

  Added:       src/org/apache/cocoon/sitemap NotifyingGenerator.java
  Log:
  added patches from Nicola Ken Barozzi enhancing the Error Notification part of cocoon
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/org/apache/cocoon/sitemap/NotifyingGenerator.java
  
  Index: NotifyingGenerator.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.cocoon.sitemap;
  
  import java.util.Map;
  import java.io.IOException;
  
  import org.apache.avalon.excalibur.pool.Recyclable;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.components.notification.Notifying;
  import org.apache.cocoon.components.notification.Notifier;
  import org.apache.cocoon.components.notification.NotifyingObjects;
  import org.apache.cocoon.generation.ComposerGenerator;
  import org.apache.cocoon.environment.SourceResolver;
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.Constants;
  
  import org.xml.sax.SAXException;
  
  /**
   * Generates an XML representation of the current notification.
   *
   * @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a>
   * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
   * @author <a href="mailto:proyal@managingpartners.com">Peter Royal</a>
   * @created 31 July 2000
   * @version CVS $Revision: 1.1 $ $Date: 2001/12/30 21:51:32 $
   */
  public class NotifyingGenerator extends ComposerGenerator implements Recyclable {
    /**
     * The <code>Notification</code> to report.
     */
    private Notifying notification = null;
  
    public void setup(SourceResolver resolver, Map objectModel, String src,
            Parameters par) throws ProcessingException, SAXException, IOException {
      super.setup(resolver, objectModel, src, par);
  
      NotifyingObjects notifyingObjects = (NotifyingObjects)objectModel.get(Constants.NOTIFYING_OBJECTS);
      
      if ( notifyingObjects == null) {
        throw new ProcessingException("Expected NotifyingObjects not found in object model");
      }
      
      notification = notifyingObjects.getLastNotifying();
    }
  
    /**
     * Generate the notification information in XML format.
     *
     * @exception  SAXException  Description of problem there is creating the output SAX events.
     * @throws SAXException when there is a problem creating the
     *      output SAX events.
     */
    public void generate() throws SAXException {
      Notifier.notify(notification, this.contentHandler);
    }
  
    /**
     * Recycle
     */
    public void recycle() {
      super.recycle();
      this.notification = null;
    }
  }
  
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message