1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
/* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.xml.ws; import java.util.List; import java.util.Map; import javax.xml.ws.spi.Provider; /** * A Web service endpoint. * * <p>Endpoints are created using the static methods defined in this * class. An endpoint is always tied to one <code>Binding</code> * and one implementor, both set at endpoint creation time. * * <p>An endpoint is either in a published or an unpublished state. * The <code>publish</code> methods can be used to start publishing * an endpoint, at which point it starts accepting incoming requests. * Conversely, the <code>stop</code> method can be used to stop * accepting incoming requests and take the endpoint down. * Once stopped, an endpoint cannot be published again. * * <p>An <code>Executor</code> may be set on the endpoint in order * to gain better control over the threads used to dispatch incoming * requests. For instance, thread pooling with certain parameters * can be enabled by creating a <code>ThreadPoolExecutor</code> and * registering it with the endpoint. * * <p>Handler chains can be set using the contained <code>Binding</code>. * * <p>An endpoint may have a list of metadata documents, such as WSDL * and XMLSchema documents, bound to it. At publishing time, the * JAX-WS implementation will try to reuse as much of that metadata * as possible instead of generating new one based on the annotations * present on the implementor. * * @since JAX-WS 2.0 * * @see javax.xml.ws.Binding * @see javax.xml.ws.BindingType * @see javax.xml.ws.soap.SOAPBinding * @see java.util.concurrent.Executor * **/ public abstract class Endpoint { /** Standard property: name of WSDL service. * <p>Type: javax.xml.namespace.QName **/ public static final String WSDL_SERVICE = "javax.xml.ws.wsdl.service"; /** Standard property: name of WSDL port. * <p>Type: javax.xml.namespace.QName **/ public static final String WSDL_PORT = "javax.xml.ws.wsdl.port"; /** * Creates an endpoint with the specified implementor object. If there is * a binding specified via a BindingType annotation then it MUST be used else * a default of SOAP 1.1 / HTTP binding MUST be used. * <p> * The newly created endpoint may be published by calling * one of the javax.xml.ws.Endpoint#publish(String) and * javax.xml.ws.Endpoint#publish(Object) methods. * * * @param implementor The endpoint implementor. * * @return The newly created endpoint. * **/ public static Endpoint create(Object implementor) { return create(null, implementor); } /** * Creates an endpoint with the specified binding type and * implementor object. * <p> * The newly created endpoint may be published by calling * one of the javax.xml.ws.Endpoint#publish(String) and * javax.xml.ws.Endpoint#publish(Object) methods. * * @param bindingId A URI specifying the binding to use. If the bindingID is * <code>null</code> and no binding is specified via a BindingType * annotation then a default SOAP 1.1 / HTTP binding MUST be used. * * @param implementor The endpoint implementor. * * @return The newly created endpoint. * **/ public static Endpoint create(String bindingId, Object implementor) { return Provider.provider().createEndpoint(bindingId, implementor); } /** * Returns the binding for this endpoint. * * @return The binding for this endpoint **/ public abstract Binding getBinding(); /** * Returns the implementation object for this endpoint. * * @return The implementor for this endpoint **/ public abstract Object getImplementor(); /** * Publishes this endpoint at the given address. * The necessary server infrastructure will be created and * configured by the JAX-WS implementation using some default configuration. * In order to get more control over the server configuration, please * use the javax.xml.ws.Endpoint#publish(Object) method instead. * * @param address A URI specifying the address to use. The address * must be compatible with the binding specified at the * time the endpoint was created. * * @throws java.lang.IllegalArgumentException * If the provided address URI is not usable * in conjunction with the endpoint's binding. * * @throws java.lang.IllegalStateException * If the endpoint has been published already or it has been stopped. **/ public abstract void publish(String address); /** * Creates and publishes an endpoint for the specified implementor * object at the given address. * <p> * The necessary server infrastructure will be created and * configured by the JAX-WS implementation using some default configuration. * * In order to get more control over the server configuration, please * use the javax.xml.ws.Endpoint#create(String,Object) and * javax.xml.ws.Endpoint#publish(Object) method instead. * * @param address A URI specifying the address and transport/protocol * to use. A http: URI must result in the SOAP 1.1/HTTP * binding being used. Implementations may support other * URI schemes. * @param implementor The endpoint implementor. * * @return The newly created endpoint. * **/ public static Endpoint publish (String address, Object implementor) { return Provider.provider().createAndPublishEndpoint(address, implementor); } /** * Publishes this endpoint at the provided server context. * A server context encapsulates the server infrastructure * and addressing information for a particular transport. * For a call to this method to succeed, the server context * passed as an argument to it must be compatible with the * endpoint's binding. * * @param serverContext An object representing a server * context to be used for publishing the endpoint. * * @throws java.lang.IllegalArgumentException * If the provided server context is not * supported by the implementation or turns * out to be unusable in conjunction with the * endpoint's binding. * * @throws java.lang.IllegalStateException * If the endpoint has been published already or it has been stopped. **/ public abstract void publish(Object serverContext); /** * Stops publishing this endpoint. * * If the endpoint is not in a published state, this method * has not effect. * **/ public abstract void stop(); /** * Returns true if the endpoint is in the published state. * * @return <code>true</code> if the endpoint is in the published state. **/ public abstract boolean isPublished(); /** * Returns a list of metadata documents for the service. * * @return <code>List<javax.xml.transform.Source></code> A list of metadata documents for the service **/ public abstract List<javax.xml.transform.Source> getMetadata(); /** * Sets the metadata for this endpoint. * * @param metadata A list of XML document sources containing * metadata information for the endpoint (e.g. * WSDL or XML Schema documents) * * @throws java.lang.IllegalStateException If the endpoint * has already been published. **/ public abstract void setMetadata(List<javax.xml.transform.Source> metadata); /** * Returns the executor for this <code>Endpoint</code>instance. * * The executor is used to dispatch an incoming request to * the implementor object. * * @return The <code>java.util.concurrent.Executor</code> to be * used to dispatch a request. * * @see java.util.concurrent.Executor **/ public abstract java.util.concurrent.Executor getExecutor(); /** * Sets the executor for this <code>Endpoint</code> instance. * * The executor is used to dispatch an incoming request to * the implementor object. * * If this <code>Endpoint</code> is published using the * <code>publish(Object)</code> method and the specified server * context defines its own threading behavior, the executor * may be ignored. * * @param executor The <code>java.util.concurrent.Executor</code> * to be used to dispatch a request. * * @throws SecurityException If the instance does not support * setting an executor for security reasons (e.g. the * necessary permissions are missing). * * @see java.util.concurrent.Executor **/ public abstract void setExecutor(java.util.concurrent.Executor executor); /** * Returns the property bag for this <code>Endpoint</code> instance. * * @return Map<String,Object> The property bag * associated with this instance. **/ public abstract Map<String,Object> getProperties(); /** * Sets the property bag for this <code>Endpoint</code> instance. * * @param properties The property bag associated with * this instance. **/ public abstract void setProperties(Map<String,Object> properties); }