|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package javax.mail.event; |
|
19 |
| |
|
20 |
| import javax.mail.Address; |
|
21 |
| import javax.mail.Message; |
|
22 |
| import javax.mail.Transport; |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| public class TransportEvent extends MailEvent { |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public static final int MESSAGE_DELIVERED = 1; |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| public static final int MESSAGE_NOT_DELIVERED = 2; |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| public static final int MESSAGE_PARTIALLY_DELIVERED = 3; |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| protected int type; |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| protected transient Address[] validSent; |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| protected transient Address[] validUnsent; |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| protected transient Address[] invalid; |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| protected transient Message msg; |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
3
| public TransportEvent(Transport transport, int type, Address[] validSent, Address[] validUnsent, Address[] invalid, Message message) {
|
|
81 |
3
| super(transport);
|
|
82 |
3
| this.type = type;
|
|
83 |
3
| this.validSent = validSent;
|
|
84 |
3
| this.validUnsent = validUnsent;
|
|
85 |
3
| this.invalid = invalid;
|
|
86 |
3
| this.msg = message;
|
|
87 |
| } |
|
88 |
| |
|
89 |
0
| public Address[] getValidSentAddresses() {
|
|
90 |
0
| return validSent;
|
|
91 |
| } |
|
92 |
| |
|
93 |
0
| public Address[] getValidUnsentAddresses() {
|
|
94 |
0
| return validUnsent;
|
|
95 |
| } |
|
96 |
| |
|
97 |
0
| public Address[] getInvalidAddresses() {
|
|
98 |
0
| return invalid;
|
|
99 |
| } |
|
100 |
| |
|
101 |
0
| public Message getMessage() {
|
|
102 |
0
| return msg;
|
|
103 |
| } |
|
104 |
| |
|
105 |
3
| public int getType() {
|
|
106 |
3
| return type;
|
|
107 |
| } |
|
108 |
| |
|
109 |
3
| public void dispatch(Object listener) {
|
|
110 |
3
| TransportListener l = (TransportListener) listener;
|
|
111 |
3
| switch (type) {
|
|
112 |
1
| case MESSAGE_DELIVERED:
|
|
113 |
1
| l.messageDelivered(this);
|
|
114 |
1
| break;
|
|
115 |
1
| case MESSAGE_NOT_DELIVERED:
|
|
116 |
1
| l.messageNotDelivered(this);
|
|
117 |
1
| break;
|
|
118 |
1
| case MESSAGE_PARTIALLY_DELIVERED:
|
|
119 |
1
| l.messagePartiallyDelivered(this);
|
|
120 |
1
| break;
|
|
121 |
0
| default:
|
|
122 |
0
| throw new IllegalArgumentException("Invalid type " + type);
|
|
123 |
| } |
|
124 |
| } |
|
125 |
| } |