1 29 30 package echo2example.email.faux; 31 32 import java.io.IOException ; 33 import java.io.InputStream ; 34 import java.io.OutputStream ; 35 import java.util.Date ; 36 import java.util.Enumeration ; 37 38 import javax.activation.DataHandler ; 39 import javax.mail.Address ; 40 import javax.mail.Flags ; 41 import javax.mail.Message ; 42 import javax.mail.MessagingException ; 43 import javax.mail.Multipart ; 44 45 51 public class FauxMessage extends Message { 52 53 private Address [] from; 54 private String subject; 55 private String content; 56 private Date receivedDate; 57 private Address [] to, cc, bcc; 58 59 70 public FauxMessage(Address from, Date receivedDate, 71 Address [] to, Address [] cc, Address [] bcc, 72 String subject, String content) { 73 this.receivedDate = receivedDate; 74 this.from = new Address []{from}; 75 this.to = to; 76 this.cc = cc; 77 this.bcc = bcc; 78 this.subject = subject; 79 this.content = content; 80 } 81 82 85 public void addFrom(Address [] from) throws MessagingException { 86 throw new UnsupportedOperationException (); 87 } 88 89 92 public void addHeader(String arg0, String arg1) throws MessagingException { 93 throw new UnsupportedOperationException (); 94 } 95 96 99 public void addRecipients(RecipientType arg0, Address [] arg1) throws MessagingException { 100 throw new UnsupportedOperationException (); 101 } 102 103 106 public Enumeration getAllHeaders() throws MessagingException { 107 throw new UnsupportedOperationException (); 108 } 109 110 113 public Object getContent() throws IOException , MessagingException { 114 return content; 115 } 116 117 120 public String getContentType() throws MessagingException { 121 return "text/plain"; 122 } 123 124 127 public DataHandler getDataHandler() throws MessagingException { 128 throw new UnsupportedOperationException (); 129 } 130 131 134 public String getDescription() throws MessagingException { 135 throw new UnsupportedOperationException (); 136 } 137 138 141 public String getDisposition() throws MessagingException { 142 throw new UnsupportedOperationException (); 143 } 144 145 148 public String getFileName() throws MessagingException { 149 throw new UnsupportedOperationException (); 150 } 151 152 155 public Flags getFlags() throws MessagingException { 156 throw new UnsupportedOperationException (); 157 } 158 159 162 public Address [] getFrom() throws MessagingException { 163 return from; 164 } 165 166 169 public String [] getHeader(String arg0) throws MessagingException { 170 throw new UnsupportedOperationException (); 171 } 172 173 176 public InputStream getInputStream() throws IOException , MessagingException { 177 throw new UnsupportedOperationException (); 178 } 179 180 183 public int getLineCount() throws MessagingException { 184 throw new UnsupportedOperationException (); 185 } 186 187 190 public Enumeration getMatchingHeaders(String [] arg0) throws MessagingException { 191 throw new UnsupportedOperationException (); 192 } 193 194 197 public Enumeration getNonMatchingHeaders(String [] arg0) throws MessagingException { 198 throw new UnsupportedOperationException (); 199 } 200 201 204 public Date getReceivedDate() throws MessagingException { 205 return receivedDate; 206 } 207 208 211 public Address [] getRecipients(RecipientType recipientType) throws MessagingException { 212 if (recipientType.equals(RecipientType.TO)) { 213 return to; 214 } else if (recipientType.equals(RecipientType.CC)) { 215 return cc; 216 } else if (recipientType.equals(RecipientType.BCC)) { 217 return bcc; 218 } else { 219 throw new IllegalArgumentException (); 220 } 221 } 222 223 226 public Date getSentDate() throws MessagingException { 227 return receivedDate; 228 } 229 230 233 public int getSize() throws MessagingException { 234 throw new UnsupportedOperationException (); 235 } 236 237 240 public String getSubject() throws MessagingException { 241 return subject; 242 } 243 244 247 public boolean isMimeType(String arg0) throws MessagingException { 248 throw new UnsupportedOperationException (); 249 } 250 251 254 public void removeHeader(String arg0) throws MessagingException { 255 throw new UnsupportedOperationException (); 256 } 257 258 261 public Message reply(boolean arg0) throws MessagingException { 262 throw new UnsupportedOperationException (); 263 } 264 265 268 public void saveChanges() throws MessagingException { 269 throw new UnsupportedOperationException (); 270 } 271 272 275 public void setContent(Multipart arg0) throws MessagingException { 276 throw new UnsupportedOperationException (); 277 } 278 279 282 public void setContent(Object arg0, String arg1) throws MessagingException { 283 throw new UnsupportedOperationException (); 284 } 285 286 289 public void setDataHandler(DataHandler arg0) throws MessagingException { 290 throw new UnsupportedOperationException (); 291 } 292 293 296 public void setDescription(String arg0) throws MessagingException { 297 throw new UnsupportedOperationException (); 298 } 299 300 303 public void setDisposition(String arg0) throws MessagingException { 304 throw new UnsupportedOperationException (); 305 } 306 307 310 public void setFileName(String arg0) throws MessagingException { 311 throw new UnsupportedOperationException (); 312 } 313 314 317 public void setFlags(Flags arg0, boolean arg1) throws MessagingException { 318 throw new UnsupportedOperationException (); 319 } 320 321 324 public void setFrom() throws MessagingException { 325 throw new UnsupportedOperationException (); 326 } 327 328 331 public void setFrom(Address arg0) throws MessagingException { 332 throw new UnsupportedOperationException (); 333 } 334 335 338 public void setHeader(String arg0, String arg1) throws MessagingException { 339 throw new UnsupportedOperationException (); 340 } 341 342 345 public void setRecipients(RecipientType arg0, Address [] arg1) throws MessagingException { 346 throw new UnsupportedOperationException (); 347 } 348 349 352 public void setSentDate(Date arg0) throws MessagingException { 353 throw new UnsupportedOperationException (); 354 } 355 356 359 public void setSubject(String arg0) throws MessagingException { 360 throw new UnsupportedOperationException (); 361 } 362 363 366 public void setText(String arg0) throws MessagingException { 367 throw new UnsupportedOperationException (); 368 } 369 370 373 public void writeTo(OutputStream arg0) throws IOException , MessagingException { 374 throw new UnsupportedOperationException (); 375 } 376 } | Popular Tags |