1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.mercury.maildir.util;
14
15 import java.io.IOException;
16 import java.io.InputStream;
17 import java.io.OutputStream;
18 import java.util.Date;
19 import java.util.Enumeration;
20 import javax.activation.DataHandler;
21 import javax.mail.Address;
22 import javax.mail.Folder;
23 import javax.mail.IllegalWriteException;
24 import javax.mail.Message;
25 import javax.mail.MessagingException;
26 import javax.mail.Multipart;
27 import javax.mail.Session;
28 import javax.mail.internet.MimeMessage;
29 import javax.mail.search.SearchTerm;
30
31
32
33
34
35
36
37 public class ReadOnlyMessageWrapper extends MessageWrapper {
38
39
40
41
42
43
44
45
46 protected ReadOnlyMessageWrapper(Folder folder, MimeMessage message, int msgnum) throws MessagingException {
47 super(folder, message, msgnum);
48 }
49
50
51
52
53
54
55
56 public ReadOnlyMessageWrapper(Session session, MimeMessage message) throws MessagingException {
57 super(session, message);
58 }
59
60
61
62
63
64
65 protected ReadOnlyMessageWrapper(Session session) throws MessagingException {
66 super(session);
67 }
68
69
70
71
72
73
74
75
76
77 public void addFrom(Address[] addresses) throws MessagingException {
78 throw new IllegalWriteException("Read only message");
79 }
80
81
82
83
84
85
86
87
88 public void addHeader(String name, String value) throws MessagingException {
89 throw new IllegalWriteException("Read only message");
90 }
91
92
93
94
95
96
97
98 public void addHeaderLine(String line) throws MessagingException {
99 throw new IllegalWriteException("Read only message");
100 }
101
102
103
104
105
106
107
108
109 public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
110 throw new IllegalWriteException("Read only message");
111 }
112
113
114
115
116
117
118
119
120 public void addRecipients(Message.RecipientType type, String addresses) throws MessagingException {
121 throw new IllegalWriteException("Read only message");
122 }
123
124
125
126
127
128
129 public Enumeration<?> getAllHeaderLines() throws MessagingException {
130 return message.getAllHeaderLines();
131 }
132
133
134
135
136
137
138 public Enumeration<?> getAllHeaders() throws MessagingException {
139 return message.getAllHeaders();
140 }
141
142
143
144
145
146
147 public Address[] getAllRecipients() throws MessagingException {
148 return message.getAllRecipients();
149 }
150
151
152
153
154
155
156
157 public Object getContent() throws IOException, MessagingException {
158 return message.getContent();
159 }
160
161
162
163
164
165
166 public String getContentID() throws MessagingException {
167 return message.getContentID();
168 }
169
170
171
172
173
174
175 public String[] getContentLanguage() throws MessagingException {
176 return message.getContentLanguage();
177 }
178
179
180
181
182
183
184 public String getContentMD5() throws MessagingException {
185 return message.getContentMD5();
186 }
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202 public String getContentType() throws MessagingException {
203 return message.getContentType();
204 }
205
206
207
208
209
210
211 public DataHandler getDataHandler() throws MessagingException {
212 return message.getDataHandler();
213 }
214
215
216
217
218
219
220 public String getDescription() throws MessagingException {
221 return message.getDescription();
222 }
223
224
225
226
227
228
229 public String getDisposition() throws MessagingException {
230 return message.getDisposition();
231 }
232
233
234
235
236
237
238 public String getEncoding() throws MessagingException {
239 return message.getEncoding();
240 }
241
242
243
244
245
246
247 public String getFileName() throws MessagingException {
248 return message.getFileName();
249 }
250
251
252
253
254
255
256 public Address[] getFrom() throws MessagingException {
257 return message.getFrom();
258 }
259
260
261
262
263
264
265
266 public String[] getHeader(String name) throws MessagingException {
267 return message.getHeader(name);
268 }
269
270
271
272
273
274
275
276
277 public String getHeader(String name, String delimiter) throws MessagingException {
278 return message.getHeader(name, delimiter);
279 }
280
281
282
283
284
285
286
287 public InputStream getInputStream() throws IOException, MessagingException {
288 return message.getInputStream();
289 }
290
291
292
293
294
295
296 public int getLineCount() throws MessagingException {
297 return message.getLineCount();
298 }
299
300
301
302
303
304
305
306 public Enumeration<?> getMatchingHeaderLines(String[] names) throws MessagingException {
307 return message.getMatchingHeaderLines(names);
308 }
309
310
311
312
313
314
315
316 public Enumeration<?> getMatchingHeaders(String[] names) throws MessagingException {
317 return message.getMatchingHeaders(names);
318 }
319
320
321
322
323
324
325 public String getMessageID() throws MessagingException {
326 return message.getMessageID();
327 }
328
329
330
331
332
333
334
335 public Enumeration<?> getNonMatchingHeaderLines(String[] names) throws MessagingException {
336 return message.getNonMatchingHeaderLines(names);
337 }
338
339
340
341
342
343
344
345 public Enumeration<?> getNonMatchingHeaders(String[] names) throws MessagingException {
346 return message.getNonMatchingHeaders(names);
347 }
348
349
350
351
352
353
354 public InputStream getRawInputStream() throws MessagingException {
355 return message.getRawInputStream();
356 }
357
358
359
360
361
362
363
364 public Address[] getRecipients(Message.RecipientType type) throws MessagingException {
365 return message.getRecipients(type);
366 }
367
368
369
370
371
372
373 public Address[] getReplyTo() throws MessagingException {
374 return message.getReplyTo();
375 }
376
377
378
379
380
381
382 public Address getSender() throws MessagingException {
383 return message.getSender();
384 }
385
386
387
388
389
390
391 public Date getSentDate() throws MessagingException {
392 return message.getSentDate();
393 }
394
395
396
397
398
399
400 public int getSize() throws MessagingException {
401 return message.getSize();
402 }
403
404
405
406
407
408
409 public String getSubject() throws MessagingException {
410 return message.getSubject();
411 }
412
413
414
415
416
417
418
419 public boolean isMimeType(String mimeType) throws MessagingException {
420 return message.isMimeType(mimeType);
421 }
422
423
424
425
426
427
428
429 public void removeHeader(String name) throws MessagingException {
430 throw new IllegalWriteException("Read only message");
431 }
432
433
434
435
436
437
438
439 public Message reply(boolean replyToAll) throws MessagingException {
440 return message.reply(replyToAll);
441 }
442
443
444
445
446
447
448 public void saveChanges() throws MessagingException {
449 throw new IllegalWriteException("Read only message");
450 }
451
452
453
454
455
456
457
458 public void setContent(Multipart mp) throws MessagingException {
459 throw new IllegalWriteException("Read only message");
460 }
461
462
463
464
465
466
467
468
469 public void setContent(Object o, String type) throws MessagingException {
470 throw new IllegalWriteException("Read only message");
471 }
472
473
474
475
476
477
478
479 public void setContentID(String cid) throws MessagingException {
480 throw new IllegalWriteException("Read only message");
481 }
482
483
484
485
486
487
488
489 public void setContentLanguage(String[] languages) throws MessagingException {
490 throw new IllegalWriteException("Read only message");
491 }
492
493
494
495
496
497
498
499 public void setContentMD5(String md5) throws MessagingException {
500 throw new IllegalWriteException("Read only message");
501 }
502
503
504
505
506
507
508
509 public void setDataHandler(DataHandler dh) throws MessagingException {
510 throw new IllegalWriteException("Read only message");
511 }
512
513
514
515
516
517
518
519 public void setDescription(String description) throws MessagingException {
520 throw new IllegalWriteException("Read only message");
521 }
522
523
524
525
526
527
528
529
530 public void setDescription(String description, String charset) throws MessagingException {
531 throw new IllegalWriteException("Read only message");
532 }
533
534
535
536
537
538
539
540 public void setDisposition(String disposition) throws MessagingException {
541 throw new IllegalWriteException("Read only message");
542 }
543
544
545
546
547
548
549
550 public void setFileName(String filename) throws MessagingException {
551 throw new IllegalWriteException("Read only message");
552 }
553
554
555
556
557
558
559 public void setFrom() throws MessagingException {
560 throw new IllegalWriteException("Read only message");
561 }
562
563
564
565
566
567
568
569 public void setFrom(Address address) throws MessagingException {
570 throw new IllegalWriteException("Read only message");
571 }
572
573
574
575
576
577
578
579
580 public void setHeader(String name, String value) throws MessagingException {
581 throw new IllegalWriteException("Read only message");
582 }
583
584
585
586
587
588
589
590
591 public void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
592 throw new IllegalWriteException("Read only message");
593 }
594
595
596
597
598
599
600
601
602 public void setRecipients(Message.RecipientType type, String addresses) throws MessagingException {
603 throw new IllegalWriteException("Read only message");
604 }
605
606
607
608
609
610
611
612 public void setReplyTo(Address[] addresses) throws MessagingException {
613 throw new IllegalWriteException("Read only message");
614 }
615
616
617
618
619
620
621
622 public void setSender(Address address) throws MessagingException {
623 throw new IllegalWriteException("Read only message");
624 }
625
626
627
628
629
630
631
632 public void setSentDate(Date d) throws MessagingException {
633 throw new IllegalWriteException("Read only message");
634 }
635
636
637
638
639
640
641
642 public void setSubject(String subject) throws MessagingException {
643 throw new IllegalWriteException("Read only message");
644 }
645
646
647
648
649
650
651
652
653 public void setSubject(String subject, String charset) throws MessagingException {
654 throw new IllegalWriteException("Read only message");
655 }
656
657
658
659
660
661
662
663 public void setText(String text) throws MessagingException {
664 throw new IllegalWriteException("Read only message");
665 }
666
667
668
669
670
671
672
673
674 public void setText(String text, String charset) throws MessagingException {
675 throw new IllegalWriteException("Read only message");
676 }
677
678
679
680
681
682
683 protected void updateHeaders() throws MessagingException {
684 throw new IllegalWriteException("Read only message");
685 }
686
687
688
689
690
691
692
693 public void writeTo(OutputStream os) throws IOException, MessagingException {
694 message.writeTo(os);
695 }
696
697
698
699
700
701
702
703
704 public void writeTo(OutputStream os, String[] ignoreList) throws IOException, MessagingException {
705 message.writeTo(os, ignoreList);
706 }
707
708
709
710
711
712
713
714
715 public void addRecipient(Message.RecipientType type, Address address) throws MessagingException {
716 throw new IllegalWriteException("Read only message");
717 }
718
719
720
721
722
723
724
725 public boolean match(SearchTerm term) throws MessagingException {
726 return message.match(term);
727 }
728
729
730
731
732
733
734
735
736 public void setRecipient(Message.RecipientType type, Address address) throws MessagingException {
737 throw new IllegalWriteException("Read only message");
738 }
739
740 }