KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > mail > event > StoreEvent


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21
22 /*
23  * @(#)StoreEvent.java 1.10 05/08/29
24  *
25  * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package javax.mail.event;
29
30 import java.util.*;
31 import javax.mail.*;
32
33 /**
34  * This class models notifications from the Store connection. These
35  * notifications can be ALERTS or NOTICES. ALERTS must be presented
36  * to the user in a fashion that calls the user's attention to the
37  * message.
38  *
39  * @author John Mani
40  */

41
42 public class StoreEvent extends MailEvent JavaDoc {
43
44     /**
45      * Indicates that this message is an ALERT.
46      */

47     public static final int ALERT = 1;
48
49     /**
50      * Indicates that this message is a NOTICE.
51      */

52     public static final int NOTICE = 2;
53
54     /**
55      * The event type.
56      *
57      * @serial
58      */

59     protected int type;
60
61     /**
62      * The message text to be presented to the user.
63      *
64      * @serial
65      */

66     protected String JavaDoc message;
67
68     private static final long serialVersionUID = 1938704919992515330L;
69
70     /**
71      * Constructor.
72      * @param store The source Store
73      */

74     public StoreEvent(Store store, int type, String JavaDoc message) {
75     super(store);
76     this.type = type;
77     this.message = message;
78     }
79
80     /**
81      * Return the type of this event.
82      *
83      * @return type
84      * @see #ALERT
85      * @see #NOTICE
86      */

87     public int getMessageType() {
88     return type;
89     }
90
91     /**
92      * Get the message from the Store.
93      *
94      * @return message from the Store
95      */

96     public String JavaDoc getMessage() {
97     return message;
98     }
99
100     /**
101      * Invokes the appropriate StoreListener method.
102      */

103     public void dispatch(Object JavaDoc listener) {
104     ((StoreListener JavaDoc)listener).notification(this);
105     }
106 }
107
Popular Tags