Skip to content

Package: MailSessionDefinition

MailSessionDefinition

Coverage

1: /*
2: * Copyright (c) 2012, 2021 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 jakarta.mail;
18:
19: import java.lang.annotation.ElementType;
20: import java.lang.annotation.Retention;
21: import java.lang.annotation.RetentionPolicy;
22: import java.lang.annotation.Target;
23: import java.lang.annotation.Repeatable;
24:
25: /**
26: * Annotation used by Jakarta EE applications to define a <code>MailSession</code>
27: * to be registered with JNDI. The <code>MailSession</code> may be configured
28: * by setting the annotation elements for commonly used <code>Session</code>
29: * properties. Additional standard and vendor-specific properties may be
30: * specified using the <code>properties</code> element.
31: * <p>
32: * The session will be registered under the name specified in the
33: * <code>name</code> element. It may be defined to be in any valid
34: * <code>Jakarta EE</code> namespace, and will determine the accessibility of
35: * the session from other components.
36: *
37: * @since JavaMail 1.5
38: */
39: @Target({ElementType.TYPE})
40: @Retention(RetentionPolicy.RUNTIME)
41: @Repeatable(MailSessionDefinitions.class)
42: public @interface MailSessionDefinition {
43:
44: /**
45: * Description of this mail session.
46: *
47: * @return        the description
48: */
49: String description() default "";
50:
51: /**
52: * JNDI name by which the mail session will be registered.
53: *
54: * @return        the JNDI name
55: */
56: String name();
57:
58: /**
59: * Store protocol name.
60: *
61: * @return        the store protocol name
62: */
63: String storeProtocol() default "";
64:
65: /**
66: * Transport protocol name.
67: *
68: * @return        the transport protocol name
69: */
70: String transportProtocol() default "";
71:
72: /**
73: * Host name for the mail server.
74: *
75: * @return        the host name
76: */
77: String host() default "";
78:
79: /**
80: * User name to use for authentication.
81: *
82: * @return        the user name
83: */
84: String user() default "";
85:
86: /**
87: * Password to use for authentication.
88: *
89: * @return        the password
90: */
91: String password() default "";
92:
93: /**
94: * From address for the user.
95: *
96: * @return        the from address
97: */
98: String from() default "";
99:
100: /**
101: * Properties to include in the Session.
102: * Properties are specified using the format:
103: * <i>propertyName=propertyValue</i> with one property per array element.
104: *
105: * @return        the properties
106: */
107: String[] properties() default {};
108: }