vgritsenko 2003/02/11 18:56:14 Modified: src/java/org/apache/cocoon/sitemap Tag: cocoon_2_0_3_branch NotifyingGenerator.java src/java/org/apache/cocoon/components/notification Tag: cocoon_2_0_3_branch DefaultNotifyingBuilder.java Notifier.java Notifying.java NotifyingBuilder.java NotifyingCascadingRuntimeException.java SimpleNotifyingBean.java Log: Sync exception handling changes with head: * 4-space-indent the code * Fix NPE possibility in notifying builder Revision Changes Path No revision No revision 1.4.2.3 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/sitemap/NotifyingGenerator.java Index: NotifyingGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/NotifyingGenerator.java,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -u -r1.4.2.2 -r1.4.2.3 --- NotifyingGenerator.java 7 Feb 2003 07:22:51 -0000 1.4.2.2 +++ NotifyingGenerator.java 12 Feb 2003 02:56:14 -0000 1.4.2.3 @@ -98,7 +98,7 @@ * output SAX events. */ public void generate() throws SAXException { - Notifier.notify(notification, this.contentHandler); + Notifier.notify(notification, this.contentHandler, "text/xml"); } /** No revision No revision 1.6.2.5 +150 -147 xml-cocoon2/src/java/org/apache/cocoon/components/notification/DefaultNotifyingBuilder.java Index: DefaultNotifyingBuilder.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/DefaultNotifyingBuilder.java,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -u -r1.6.2.4 -r1.6.2.5 --- DefaultNotifyingBuilder.java 7 Feb 2003 07:19:14 -0000 1.6.2.4 +++ DefaultNotifyingBuilder.java 12 Feb 2003 02:56:14 -0000 1.6.2.5 @@ -73,159 +73,162 @@ */ public class DefaultNotifyingBuilder implements NotifyingBuilder, Component { - /** Builds a Notifying object (SimpleNotifyingBean in this case) - * that tries to explain what the Object o can reveal. - * @param sender who sent this Object. - * @param o the object to use when building the SimpleNotifyingBean - * @return the Notifying Object that was build - * @see org.apache.cocoon.components.notification.Notifying - */ - public Notifying build (Object sender, Object o) { - if (o instanceof Notifying) { - return (Notifying) o; - } else if (o instanceof Throwable) { - Throwable t = (Throwable) o; - SimpleNotifyingBean n = new SimpleNotifyingBean(sender); - n.setType("error"); - n.setTitle("An error occurred"); - if (t != null) { - - n.setSource(t.getClass().getName()); - - Throwable rootCauseThrowable = getRootCause(t); - n.addExtraDescription("original message", rootCauseThrowable.toString()); - - if (rootCauseThrowable instanceof SAXParseException) { - - SAXParseException saxParseException = (SAXParseException) rootCauseThrowable; - n.setMessage ( saxParseException.getMessage() ); - n.addExtraDescription("location", String.valueOf(saxParseException.getSystemId()) ); - n.addExtraDescription("line" , String.valueOf(saxParseException.getLineNumber()) ); - n.addExtraDescription("column" , String.valueOf(saxParseException.getColumnNumber())); - } else if (rootCauseThrowable instanceof TransformerException) { - TransformerException transformerException = (TransformerException) rootCauseThrowable; - SourceLocator sourceLocator = transformerException.getLocator(); - n.setMessage ( transformerException.getMessage()); - - if( null != sourceLocator ) - { - n.addExtraDescription("location", String.valueOf(sourceLocator.getSystemId()) ); - n.addExtraDescription("line" , String.valueOf(sourceLocator.getLineNumber()) ); - n.addExtraDescription("column" , String.valueOf(sourceLocator.getColumnNumber()) ); + /** + * Builds a Notifying object (SimpleNotifyingBean in this case) + * that tries to explain what the Object o can reveal. + * @param sender who sent this Object. + * @param o the object to use when building the SimpleNotifyingBean + * @return the Notifying Object that was build + * @see org.apache.cocoon.components.notification.Notifying + */ + public Notifying build (Object sender, Object o) { + if (o instanceof Notifying) { + return (Notifying) o; + } else if (o instanceof Throwable) { + Throwable t = (Throwable) o; + SimpleNotifyingBean n = new SimpleNotifyingBean(sender); + n.setType(Notifying.ERROR_NOTIFICATION); + n.setTitle("An error occurred"); + if (t != null) { + n.setSource(t.getClass().getName()); + + Throwable rootCauseThrowable = getRootCause(t); + n.addExtraDescription(Notifying.EXTRA_CAUSE, rootCauseThrowable.toString()); + + if (rootCauseThrowable instanceof SAXParseException) { + SAXParseException saxParseException = (SAXParseException) rootCauseThrowable; + n.setMessage ( saxParseException.getMessage() ); + n.addExtraDescription(Notifying.EXTRA_LOCATION, + String.valueOf(saxParseException.getSystemId())); + n.addExtraDescription(Notifying.EXTRA_LINE, + String.valueOf(saxParseException.getLineNumber())); + n.addExtraDescription(Notifying.EXTRA_COLUMN, + String.valueOf(saxParseException.getColumnNumber())); + } else if (rootCauseThrowable instanceof TransformerException) { + TransformerException transformerException = (TransformerException) rootCauseThrowable; + SourceLocator sourceLocator = transformerException.getLocator(); + n.setMessage ( transformerException.getMessage() ); + + if (null != sourceLocator) { + n.addExtraDescription(Notifying.EXTRA_LOCATION, + String.valueOf(sourceLocator.getSystemId())); + n.addExtraDescription(Notifying.EXTRA_LINE, + String.valueOf(sourceLocator.getLineNumber())); + n.addExtraDescription(Notifying.EXTRA_COLUMN, + String.valueOf(sourceLocator.getColumnNumber())); + } + } else { + n.setMessage(t.getMessage()); + } + + n.setDescription(t.toString()); + + // Get the stacktrace: if the exception is a SAXException, + // the stacktrace of the embedded exception is used as the + // SAXException does not append it automatically + Throwable stackTraceException; + if (t instanceof SAXException && ((SAXException) t).getException() != null) { + stackTraceException = ((SAXException) t).getException(); + } else { + stackTraceException = t; + } + // org.apache.avalon.framework.ExceptionUtil.captureStackTrace(); + StringWriter sw = new StringWriter(); + stackTraceException.printStackTrace(new PrintWriter(sw)); + n.addExtraDescription(Notifying.EXTRA_STACKTRACE, sw.toString()); + // Add nested throwables description + sw = new StringWriter(); + appendCauses(new PrintWriter(sw), stackTraceException); + String causes = sw.toString(); + if (causes != null && causes.length() != 0) { + n.addExtraDescription(Notifying.EXTRA_FULLTRACE, causes); + } } + return n; } else { - n.setMessage(t.getMessage()); + SimpleNotifyingBean n = new SimpleNotifyingBean(sender); + n.setType(Notifying.UNKNOWN_NOTIFICATION); + n.setTitle("Object notification"); + n.setMessage(String.valueOf(o)); + n.setDescription("No details available."); + return n; } - - n.setDescription(t.toString()); - - // get the stacktrace: if the exception is a SAXException, - // the stacktrace of the embedded exception is used as the - // SAXException does not append it automatically - Throwable stackTraceException; - if (t instanceof SAXException && ((SAXException) t).getException() != null) { - stackTraceException = ((SAXException) t).getException(); - } else { - stackTraceException = t; - } - //org.apache.avalon.framework.ExceptionUtil.captureStackTrace(); - StringWriter sw = new StringWriter(); - stackTraceException.printStackTrace(new PrintWriter(sw)); - n.addExtraDescription("stacktrace", sw.toString()); - // Add nested throwables description - sw = new StringWriter(); - appendCauses(new PrintWriter(sw), stackTraceException); - String causes = sw.toString(); - if (causes != null && causes.length() != 0) { - n.addExtraDescription("full exception chain stacktrace", causes); - } - } - return n; - } else { - SimpleNotifyingBean n = new SimpleNotifyingBean(sender); - n.setType("unknown"); - n.setTitle("Object notification"); - n.setSource(o.getClass().getName()); - n.setMessage(o.toString()); - n.setDescription("No details available."); - return n; } - } - /** Builds a Notifying object (SimpleNotifyingBean in this case) - * that explains a notification. - * @param sender who sent this Object. - * @param o the object to use when building the SimpleNotifyingBean - * @param type see the Notifying apidocs - * @param title see the Notifying apidocs - * @param source see the Notifying apidocs - * @param message see the Notifying apidocs - * @param description see the Notifying apidocs - * @param extra see the Notifying apidocs - * @return the Notifying Object that was build - * @see org.apache.cocoon.components.notification.Notifying - */ - public Notifying build(Object sender, Object o, String type, String title, - String source, String message, String description, Map extra) { - //NKB Cast here is secure, the method is of this class - SimpleNotifyingBean n = (SimpleNotifyingBean) build (sender, o); - - if (type != null) - n.setType(type); - if (title != null) - n.setTitle(title); - if (source != null) - n.setSource(source); - if (message != null) - n.setMessage(message); - if (description != null) - n.setDescription(description); - if (extra != null) - n.replaceExtraDescriptions(extra); - - return n; - } - - - /** - * Print recursively all nested causes of a Throwable in a PrintWriter. - */ - private static void appendCauses (PrintWriter out, Throwable t) { - Throwable cause = null; - if (t instanceof CascadingThrowable) { - cause = ((CascadingThrowable) t).getCause(); - } else if (t instanceof SAXException) { - cause = ((SAXException) t).getException(); - } else if (t instanceof java.sql.SQLException) { - cause = ((java.sql.SQLException) t).getNextException(); - } - if (cause != null) { - out.print("Original exception : "); - cause.printStackTrace(out); - out.println(); - // Recurse - appendCauses(out, cause); + /** + * Builds a Notifying object (SimpleNotifyingBean in this case) + * that explains a notification. + * @param sender who sent this Object. + * @param o the object to use when building the SimpleNotifyingBean + * @param type see the Notifying apidocs + * @param title see the Notifying apidocs + * @param source see the Notifying apidocs + * @param message see the Notifying apidocs + * @param description see the Notifying apidocs + * @param extra see the Notifying apidocs + * @return the Notifying Object that was build + * @see org.apache.cocoon.components.notification.Notifying + */ + public Notifying build(Object sender, Object o, String type, String title, + String source, String message, String description, Map extra) { + // NKB Cast here is secure, the method is of this class + SimpleNotifyingBean n = (SimpleNotifyingBean) build (sender, o); + + if (type != null) + n.setType(type); + if (title != null) + n.setTitle(title); + if (source != null) + n.setSource(source); + if (message != null) + n.setMessage(message); + if (description != null) + n.setDescription(description); + if (extra != null) + n.addExtraDescriptions(extra); + + return n; } - } - /** - * Get root Exception. - */ - private static Throwable getRootCause (Throwable t) { - Throwable cause = null; - if (t instanceof CascadingThrowable) { - cause = ((CascadingThrowable) t).getCause(); - } else if (t instanceof SAXException) { - cause = ((SAXException) t).getException(); - } else if (t instanceof java.sql.SQLException) { - cause = ((java.sql.SQLException) t).getNextException(); + + /** + * Print recursively all nested causes of a Throwable in a PrintWriter. + */ + private static void appendCauses (PrintWriter out, Throwable t) { + Throwable cause = null; + if (t instanceof CascadingThrowable) { + cause = ((CascadingThrowable) t).getCause(); + } else if (t instanceof SAXException) { + cause = ((SAXException) t).getException(); + } else if (t instanceof java.sql.SQLException) { + cause = ((java.sql.SQLException) t).getNextException(); + } + if (cause != null) { + out.print("Original exception : "); + cause.printStackTrace(out); + out.println(); + // Recurse + appendCauses(out, cause); + } } - if (cause == null) { - return t; - } else { - // Recurse - return getRootCause(cause); + + /** + * Get root Exception. + */ + public static Throwable getRootCause (Throwable t) { + Throwable cause = null; + if (t instanceof CascadingThrowable) { + cause = ((CascadingThrowable) t).getCause(); + } else if (t instanceof SAXException) { + cause = ((SAXException) t).getException(); + } else if (t instanceof java.sql.SQLException) { + cause = ((java.sql.SQLException) t).getNextException(); + } + if (cause == null) { + return t; + } else { + // Recurse + return getRootCause(cause); + } } - } } - 1.6.2.5 +15 -8 xml-cocoon2/src/java/org/apache/cocoon/components/notification/Notifier.java Index: Notifier.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/Notifier.java,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -u -r1.6.2.4 -r1.6.2.5 --- Notifier.java 7 Feb 2003 07:19:14 -0000 1.6.2.4 +++ Notifier.java 12 Feb 2003 02:56:14 -0000 1.6.2.5 @@ -64,7 +64,7 @@ /** * Generates a representations of the specified Notifying Object. * - * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @version CVS $Id$ */ @@ -79,12 +79,13 @@ * This could be <code>null</code>. * @deprecated There is no way in which this method could understand what mime/type to use. Instead use void notify(Notifying n, OutputStream outputStream, String mimetype), where the mime/type is requested. * @see #notify(Notifying n, OutputStream, String) - */ + public static String notify(Notifying n, OutputStream outputStream) throws IOException { notify(n, outputStream, "text/html") ; return "text/html"; } - + */ + /** * Generate notification information as a response. * The notification is directly written to the OutputStream. @@ -94,7 +95,7 @@ */ public static void notify(Notifying n, OutputStream outputStream, String mimetype) throws IOException { //(NKB) FIXME should use error page templates, one per mime-type - // currently uses hardcoded html, should be used only as last resort. + // currently uses hardcoded html, should be used only as last resort. notifyHTML(n, outputStream); } @@ -143,13 +144,14 @@ /** * Generate notification information in XML format. - * @deprecated Using a ContentHandler doesn't mean that a mimetype cannot be specified; it could be svg or + * @deprecated Using a ContentHandler doesn't mean that a mimetype cannot be specified; it could be svg or * @see #notify(Notifying, ContentHandler, String) - */ + public static void notify(Notifying n, ContentHandler ch) throws SAXException { notify(n, ch, "text/xml"); } - + */ + /** * Generate notification information in XML format. */ @@ -207,4 +209,9 @@ ch.endDocument(); } } + + + + + 1.5.2.3 +56 -46 xml-cocoon2/src/java/org/apache/cocoon/components/notification/Notifying.java Index: Notifying.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/Notifying.java,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -u -r1.5.2.2 -r1.5.2.3 --- Notifying.java 7 Feb 2003 07:19:14 -0000 1.5.2.2 +++ Notifying.java 12 Feb 2003 02:56:14 -0000 1.5.2.3 @@ -61,49 +61,59 @@ public interface Notifying { - /** - * Proposed types of notifications - */ - String UNKNOWN_NOTIFICATION = "unknown"; - String DEBUG_NOTIFICATION = "debug"; - String INFO_NOTIFICATION = "info" ; - String WARN_NOTIFICATION = "warn" ; - String ERROR_NOTIFICATION = "error"; - String FATAL_NOTIFICATION = "fatal"; - - /** - * Gets the Type of the Notifying object - */ - String getType(); - - /** - * Gets the Title of the Notifying object - */ - String getTitle(); - - /** - * Gets the Source of the Notifying object - */ - String getSource(); - - /** - * Gets the Sender of the Notifying object - */ - String getSender(); - - /** - * Gets the Message of the Notifying object - */ - String getMessage(); - - /** - * Gets the Description of the Notifying object - */ - String getDescription(); - - /** - * Gets the ExtraDescriptions of the Notifying object - */ - Map getExtraDescriptions(); + /* + * Proposed types of notifications + */ + String UNKNOWN_NOTIFICATION = "unknown"; + String DEBUG_NOTIFICATION = "debug"; + String INFO_NOTIFICATION = "info" ; + String WARN_NOTIFICATION = "warn" ; + String ERROR_NOTIFICATION = "error"; + String FATAL_NOTIFICATION = "fatal"; + + /* + * Proposed extra descriptions + */ + String EXTRA_LOCATION = "location"; + String EXTRA_LINE = "line"; + String EXTRA_COLUMN = "column" ; + String EXTRA_REQUESTURI = "request-uri" ; + String EXTRA_CAUSE = "cause"; + String EXTRA_STACKTRACE = "stacktrace"; + String EXTRA_FULLTRACE = "full exception chain stacktrace"; + + /** + * Gets the Type of the Notifying object + */ + String getType(); + + /** + * Gets the Title of the Notifying object + */ + String getTitle(); + + /** + * Gets the Source of the Notifying object + */ + String getSource(); + + /** + * Gets the Sender of the Notifying object + */ + String getSender(); + + /** + * Gets the Message of the Notifying object + */ + String getMessage(); + + /** + * Gets the Description of the Notifying object + */ + String getDescription(); + + /** + * Gets the ExtraDescriptions of the Notifying object + */ + Map getExtraDescriptions(); } - 1.5.2.3 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/components/notification/NotifyingBuilder.java Index: NotifyingBuilder.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/NotifyingBuilder.java,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -u -r1.5.2.2 -r1.5.2.3 --- NotifyingBuilder.java 7 Feb 2003 07:19:14 -0000 1.5.2.2 +++ NotifyingBuilder.java 12 Feb 2003 02:56:14 -0000 1.5.2.3 @@ -66,7 +66,7 @@ /** * The role implemented by a <code>NotifyingBuilder</code>. */ - String ROLE = "org.apache.cocoon.components.notification.NotifyingBuilder"; + String ROLE = NotifyingBuilder.class.getName(); /** Builds a Notifying object (SimpleNotifyingObject in this case) * that tries to explain what the Object o can reveal. 1.5.2.4 +3 -3 xml-cocoon2/src/java/org/apache/cocoon/components/notification/NotifyingCascadingRuntimeException.java Index: NotifyingCascadingRuntimeException.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/NotifyingCascadingRuntimeException.java,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -r1.5.2.3 -r1.5.2.4 --- NotifyingCascadingRuntimeException.java 7 Feb 2003 07:19:14 -0000 1.5.2.3 +++ NotifyingCascadingRuntimeException.java 12 Feb 2003 02:56:14 -0000 1.5.2.4 @@ -50,9 +50,9 @@ */ package org.apache.cocoon.components.notification; -import java.util.Map; - import org.apache.avalon.framework.CascadingRuntimeException; + +import java.util.Map; /** * A CascadingRuntimeException that is also Notifying. 1.5.2.4 +187 -185 xml-cocoon2/src/java/org/apache/cocoon/components/notification/SimpleNotifyingBean.java Index: SimpleNotifyingBean.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/SimpleNotifyingBean.java,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -r1.5.2.3 -r1.5.2.4 --- SimpleNotifyingBean.java 7 Feb 2003 07:19:14 -0000 1.5.2.3 +++ SimpleNotifyingBean.java 12 Feb 2003 02:56:14 -0000 1.5.2.4 @@ -59,192 +59,194 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @version CVS $Id$ */ - public class SimpleNotifyingBean implements Notifying { - /** - * The type of the notification. Examples can be "warning" or "error" - */ - private String type = "unknown"; - - /** - * The title of the notification. - */ - private String title = ""; - - /** - * The source that generates the notification. - */ - private String source = ""; - - /** - * The sender of the notification. - */ - private String sender = ""; - - /** - * The notification itself. - */ - private String message = "Message not known."; - - /** - * A more detailed description of the notification. - */ - private String description = "No details available."; - - /** - * A HashMap containing extra notifications - */ - private HashMap extraDescriptions = new HashMap(); + /** + * The type of the notification. Examples can be "warning" or "error" + */ + private String type = "unknown"; + + /** + * The title of the notification. + */ + private String title = ""; + + /** + * The source that generates the notification. + */ + private String source = ""; + + /** + * The sender of the notification. + */ + private String sender = ""; + + /** + * The notification itself. + */ + private String message = "Message not known."; + + /** + * A more detailed description of the notification. + */ + private String description = "No details available."; + + /** + * A HashMap containing extra notifications + */ + private Map 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()); - setTitle("Generic notification"); - } - - /** - * Sets the Type of the SimpleNotifyingBean object - * - *@param type The new Type value - */ - public void setType(String type) { - this.type = type; - } - - /** - * Sets the Title of the SimpleNotifyingBean object - * - *@param title The new Title value - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Sets the Source of the SimpleNotifyingBean object - * - *@param source The new Source value - */ - public void setSource(String source) { - this.source = source; - } - - /** - * Sets the Sender of the SimpleNotifyingBean object - * - *@param sender The new sender value - */ - private void setSender(Object sender) { - this.sender = sender.getClass().getName(); - } - - /** - * Sets the Sender of the SimpleNotifyingBean object - * - *@param sender The new sender value - */ - private void setSender(String sender) { - this.sender = sender; - } - - /** - * Sets the Message of the SimpleNotifyingBean object - * - *@param message The new Message value - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * Sets the Description of the SimpleNotifyingBean object - * - *@param description The new Description value - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Sets the ExtraDescriptions of the SimpleNotifyingBean object - * - *@param extraDescriptions The new ExtraDescriptions value - */ - public void addExtraDescription(String extraDescriptionDescription, - String extraDescription) { - this.extraDescriptions.put(extraDescriptionDescription, extraDescription); - } - - /** - * replaces the ExtraDescriptions of the SimpleNotifyingBean object - */ - protected void replaceExtraDescriptions(Map extraDescriptions) { - this.extraDescriptions = new HashMap(extraDescriptions); - } - - /** - * replaces the ExtraDescriptions of the SimpleNotifyingBean object - */ - protected void replaceExtraDescriptions(HashMap extraDescriptions) { - this.extraDescriptions = extraDescriptions; - } - - /** - * Gets the Type of the SimpleNotifyingBean object - */ - public String getType() { - return type; - } - - /** - * Gets the Title of the SimpleNotifyingBean object - */ - public String getTitle() { - return title; - } - - /** - * Gets the Source of the SimpleNotifyingBean object - */ - public String getSource() { - return source; - } - - /** - * Gets the Sender of the SimpleNotifyingBean object - */ - public String getSender() { - return sender; - } - - /** - * Gets the Message of the SimpleNotifyingBean object - */ - public String getMessage() { - return message; - } - - /** - * Gets the Description of the SimpleNotifyingBean object - */ - public String getDescription() { - return description; - } - - /** - * Gets the ExtraDescriptions of the SimpleNotifyingBean object - */ - public Map getExtraDescriptions() { - return extraDescriptions; - } + this.sender = "unknown"; + setSource(this.getClass().getName()); + setTitle("Generic notification"); + } + + public SimpleNotifyingBean(Object sender) { + this.sender = sender.getClass().getName(); + setSource(this.getClass().getName()); + setTitle("Generic notification"); + } + + /** + * Sets the Type of the SimpleNotifyingBean object + * + * @param type The new Type value + */ + public void setType(String type) { + this.type = type; + } + + /** + * Sets the Title of the SimpleNotifyingBean object + * + * @param title The new Title value + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Sets the Source of the SimpleNotifyingBean object + * + * @param source The new Source value + */ + public void setSource(String source) { + this.source = source; + } + + /** + * Sets the Sender of the SimpleNotifyingBean object + * + * @param sender The new sender value + private void setSender(Object sender) { + this.sender = sender.getClass().getName(); + } + */ + + /** + * Sets the Sender of the SimpleNotifyingBean object + * + * @param sender The new sender value + private void setSender(String sender) { + this.sender = sender; + } + */ + + /** + * Sets the Message of the SimpleNotifyingBean object + * + * @param message The new Message value + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * Sets the Description of the SimpleNotifyingBean object + * + * @param description The new Description value + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Adds the ExtraDescription to the SimpleNotifyingBean object + * + * @param extraDescriptionDescription The additional ExtraDescription name + * @param extraDescription The additional ExtraDescription value + */ + public void addExtraDescription(String extraDescriptionDescription, + String extraDescription) { + this.extraDescriptions.put(extraDescriptionDescription, extraDescription); + } + + /** + * Replaces the ExtraDescriptions of the SimpleNotifyingBean object + */ + protected void replaceExtraDescriptions(Map extraDescriptions) { + this.extraDescriptions = extraDescriptions; + } + + /** + * Adds the ExtraDescriptions to the SimpleNotifyingBean object + */ + protected void addExtraDescriptions(Map extraDescriptions) { + if (this.extraDescriptions == null) { + replaceExtraDescriptions(extraDescriptions); + } else { + this.extraDescriptions.putAll(extraDescriptions); + } + } + + /** + * Gets the Type of the SimpleNotifyingBean object + */ + public String getType() { + return type; + } + + /** + * Gets the Title of the SimpleNotifyingBean object + */ + public String getTitle() { + return title; + } + + /** + * Gets the Source of the SimpleNotifyingBean object + */ + public String getSource() { + return source; + } + + /** + * Gets the Sender of the SimpleNotifyingBean object + */ + public String getSender() { + return sender; + } + + /** + * Gets the Message of the SimpleNotifyingBean object + */ + public String getMessage() { + return message; + } + + /** + * Gets the Description of the SimpleNotifyingBean object + */ + public String getDescription() { + return description; + } + + /** + * Gets the ExtraDescriptions of the SimpleNotifyingBean object + */ + public Map getExtraDescriptions() { + return extraDescriptions; + } } - - -
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]