|
| 1 | +/* |
| 2 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 3 | + * |
| 4 | + * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. |
| 5 | + * |
| 6 | + * The contents of this file are subject to the terms of either the GNU |
| 7 | + * General Public License Version 2 only ("GPL") or the Common Development |
| 8 | + * and Distribution License("CDDL") (collectively, the "License"). You |
| 9 | + * may not use this file except in compliance with the License. You can |
| 10 | + * obtain a copy of the License at |
| 11 | + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 |
| 12 | + * or LICENSE.txt. See the License for the specific |
| 13 | + * language governing permissions and limitations under the License. |
| 14 | + * |
| 15 | + * When distributing the software, include this License Header Notice in each |
| 16 | + * file and include the License file at LICENSE.txt. |
| 17 | + * |
| 18 | + * GPL Classpath Exception: |
| 19 | + * Oracle designates this particular file as subject to the "Classpath" |
| 20 | + * exception as provided by Oracle in the GPL Version 2 section of the License |
| 21 | + * file that accompanied this code. |
| 22 | + * |
| 23 | + * Modifications: |
| 24 | + * If applicable, add the following below the License Header, with the fields |
| 25 | + * enclosed by brackets [] replaced by your own identifying information: |
| 26 | + * "Portions Copyright [year] [name of copyright owner]" |
| 27 | + * |
| 28 | + * Contributor(s): |
| 29 | + * If you wish your version of this file to be governed by only the CDDL or |
| 30 | + * only the GPL Version 2, indicate your decision by adding "[Contributor] |
| 31 | + * elects to include this software in this distribution under the [CDDL or GPL |
| 32 | + * Version 2] license." If you don't indicate a single choice of license, a |
| 33 | + * recipient has the option to distribute your version of this file under |
| 34 | + * either the CDDL, the GPL Version 2 or to extend the choice of license to |
| 35 | + * its licensees as provided above. However, if you add GPL Version 2 code |
| 36 | + * and therefore, elected the GPL Version 2 license, then the option applies |
| 37 | + * only if the new code is made subject to such option by the copyright |
| 38 | + * holder. |
| 39 | + */ |
| 40 | + |
| 41 | +package javax.ejb; |
| 42 | + |
| 43 | +import java.lang.annotation.Target; |
| 44 | +import static java.lang.annotation.ElementType.*; |
| 45 | +import java.lang.annotation.Retention; |
| 46 | +import static java.lang.annotation.RetentionPolicy.*; |
| 47 | + |
| 48 | +/** |
| 49 | + * Indicates a dependency on the local, no-interface, or remote view of an Enterprise |
| 50 | + * JavaBean. |
| 51 | + * <p> |
| 52 | + * Either the <code>beanName</code> or the <code>lookup</code> element can |
| 53 | + * be used to resolve the EJB dependency to its target session bean component. |
| 54 | + * It is an error to specify values for both <code>beanName</code> and |
| 55 | + * <code>lookup</code>. |
| 56 | + * <p> |
| 57 | + * If no explicit linking information is provided and there is only one session |
| 58 | + * bean within the same application that exposes the matching client view type, |
| 59 | + * by default the EJB dependency resolves to that session bean. |
| 60 | + * |
| 61 | + * @since EJB 3.0 |
| 62 | + */ |
| 63 | + |
| 64 | +@Target({TYPE, METHOD, FIELD}) |
| 65 | +@Retention(RUNTIME) |
| 66 | +public @interface EJB { |
| 67 | + |
| 68 | + /** |
| 69 | + * The logical name of the ejb reference within the declaring component's |
| 70 | + * (e.g., java:comp/env) environment. |
| 71 | + */ |
| 72 | + String name() default ""; |
| 73 | + |
| 74 | + /** |
| 75 | + * A string describing the bean. |
| 76 | + */ |
| 77 | + String description() default ""; |
| 78 | + |
| 79 | + /** |
| 80 | + * The <code>beanName</code> element references the value of the <code>name</code> |
| 81 | + * element of the <code>Stateful</code> or <code>Stateless</code> annotation, |
| 82 | + * whether defaulted or explicit. If the deployment descriptor was used to define |
| 83 | + * the name of the bean, the <code>beanName</code> element references the |
| 84 | + * <code>ejb-name</code> element of the bean definition. |
| 85 | + * <p> |
| 86 | + * The <code>beanName</code> element allows disambiguation if multiple session |
| 87 | + * beans in the ejb-jar implement the same interface. |
| 88 | + * <p> |
| 89 | + * In order to reference a bean in another ejb-jar file in the same application, |
| 90 | + * the <code>beanName</code> may be composed of a path name specifying the ejb-jar |
| 91 | + * containing the referenced bean with the bean name of the target bean appended and |
| 92 | + * separated from the path name by #. The path name is relative to the jar file |
| 93 | + * containing the component that is referencing the target bean. |
| 94 | + * <p> |
| 95 | + * Only applicable if the target EJB is defined within the |
| 96 | + * same application or stand-alone module as the declaring component. |
| 97 | + */ |
| 98 | + String beanName() default ""; |
| 99 | + |
| 100 | + /** |
| 101 | + * The interface type of the Enterprise Java Bean to which this reference |
| 102 | + * is mapped. |
| 103 | + * <p> |
| 104 | + * Holds one of the following types of the target EJB : |
| 105 | + * <ul> |
| 106 | + * <li> Local business interface |
| 107 | + * <li> Bean class (for no-interface view) |
| 108 | + * <li> Remote business interface |
| 109 | + * <li> Local Home interface |
| 110 | + * <li> Remote Home interface |
| 111 | + * </ul> |
| 112 | + */ |
| 113 | + Class beanInterface() default Object.class; |
| 114 | + |
| 115 | + /** |
| 116 | + * The product specific name of the EJB component to which this |
| 117 | + * ejb reference should be mapped. This mapped name is often a |
| 118 | + * global JNDI name, but may be a name of any form. |
| 119 | + * <p> |
| 120 | + * Application servers are not required to support any particular |
| 121 | + * form or type of mapped name, nor the ability to use mapped names. |
| 122 | + * The mapped name is product-dependent and often installation-dependent. |
| 123 | + * No use of a mapped name is portable. |
| 124 | + */ |
| 125 | + String mappedName() default ""; |
| 126 | + |
| 127 | + /** |
| 128 | + * A portable lookup string containing the JNDI name for the target EJB component. |
| 129 | + * |
| 130 | + * @since EJB 3.1 |
| 131 | + */ |
| 132 | + String lookup() default ""; |
| 133 | +} |
0 commit comments