Clover coverage report - Maven Clover report
Coverage timestamp: Sun Aug 20 2006 04:01:04 PDT
file stats: LOC: 125   Methods: 7
NCLOC: 53   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TransportEvent.java - 75% 42.9% 67.7%
coverage coverage
 1    /**
 2    *
 3    * Copyright 2003-2004 The Apache Software Foundation
 4    *
 5    * Licensed under the Apache License, Version 2.0 (the "License");
 6    * you may not use this file except in compliance with the License.
 7    * You may obtain a copy of the License at
 8    *
 9    * http://www.apache.org/licenses/LICENSE-2.0
 10    *
 11    * Unless required by applicable law or agreed to in writing, software
 12    * distributed under the License is distributed on an "AS IS" BASIS,
 13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14    * See the License for the specific language governing permissions and
 15    * limitations under the License.
 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    * @version $Rev: 125583 $ $Date: 2005-01-18 19:44:27 -0800 (Tue, 18 Jan 2005) $
 26    */
 27    public class TransportEvent extends MailEvent {
 28    /**
 29    * Indicates that the message has successfully been delivered to all
 30    * recipients.
 31    */
 32    public static final int MESSAGE_DELIVERED = 1;
 33   
 34    /**
 35    * Indicates that no messages could be delivered.
 36    */
 37    public static final int MESSAGE_NOT_DELIVERED = 2;
 38   
 39    /**
 40    * Indicates that some of the messages were successfully delivered
 41    * but that some failed.
 42    */
 43    public static final int MESSAGE_PARTIALLY_DELIVERED = 3;
 44   
 45    /**
 46    * The event type.
 47    */
 48    protected int type;
 49   
 50    /**
 51    * Addresses to which the message was successfully delivered.
 52    */
 53    protected transient Address[] validSent;
 54   
 55    /**
 56    * Addresses which are valid but to which the message was not sent.
 57    */
 58    protected transient Address[] validUnsent;
 59   
 60    /**
 61    * Addresses that are invalid.
 62    */
 63    protected transient Address[] invalid;
 64   
 65    /**
 66    * The message associated with this event.
 67    */
 68    protected transient Message msg;
 69   
 70    /**
 71    * Construct a new event,
 72    *
 73    * @param transport the transport attempting to deliver the message
 74    * @param type the event type
 75    * @param validSent addresses to which the message was successfully delivered
 76    * @param validUnsent addresses which are valid but to which the message was not sent
 77    * @param invalid invalid addresses
 78    * @param message the associated message
 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    }