| 156 | */ |
| 157 | |
| 158 | public class IMAPFolder extends Folder implements UIDFolder, ResponseHandler { |
| 159 | |
| 160 | protected volatile String fullName; // full name |
| 161 | protected String name; // name |
| 162 | protected int type; // folder type. |
| 163 | protected char separator; // separator |
| 164 | protected Flags availableFlags; // available flags |
| 165 | protected Flags permanentFlags; // permanent flags |
| 166 | protected volatile boolean exists; // whether this folder really exists ? |
| 167 | protected boolean isNamespace = false; // folder is a namespace name |
| 168 | protected volatile String[] attributes;// name attributes from LIST response |
| 169 | |
| 170 | protected volatile IMAPProtocol protocol; // this folder's protocol object |
| 171 | protected MessageCache messageCache;// message cache |
| 172 | // accessor lock for message cache |
| 173 | protected final Object messageCacheLock = new Object(); |
| 174 | |
| 175 | protected Hashtable<Long, IMAPMessage> uidTable; // UID->Message hashtable |
| 176 | |
| 177 | /* An IMAP delimiter is a 7bit US-ASCII character. (except NUL). |
| 178 | * We use '\uffff' (a non 7bit character) to indicate that we havent |
| 179 | * yet determined what the separator character is. |
| 180 | * We use '\u0000' (NUL) to indicate that no separator character |
| 181 | * exists, i.e., a flat hierarchy |
| 182 | */ |
| 183 | static final protected char UNKNOWN_SEPARATOR = '\uffff'; |
| 184 | |
| 185 | private volatile boolean opened = false; // is this folder opened ? |
| 186 | |
| 187 | /* This field tracks the state of this folder. If the folder is closed |
| 188 | * due to external causes (i.e, not thru the close() method), then |
| 189 | * this field will remain false. If the folder is closed thru the |
| 190 | * close() method, then this field is set to true. |
| 191 | * |
| 192 | * If reallyClosed is false, then a FolderClosedException is |
| 193 | * generated when a method is invoked on any Messaging object |
| 194 | * owned by this folder. If reallyClosed is true, then the |
| 195 | * IllegalStateException runtime exception is thrown. |
| 196 | */ |
| 197 | private boolean reallyClosed = true; |
| 198 | |
| 199 | /* |
| 200 | * The idleState field supports the IDLE command. |
| 201 | * Normally when executing an IMAP command we hold the |
| 202 | * messageCacheLock and often the folder lock (see above). |
| 203 | * While executing the IDLE command we can't hold either |
| 204 | * of these locks or it would prevent other threads from |
| 205 | * entering Folder methods even far enough to check whether |
| 206 | * an IDLE command is in progress. We need to check before |
| 207 | * issuing another command so that we can abort the IDLE |
| 208 | * command. |
| 209 | * |
| 210 | * The idleState field is protected by the messageCacheLock. |
| 211 | * The RUNNING state is the normal state and means no IDLE |
| 212 | * command is in progress. The IDLE state means we've issued |
| 213 | * an IDLE command and are reading responses. The ABORTING |
| 214 | * state means we've sent the DONE continuation command and |
| 215 | * are waiting for the thread running the IDLE command to |
nothing calls this directly
no outgoing calls
no test coverage detected