View Javadoc

1   ////////////////////////////////////////////////////////////////////////////////
2   // MillScript-Alert: an Open Spice interpreter and batch website creation tool
3   // Copyright (C) 2006 Open World Ltd, Kevin Rogers
4   //
5   // This file is part of MillScript-Alert.
6   //
7   // MillScript-Alert is free software; you can redistribute it and/or modify it under
8   // the terms of the GNU General Public License as published by the Free
9   // Software Foundation; either version 2 of the License, or (at your option)
10  // any later version.
11  //
12  // MillScript-Alert is distributed in the hope that it will be useful, but WITHOUT
13  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  // more details.
16  //
17  // You should have received a copy of the GNU General Public License along with
18  // MillScript-Alert; if not, write to the Free Software Foundation, Inc., 59 Temple
19  // Place, Suite 330, Boston, MA  02111-1307  USA
20  ////////////////////////////////////////////////////////////////////////////////
21  package org.millscript.commons.alert.reporters;
22  
23  import org.millscript.commons.alert.AlertReporter;
24  import org.millscript.commons.alert.Culprit;
25  
26  /**
27   * This class provides a standard Alert reporter for mishaps, that outputs
28   * everything to the standard error stream.
29   */
30  public class StandardMishapAlertReporter extends AbstractAlertReporter {
31  
32      /**
33       * A convenience StandardMishapAlertReporter instance for applications to use. 
34       */
35      public static final AlertReporter MISHAP_REPORTER = new StandardMishapAlertReporter();
36  
37      /**
38       * Constructs a new StandardMishapAlertReporter.
39       */
40      public StandardMishapAlertReporter() {
41      }
42  
43      /**
44       * @see org.millscript.commons.alert.reporters.AbstractAlertReporter#reportComplaint(java.lang.String)
45       */
46      @Override
47      public void reportComplaint( final String complaint ) {
48          // TODO - This needs to be kept short depending on the output target.
49          // This used to be done in MillScript using it's Output class.
50          this.reportCulprit( new Culprit( "mishap", complaint ) );
51      }
52  
53  }