Skip to content

Package: RemoteInbox

RemoteInbox

nameinstructionbranchcomplexitylinemethod
RemoteInbox(RemoteStore, String)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getMessageCount()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
hasNewMessages()
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
open(int)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.eclipse.angus.mail.remote;
18:
19: import jakarta.mail.*;
20: import org.eclipse.angus.mail.mbox.*;
21: import org.eclipse.angus.mail.mbox.MboxFolder;
22:
23: /**
24: * A remote Inbox folder. The data is actually managed by our subclass
25: * (<code>MboxFolder</code>). We fetch data from the remote Inbox and
26: * add it to the local Inbox.
27: *
28: * @author Bill Shannon
29: */
30:
31: public class RemoteInbox extends MboxFolder {
32:
33: private RemoteStore mstore;
34:
35: protected RemoteInbox(RemoteStore store, String name) {
36:         super(store, name);
37:         this.mstore = store;
38: }
39:
40: /**
41: * Poll the remote store for any new messages.
42: */
43: public synchronized boolean hasNewMessages() {
44:         try {
45:          mstore.updateInbox();
46:         } catch (MessagingException ex) {
47:          // ignore it
48:         }
49:         return super.hasNewMessages();
50: }
51:
52: /**
53: * Open the folder in the specified mode.
54: * Poll the remote store for any new messages first.
55: */
56: public synchronized void open(int mode) throws MessagingException {
57:         mstore.updateInbox();
58:         super.open(mode);
59: }
60:
61: /**
62: * Return the number of messages in this folder.
63: * Poll the remote store for any new messages first.
64: */
65: public synchronized int getMessageCount() throws MessagingException {
66:         mstore.updateInbox();
67:         return super.getMessageCount();
68: }
69: }