View Javadoc

1   /**
2    *
3    * Copyright 2003-2006 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  
18  package javax.mail;
19  
20  /**
21   * @version $Rev: 421852 $ $Date: 2006-07-14 03:02:19 -0700 (Fri, 14 Jul 2006) $
22   */
23  public class Provider {
24      /**
25       * A enumeration inner class that defines Provider types.
26       */
27      public static class Type {
28          /**
29           * A message store provider such as POP3 or IMAP4.
30           */
31          public static final Type STORE = new Type();
32  
33          /**
34           * A message transport provider such as SMTP.
35           */
36          public static final Type TRANSPORT = new Type();
37  
38          private Type() {
39          }
40      }
41  
42      private final String className;
43      private final String protocol;
44      private final Type type;
45      private final String vendor;
46      private final String version;
47  
48      public Provider(Type type, String protocol, String className, String vendor, String version) {
49          this.protocol = protocol;
50          this.className = className;
51          this.type = type;
52          this.vendor = vendor;
53          this.version = version;
54      }
55  
56      public String getClassName() {
57          return className;
58      }
59  
60      public String getProtocol() {
61          return protocol;
62      }
63  
64      public Type getType() {
65          return type;
66      }
67  
68      public String getVendor() {
69          return vendor;
70      }
71  
72      public String getVersion() {
73          return version;
74      }
75  
76      public String toString() {
77          return "protocol="
78                  + protocol
79                  + "; type="
80                  + type
81                  + "; class="
82                  + className
83                  + (vendor == null ? "" : "; vendor=" + vendor)
84                  + (version == null ? "" : ";version=" + version);
85      }
86  }