1 21 22 27 28 package com.sun.mail.pop3; 29 30 import javax.mail.*; 31 32 38 public class DefaultFolder extends Folder { 39 40 DefaultFolder(POP3Store store) { 41 super(store); 42 } 43 44 public String getName() { 45 return ""; 46 } 47 48 public String getFullName() { 49 return ""; 50 } 51 52 public Folder getParent() { 53 return null; 54 } 55 56 public boolean exists() { 57 return true; 58 } 59 60 public Folder[] list(String pattern) throws MessagingException { 61 Folder[] f = { getInbox() }; 62 return f; 63 } 64 65 public char getSeparator() { 66 return '/'; 67 } 68 69 public int getType() { 70 return HOLDS_FOLDERS; 71 } 72 73 public boolean create(int type) throws MessagingException { 74 return false; 75 } 76 77 public boolean hasNewMessages() throws MessagingException { 78 return false; 79 } 80 81 public Folder getFolder(String name) throws MessagingException { 82 if (!name.equalsIgnoreCase("INBOX")) { 83 throw new MessagingException("only INBOX supported"); 84 } else { 85 return getInbox(); 86 } 87 } 88 89 protected Folder getInbox() throws MessagingException { 90 return getStore().getFolder("INBOX"); 91 } 92 93 94 public boolean delete(boolean recurse) throws MessagingException { 95 throw new MethodNotSupportedException("delete"); 96 } 97 98 public boolean renameTo(Folder f) throws MessagingException { 99 throw new MethodNotSupportedException("renameTo"); 100 } 101 102 public void open(int mode) throws MessagingException { 103 throw new MethodNotSupportedException("open"); 104 } 105 106 public void close(boolean expunge) throws MessagingException { 107 throw new MethodNotSupportedException("close"); 108 } 109 110 public boolean isOpen() { 111 return false; 112 } 113 114 public Flags getPermanentFlags() { 115 return new Flags(); } 117 118 public int getMessageCount() throws MessagingException { 119 return 0; 120 } 121 122 public Message getMessage(int msgno) throws MessagingException { 123 throw new MethodNotSupportedException("getMessage"); 124 } 125 126 public void appendMessages(Message[] msgs) throws MessagingException { 127 throw new MethodNotSupportedException("Append not supported"); 128 } 129 130 public Message[] expunge() throws MessagingException { 131 throw new MethodNotSupportedException("expunge"); 132 } 133 } 134 | Popular Tags |