Package: GmailStore
GmailStore
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GmailStore(Session, URLName) |
|
|
|
|
|
||||||||||||||||||||
GmailStore(Session, URLName, String, boolean) |
|
|
|
|
|
||||||||||||||||||||
newIMAPFolder(ListInfo) |
|
|
|
|
|
||||||||||||||||||||
newIMAPFolder(String, char, Boolean) |
|
|
|
|
|
||||||||||||||||||||
newIMAPProtocol(String, int) |
|
|
|
|
|
||||||||||||||||||||
protocolConnect(String, int, String, String) |
|
|
|
|
|
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.gimap;
18:
19: import java.io.IOException;
20:
21: import jakarta.mail.*;
22:
23: import org.eclipse.angus.mail.iap.ProtocolException;
24: import org.eclipse.angus.mail.imap.IMAPStore;
25: import org.eclipse.angus.mail.imap.IMAPFolder;
26: import org.eclipse.angus.mail.imap.protocol.IMAPProtocol;
27: import org.eclipse.angus.mail.imap.protocol.ListInfo;
28: import org.eclipse.angus.mail.gimap.protocol.GmailProtocol;
29:
30: /**
31: * A Gmail Store. Defaults to imap.gmail.com with SSL.
32: * Uses a GmailProtocol and Gmail Folder to support Gmail extensions.
33: *
34: * @since JavaMail 1.4.6
35: * @author Bill Shannon
36: */
37:
38: public class GmailStore extends IMAPStore {
39: /**
40: * Constructor that takes a Session object and a URLName that
41: * represents a specific IMAP server.
42: *
43: * @param        session        the Session
44: * @param        url        the URLName of this store
45: */
46: public GmailStore(Session session, URLName url) {
47:         this(session, url, "gimap", true);
48: }
49:
50: /**
51: * Constructor used by GmailSSLStore subclass.
52: *
53: * @param        session        the Session
54: * @param        url        the URLName of this store
55: * @param        name        the protocol name
56: * @param        isSSL        use SSL to connect?
57: */
58: protected GmailStore(Session session, URLName url,
59: String name, boolean isSSL) {
60:         super(session, url, name, true);        // Gmail requires SSL
61: }
62:
63: protected boolean protocolConnect(String host, int pport,
64:                                 String user, String password)
65:                                 throws MessagingException {
66:•        if (host == null)
67:          host = "imap.gmail.com";                // default to Gmail host
68:         return super.protocolConnect(host, pport, user, password);
69: }
70:
71: protected IMAPProtocol newIMAPProtocol(String host, int port)
72:                                 throws IOException, ProtocolException {
73:         return new GmailProtocol(name, host, port,
74:                                          session.getProperties(),
75:                                          isSSL,
76:                                          logger
77:                                          );
78: }
79:
80: /**
81: * Create an IMAPFolder object.
82: */
83: protected IMAPFolder newIMAPFolder(String fullName, char separator,
84:                                 Boolean isNamespace) {
85:         return new GmailFolder(fullName, separator, this, isNamespace);
86: }
87:
88: /**
89: * Create an IMAPFolder object.
90: */
91: protected IMAPFolder newIMAPFolder(ListInfo li) {
92:         return new GmailFolder(li, this);
93: }
94: }