Tue, 07 Nov 2017 18:54:04 -0800
Added tag jdk8u162-b06 for changeset 6095742f8034
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package javax.xml.ws; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import javax.xml.ws.soap.Addressing; |
aoqi@0 | 29 | import javax.xml.ws.spi.WebServiceFeatureAnnotation; |
aoqi@0 | 30 | import java.lang.annotation.Documented; |
aoqi@0 | 31 | import java.lang.annotation.Target; |
aoqi@0 | 32 | import java.lang.annotation.ElementType; |
aoqi@0 | 33 | import java.lang.annotation.Retention; |
aoqi@0 | 34 | import java.lang.annotation.RetentionPolicy; |
aoqi@0 | 35 | |
aoqi@0 | 36 | /** |
aoqi@0 | 37 | * The <code>WebServiceRef</code> annotation is used to |
aoqi@0 | 38 | * define a reference to a web service and |
aoqi@0 | 39 | * (optionally) an injection target for it. |
aoqi@0 | 40 | * It can be used to inject both service and proxy |
aoqi@0 | 41 | * instances. These injected references are not thread safe. |
aoqi@0 | 42 | * If the references are accessed by multiple threads, |
aoqi@0 | 43 | * usual synchronization techinques can be used to |
aoqi@0 | 44 | * support multiple threads. |
aoqi@0 | 45 | * |
aoqi@0 | 46 | * <p> |
aoqi@0 | 47 | * Web service references are resources in the Java EE 5 sense. |
aoqi@0 | 48 | * The annotations (for example, {@link Addressing}) annotated with |
aoqi@0 | 49 | * meta-annotation {@link WebServiceFeatureAnnotation} |
aoqi@0 | 50 | * can be used in conjunction with <code>WebServiceRef</code>. |
aoqi@0 | 51 | * The created reference MUST be configured with annotation's web service |
aoqi@0 | 52 | * feature. |
aoqi@0 | 53 | * |
aoqi@0 | 54 | * <p> |
aoqi@0 | 55 | * For example, in the code below, the injected |
aoqi@0 | 56 | * <code>StockQuoteProvider</code> proxy MUST |
aoqi@0 | 57 | * have WS-Addressing enabled as specifed by the |
aoqi@0 | 58 | * {@link Addressing} |
aoqi@0 | 59 | * annotation. |
aoqi@0 | 60 | * |
aoqi@0 | 61 | * <pre><code> |
aoqi@0 | 62 | * public class MyClient { |
aoqi@0 | 63 | * @Addressing |
aoqi@0 | 64 | * @WebServiceRef(StockQuoteService.class) |
aoqi@0 | 65 | * private StockQuoteProvider stockQuoteProvider; |
aoqi@0 | 66 | * ... |
aoqi@0 | 67 | * } |
aoqi@0 | 68 | * </code></pre> |
aoqi@0 | 69 | * |
aoqi@0 | 70 | * <p> |
aoqi@0 | 71 | * If a JAX-WS implementation encounters an unsupported or unrecognized |
aoqi@0 | 72 | * annotation annotated with the <code>WebServiceFeatureAnnotation</code> |
aoqi@0 | 73 | * that is specified with <code>WebServiceRef</code>, an ERROR MUST be given. |
aoqi@0 | 74 | * |
aoqi@0 | 75 | * @see javax.annotation.Resource |
aoqi@0 | 76 | * @see WebServiceFeatureAnnotation |
aoqi@0 | 77 | * |
aoqi@0 | 78 | * @since JAX-WS 2.0 |
aoqi@0 | 79 | * |
aoqi@0 | 80 | **/ |
aoqi@0 | 81 | |
aoqi@0 | 82 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) |
aoqi@0 | 83 | @Retention(RetentionPolicy.RUNTIME) |
aoqi@0 | 84 | @Documented |
aoqi@0 | 85 | public @interface WebServiceRef { |
aoqi@0 | 86 | /** |
aoqi@0 | 87 | * The JNDI name of the resource. For field annotations, |
aoqi@0 | 88 | * the default is the field name. For method annotations, |
aoqi@0 | 89 | * the default is the JavaBeans property name corresponding |
aoqi@0 | 90 | * to the method. For class annotations, there is no default |
aoqi@0 | 91 | * and this MUST be specified. |
aoqi@0 | 92 | * |
aoqi@0 | 93 | * The JNDI name can be absolute(with any logical namespace) or relative |
aoqi@0 | 94 | * to JNDI <code>java:comp/env</code> namespace. |
aoqi@0 | 95 | */ |
aoqi@0 | 96 | String name() default ""; |
aoqi@0 | 97 | |
aoqi@0 | 98 | /** |
aoqi@0 | 99 | * The Java type of the resource. For field annotations, |
aoqi@0 | 100 | * the default is the type of the field. For method annotations, |
aoqi@0 | 101 | * the default is the type of the JavaBeans property. |
aoqi@0 | 102 | * For class annotations, there is no default and this MUST be |
aoqi@0 | 103 | * specified. |
aoqi@0 | 104 | */ |
aoqi@0 | 105 | Class<?> type() default Object.class; |
aoqi@0 | 106 | |
aoqi@0 | 107 | /** |
aoqi@0 | 108 | * A product specific name that this resource should be mapped to. |
aoqi@0 | 109 | * The name of this resource, as defined by the <code>name</code> |
aoqi@0 | 110 | * element or defaulted, is a name that is local to the application |
aoqi@0 | 111 | * component using the resource. (When a relative JNDI name |
aoqi@0 | 112 | * is specified, then it's a name in the JNDI |
aoqi@0 | 113 | * <code>java:comp/env</code> namespace.) Many application servers |
aoqi@0 | 114 | * provide a way to map these local names to names of resources |
aoqi@0 | 115 | * known to the application server. This mapped name is often a |
aoqi@0 | 116 | * <i>global</i> JNDI name, but may be a name of any form. |
aoqi@0 | 117 | * <p> |
aoqi@0 | 118 | * Application servers are not required to support any particular |
aoqi@0 | 119 | * form or type of mapped name, nor the ability to use mapped names. |
aoqi@0 | 120 | * The mapped name is product-dependent and often installation-dependent. |
aoqi@0 | 121 | * No use of a mapped name is portable. |
aoqi@0 | 122 | */ |
aoqi@0 | 123 | String mappedName() default ""; |
aoqi@0 | 124 | |
aoqi@0 | 125 | /** |
aoqi@0 | 126 | * The service class, alwiays a type extending |
aoqi@0 | 127 | * <code>javax.xml.ws.Service</code>. This element MUST be specified |
aoqi@0 | 128 | * whenever the type of the reference is a service endpoint interface. |
aoqi@0 | 129 | */ |
aoqi@0 | 130 | // 2.1 has Class value() default Object.class; |
aoqi@0 | 131 | // Fixing this raw Class type correctly in 2.2 API. This shouldn't cause |
aoqi@0 | 132 | // any compatibility issues for applications. |
aoqi@0 | 133 | Class<? extends Service> value() default Service.class; |
aoqi@0 | 134 | |
aoqi@0 | 135 | /** |
aoqi@0 | 136 | * A URL pointing to the WSDL document for the web service. |
aoqi@0 | 137 | * If not specified, the WSDL location specified by annotations |
aoqi@0 | 138 | * on the resource type is used instead. |
aoqi@0 | 139 | */ |
aoqi@0 | 140 | String wsdlLocation() default ""; |
aoqi@0 | 141 | |
aoqi@0 | 142 | /** |
aoqi@0 | 143 | * A portable JNDI lookup name that resolves to the target |
aoqi@0 | 144 | * web service reference. |
aoqi@0 | 145 | * |
aoqi@0 | 146 | * @since JAX-WS 2.2 |
aoqi@0 | 147 | */ |
aoqi@0 | 148 | String lookup() default ""; |
aoqi@0 | 149 | |
aoqi@0 | 150 | } |