KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > innig > macker > rule > Message


1 /*______________________________________________________________________________
2  *
3  * Macker http://innig.net/macker/
4  *
5  * Copyright 2002-2003 Paul Cantrell
6  *
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License version 2, as published by the
9  * Free Software Foundation. See the file LICENSE.html for more information.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the license for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
17  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
18  *______________________________________________________________________________
19  */

20  
21 package net.innig.macker.rule;
22
23 import net.innig.macker.structure.ClassManager;
24 import net.innig.macker.event.MessageEvent;
25 import net.innig.macker.event.MackerIsMadException;
26 import net.innig.macker.event.ListenerException;
27
28 public class Message
29     extends Rule
30     {
31     //--------------------------------------------------------------------------
32
// Constructors
33
//--------------------------------------------------------------------------
34

35     public Message(RuleSet parent, String JavaDoc message)
36         {
37         super(parent);
38         this.message = message;
39         setSeverity(RuleSeverity.INFO);
40         }
41     
42     //--------------------------------------------------------------------------
43
// Properties
44
//--------------------------------------------------------------------------
45

46     public String JavaDoc getMessage()
47         { return message; }
48     
49     public void setMessage(String JavaDoc message)
50         { this.message = message; }
51     
52     private String JavaDoc message;
53
54     //--------------------------------------------------------------------------
55
// Evaluation
56
//--------------------------------------------------------------------------
57

58     public void check(EvaluationContext context, ClassManager classes)
59         throws RulesException, MackerIsMadException, ListenerException
60         {
61         context.broadcastEvent(
62             new MessageEvent(
63                 this,
64                 VariableParser.parse(context, getMessage())));
65         }
66     }
67
Popular Tags