View Javadoc

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