1 21 22 27 28 package javax.mail; 29 30 import java.io.*; 31 import java.net.*; 32 import java.util.*; 33 import javax.mail.event.*; 34 35 52 53 public abstract class Store extends Service { 54 55 61 protected Store(Session session, URLName urlname) { 62 super(session, urlname); 63 } 64 65 72 public abstract Folder getDefaultFolder() throws MessagingException ; 73 74 94 public abstract Folder getFolder(String name) 95 throws MessagingException ; 96 97 111 public abstract Folder getFolder(URLName url) 112 throws MessagingException ; 113 114 132 public Folder [] getPersonalNamespaces() throws MessagingException { 133 return new Folder [] { getDefaultFolder() }; 134 } 135 136 152 public Folder [] getUserNamespaces(String user) 153 throws MessagingException { 154 return new Folder [0]; 155 } 156 157 170 public Folder [] getSharedNamespaces() throws MessagingException { 171 return new Folder [0]; 172 } 173 174 private volatile Vector storeListeners = null; 176 177 186 public synchronized void addStoreListener(StoreListener l) { 187 if (storeListeners == null) 188 storeListeners = new Vector(); 189 storeListeners.addElement(l); 190 } 191 192 201 public synchronized void removeStoreListener(StoreListener l) { 202 if (storeListeners != null) 203 storeListeners.removeElement(l); 204 } 205 206 216 protected void notifyStoreListeners(int type, String message) { 217 if (storeListeners == null) 218 return; 219 220 StoreEvent e = new StoreEvent(this, type, message); 221 queueEvent(e, storeListeners); 222 } 223 224 private volatile Vector folderListeners = null; 226 227 239 public synchronized void addFolderListener(FolderListener l) { 240 if (folderListeners == null) 241 folderListeners = new Vector(); 242 folderListeners.addElement(l); 243 } 244 245 254 public synchronized void removeFolderListener(FolderListener l) { 255 if (folderListeners != null) 256 folderListeners.removeElement(l); 257 } 258 259 273 protected void notifyFolderListeners(int type, Folder folder) { 274 if (folderListeners == null) 275 return; 276 277 FolderEvent e = new FolderEvent(this, folder, type); 278 queueEvent(e, folderListeners); 279 } 280 281 296 protected void notifyFolderRenamedListeners(Folder oldF, Folder newF) { 297 if (folderListeners == null) 298 return; 299 300 FolderEvent e = new FolderEvent(this, oldF, newF,FolderEvent.RENAMED); 301 queueEvent(e, folderListeners); 302 } 303 } 304 | Popular Tags |