sylvain 02/01/01 12:38:50
Modified: src/org/apache/cocoon Constants.java
src/org/apache/cocoon/components/language/markup/sitemap/java
sitemap.xsl
src/org/apache/cocoon/components/notification
SimpleNotifyingBean.java
src/org/apache/cocoon/sitemap NotifyingGenerator.java
Log:
Patch from Nikola Ken Barozzi for a single Notifying object.
First commit in year 2002 !
Revision Changes Path
1.17 +3 -3 xml-cocoon2/src/org/apache/cocoon/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Constants.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Constants.java 30 Dec 2001 21:50:46 -0000 1.16
+++ Constants.java 1 Jan 2002 20:38:50 -0000 1.17
@@ -60,7 +60,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
- * @version CVS $Revision: 1.16 $ $Date: 2001/12/30 21:50:46 $
+ * @version CVS $Revision: 1.17 $ $Date: 2002/01/01 20:38:50 $
*/
public interface Constants {
@@ -263,9 +263,9 @@
String LINK_OBJECT = "link";
/**
- * The name of a <code>NotifyingObjects</code> object in the so called
objectModel <code>Map</code>.
+ * The name of a <code>NotifyingObject</code> in the so called objectModel
<code>Map</code>.
*/
- String NOTIFYING_OBJECTS = "notifying-objects";
+ String NOTIFYING_OBJECT = "notifying-object";
/**
* Describe variable <code>INDEX_URI</code> here.
1.60 +7 -9
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- sitemap.xsl 30 Dec 2001 21:50:46 -0000 1.59
+++ sitemap.xsl 1 Jan 2002 20:38:50 -0000 1.60
@@ -122,7 +122,7 @@
import org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper;
import org.apache.cocoon.components.notification.NotifyingBuilder;
import org.apache.cocoon.components.notification.Notifying;
- import org.apache.cocoon.components.notification.NotifyingObjects;
+ import org.apache.cocoon.components.notification.SimpleNotifyingBean;
/**
* This is the automatically generated class from the sitemap definitions
@@ -131,7 +131,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken
Barozzi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter
Royal</a>
- * @version CVS $Id: sitemap.xsl,v 1.59 2001/12/30 21:50:46 giacomo Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.60 2002/01/01 20:38:50 sylvain Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
static final String LOCATION = "<xsl:value-of select="translate(@file-path,
'/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -635,9 +635,9 @@
XPath kind expressions in values of src attribute used with
generate and transform elements */
List listOfMaps = (List) new ArrayList();
- //Adds Constants.NOTIFYING_OBJECTS to ObjectModel
+ //Adds Constants.NOTIFYING_OBJECT to ObjectModel
//NKB FIXME add to ObjectModel?
- environment.getObjectModel().put(Constants.NOTIFYING_OBJECTS, new
NotifyingObjects());
+ environment.getObjectModel().put(Constants.NOTIFYING_OBJECT, new
SimpleNotifyingBean(this));
SitemapRedirector redirector = new SitemapRedirector(environment);
<!-- process the pipelines -->
<!-- for each pipeline element generate a try/catch block -->
@@ -754,11 +754,9 @@
NotifyingBuilder notifyingBuilder=
(NotifyingBuilder)this.manager.lookup(NotifyingBuilder.ROLE);
if(de)getLogger().debug("Got "+notifyingBuilder);
Notifying currentNotifying = notifyingBuilder.build(this, e);
- if(de)getLogger().debug("Built "+currentNotifying);
- NotifyingObjects notifyingObjects =
(NotifyingObjects)objectModel.get(Constants.NOTIFYING_OBJECTS);
- if(de)getLogger().debug("Got "+notifyingObjects);
- notifyingObjects.addNotifying(currentNotifying);
- if(de)getLogger().debug("Added to "+notifyingObjects);
+ if(de)getLogger().debug("Built "+currentNotifying);
+ objectModel.put(Constants.NOTIFYING_OBJECT, currentNotifying );
+ if(de)getLogger().debug("Added to objectModel" + currentNotifying);
eventPipeline.setGenerator ("!notifying-generator!", e.getMessage(),
Parameters.EMPTY_PARAMETERS);
<xsl:apply-templates select="./*"/>
1.2 +6 -0
xml-cocoon2/src/org/apache/cocoon/components/notification/SimpleNotifyingBean.java
Index: SimpleNotifyingBean.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/notification/SimpleNotifyingBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleNotifyingBean.java 30 Dec 2001 21:50:46 -0000 1.1
+++ SimpleNotifyingBean.java 1 Jan 2002 20:38:50 -0000 1.2
@@ -57,6 +57,12 @@
*/
private HashMap extraDescriptions = new HashMap();
+ public SimpleNotifyingBean() {
+ this.sender = "unknown";
+ setSource(this.getClass().getName());
+ setTitle("Generic notification");
+ }
+
public SimpleNotifyingBean(Object sender) {
this.sender = sender.getClass().getName();
setSource(this.getClass().getName());
1.2 +5 -7
xml-cocoon2/src/org/apache/cocoon/sitemap/NotifyingGenerator.java
Index: NotifyingGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/NotifyingGenerator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NotifyingGenerator.java 30 Dec 2001 21:51:32 -0000 1.1
+++ NotifyingGenerator.java 1 Jan 2002 20:38:50 -0000 1.2
@@ -15,7 +15,6 @@
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;
@@ -30,7 +29,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
* @created 31 July 2000
- * @version CVS $Revision: 1.1 $ $Date: 2001/12/30 21:51:32 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/01/01 20:38:50 $
*/
public class NotifyingGenerator extends ComposerGenerator implements Recyclable {
/**
@@ -42,13 +41,12 @@
Parameters par) throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
- NotifyingObjects notifyingObjects =
(NotifyingObjects)objectModel.get(Constants.NOTIFYING_OBJECTS);
+ notification = (Notifying)objectModel.get(Constants.NOTIFYING_OBJECT);
- if ( notifyingObjects == null) {
- throw new ProcessingException("Expected NotifyingObjects not found in object
model");
+ if ( notification == null) {
+ throw new ProcessingException("Expected Constants.NOTIFYING_OBJECT not found
in object model");
}
-
- notification = notifyingObjects.getLastNotifying();
+
}
/**
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]