1 21 22 27 28 package javax.mail.event; 29 30 import java.util.*; 31 import javax.mail.*; 32 33 42 43 public class TransportEvent extends MailEvent { 44 45 51 public static final int MESSAGE_DELIVERED = 1; 52 53 58 public static final int MESSAGE_NOT_DELIVERED = 2; 59 60 66 public static final int MESSAGE_PARTIALLY_DELIVERED = 3; 67 68 69 74 protected int type; 75 76 transient protected Address[] validSent; 77 transient protected Address[] validUnsent; 78 transient protected Address[] invalid; 79 transient protected Message msg; 80 81 private static final long serialVersionUID = -4729852364684273073L; 82 83 87 public TransportEvent(Transport transport, int type, Address[] validSent, 88 Address[] validUnsent, Address[] invalid, 89 Message msg) { 90 super(transport); 91 this.type = type; 92 this.validSent = validSent; 93 this.validUnsent = validUnsent; 94 this.invalid = invalid; 95 this.msg = msg; 96 } 97 98 102 public int getType() { 103 return type; 104 } 105 106 110 public Address[] getValidSentAddresses() { 111 return validSent; 112 } 113 114 120 public Address[] getValidUnsentAddresses() { 121 return validUnsent; 122 } 123 124 128 public Address[] getInvalidAddresses() { 129 return invalid; 130 } 131 132 138 public Message getMessage() { 139 return msg; 140 } 141 142 145 public void dispatch(Object listener) { 146 if (type == MESSAGE_DELIVERED) 147 ((TransportListener )listener).messageDelivered(this); 148 else if (type == MESSAGE_NOT_DELIVERED) 149 ((TransportListener )listener).messageNotDelivered(this); 150 else ((TransportListener )listener).messagePartiallyDelivered(this); 152 } 153 } 154 | Popular Tags |