Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java
38890 views
/*1* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.ws;2627import javax.xml.ws.soap.Addressing;28import javax.xml.ws.spi.WebServiceFeatureAnnotation;29import java.lang.annotation.Documented;30import java.lang.annotation.Target;31import java.lang.annotation.ElementType;32import java.lang.annotation.Retention;33import java.lang.annotation.RetentionPolicy;3435/**36* The <code>WebServiceRef</code> annotation is used to37* define a reference to a web service and38* (optionally) an injection target for it.39* It can be used to inject both service and proxy40* instances. These injected references are not thread safe.41* If the references are accessed by multiple threads,42* usual synchronization techinques can be used to43* support multiple threads.44*45* <p>46* Web service references are resources in the Java EE 5 sense.47* The annotations (for example, {@link Addressing}) annotated with48* meta-annotation {@link WebServiceFeatureAnnotation}49* can be used in conjunction with <code>WebServiceRef</code>.50* The created reference MUST be configured with annotation's web service51* feature.52*53* <p>54* For example, in the code below, the injected55* <code>StockQuoteProvider</code> proxy MUST56* have WS-Addressing enabled as specifed by the57* {@link Addressing}58* annotation.59*60* <pre><code>61* public class MyClient {62* @Addressing63* @WebServiceRef(StockQuoteService.class)64* private StockQuoteProvider stockQuoteProvider;65* ...66* }67* </code></pre>68*69* <p>70* If a JAX-WS implementation encounters an unsupported or unrecognized71* annotation annotated with the <code>WebServiceFeatureAnnotation</code>72* that is specified with <code>WebServiceRef</code>, an ERROR MUST be given.73*74* @see javax.annotation.Resource75* @see WebServiceFeatureAnnotation76*77* @since JAX-WS 2.078*79**/8081@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})82@Retention(RetentionPolicy.RUNTIME)83@Documented84public @interface WebServiceRef {85/**86* The JNDI name of the resource. For field annotations,87* the default is the field name. For method annotations,88* the default is the JavaBeans property name corresponding89* to the method. For class annotations, there is no default90* and this MUST be specified.91*92* The JNDI name can be absolute(with any logical namespace) or relative93* to JNDI <code>java:comp/env</code> namespace.94*/95String name() default "";9697/**98* The Java type of the resource. For field annotations,99* the default is the type of the field. For method annotations,100* the default is the type of the JavaBeans property.101* For class annotations, there is no default and this MUST be102* specified.103*/104Class<?> type() default Object.class;105106/**107* A product specific name that this resource should be mapped to.108* The name of this resource, as defined by the <code>name</code>109* element or defaulted, is a name that is local to the application110* component using the resource. (When a relative JNDI name111* is specified, then it's a name in the JNDI112* <code>java:comp/env</code> namespace.) Many application servers113* provide a way to map these local names to names of resources114* known to the application server. This mapped name is often a115* <i>global</i> JNDI name, but may be a name of any form.116* <p>117* Application servers are not required to support any particular118* form or type of mapped name, nor the ability to use mapped names.119* The mapped name is product-dependent and often installation-dependent.120* No use of a mapped name is portable.121*/122String mappedName() default "";123124/**125* The service class, alwiays a type extending126* <code>javax.xml.ws.Service</code>. This element MUST be specified127* whenever the type of the reference is a service endpoint interface.128*/129// 2.1 has Class value() default Object.class;130// Fixing this raw Class type correctly in 2.2 API. This shouldn't cause131// any compatibility issues for applications.132Class<? extends Service> value() default Service.class;133134/**135* A URL pointing to the WSDL document for the web service.136* If not specified, the WSDL location specified by annotations137* on the resource type is used instead.138*/139String wsdlLocation() default "";140141/**142* A portable JNDI lookup name that resolves to the target143* web service reference.144*145* @since JAX-WS 2.2146*/147String lookup() default "";148149}150151152