|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.xml.ws.api.server.WSEndpoint<T>
public abstract class WSEndpoint<T>
Root object that hosts the Packet
processing code
at the server.
One instance of WSEndpoint
is created for each deployed service
endpoint. A hosted service usually handles multiple concurrent
requests. To do this efficiently, an endpoint handles incoming
Packet
through WSEndpoint.PipeHead
s, where many copies can be created
for each endpoint.
Each WSEndpoint.PipeHead
is thread-unsafe, and request needs to be
serialized. A WSEndpoint.PipeHead
represents a sizable resource
(in particular a whole pipeline), so the caller is expected to
reuse them and avoid excessive allocations as much as possible.
Making WSEndpoint.PipeHead
s thread-unsafe allow the JAX-WS RI internal to
tie thread-local resources to WSEndpoint.PipeHead
, and reduce the total
resource management overhead.
To abbreviate this resource management (and for a few other reasons),
JAX-WS RI provides Adapter
class. If you are hosting a JAX-WS
service, you'll most likely want to send requests to WSEndpoint
through Adapter
.
WSEndpoint
is ready to handle Packet
s as soon as
it's created. No separate post-initialization step is necessary.
However, to comply with the JAX-WS spec requirement, the caller
is expected to call the dispose()
method to allow an
orderly shut-down of a hosted service.
WSEndpoint
exposes a series of information that represents
how an endpoint is configured to host a service. See the getXXX methods
for more details.
WSEndpoint
owns a WSWebServiceContext
implementation.
But a bulk of the work is delegated to WebServiceContextDelegate
,
which is passed in as a parameter to WSEndpoint.PipeHead.process(Packet, WebServiceContextDelegate, TransportBackChannel)
.
Nested Class Summary | |
---|---|
static interface |
WSEndpoint.CompletionCallback
Callback to notify that jax-ws runtime has finished execution of a request submitted via schedule(). |
static interface |
WSEndpoint.PipeHead
Represents a resource local to a thread. |
Constructor Summary | |
---|---|
WSEndpoint()
|
Method Summary | ||
---|---|---|
abstract void |
closeManagedObjectManager()
Close the ManagedObjectManager for this endpoint. |
|
static
|
create(Class<T> implType,
boolean processHandlerAnnotation,
Invoker invoker,
QName serviceName,
QName portName,
Container container,
WSBinding binding,
SDDocumentSource primaryWsdl,
Collection<? extends SDDocumentSource> metadata,
EntityResolver resolver)
Deprecated. |
|
static
|
create(Class<T> implType,
boolean processHandlerAnnotation,
Invoker invoker,
QName serviceName,
QName portName,
Container container,
WSBinding binding,
SDDocumentSource primaryWsdl,
Collection<? extends SDDocumentSource> metadata,
EntityResolver resolver,
boolean isTransportSynchronous)
Creates an endpoint from deployment or programmatic configuration |
|
static
|
create(Class<T> implType,
boolean processHandlerAnnotation,
Invoker invoker,
QName serviceName,
QName portName,
Container container,
WSBinding binding,
SDDocumentSource primaryWsdl,
Collection<? extends SDDocumentSource> metadata,
EntityResolver resolver,
boolean isTransportSynchronous,
boolean isStandard)
|
|
static
|
create(Class<T> implType,
boolean processHandlerAnnotation,
Invoker invoker,
QName serviceName,
QName portName,
Container container,
WSBinding binding,
SDDocumentSource primaryWsdl,
Collection<? extends SDDocumentSource> metadata,
URL catalogUrl)
The same as create(Class, boolean, Invoker, QName, QName, Container, WSBinding, SDDocumentSource, Collection, EntityResolver)
except that this version takes an url of the jax-ws-catalog.xml. |
|
abstract Codec |
createCodec()
Gets the Endpoint's codec that is used to encode/decode Message s. |
|
abstract WSEndpoint.PipeHead |
createPipeHead()
Creates a new WSEndpoint.PipeHead to process
incoming requests. |
|
abstract void |
dispose()
Indicates that the WSEndpoint is about to be turned off,
and will no longer serve any packet anymore. |
|
boolean |
equalsProxiedInstance(WSEndpoint endpoint)
Used for managed endpoints infrastructure to compare equality of proxies vs proxied endpoints. |
|
abstract ServerTubeAssemblerContext |
getAssemblerContext()
This is only needed to expose info for monitoring. |
|
abstract WSBinding |
getBinding()
Represents the binding for which this WSEndpoint
is created for. |
|
List<BoundEndpoint> |
getBoundEndpoints()
Gets the list of BoundEndpoint that are associated
with this endpoint. |
|
abstract Set<EndpointComponent> |
getComponentRegistry()
Deprecated. |
|
Set<Component> |
getComponents()
Returns the set of Component s registered with this object |
|
abstract Container |
getContainer()
Gets the Container object. |
|
static QName |
getDefaultPortName(QName serviceName,
Class endpointClass)
Gives the wsdl:service/wsdl:port default name computed from the endpoint implementaiton class |
|
static QName |
getDefaultPortName(QName serviceName,
Class endpointClass,
boolean isStandard)
|
|
static QName |
getDefaultPortName(QName serviceName,
Class endpointClass,
boolean isStandard,
MetadataReader metadataReader)
|
|
static QName |
getDefaultPortName(QName serviceName,
Class endpointClass,
MetadataReader metadataReader)
|
|
static QName |
getDefaultServiceName(Class endpointClass)
Gives the wsdl:service default name computed from the endpoint implementaiton class |
|
static QName |
getDefaultServiceName(Class endpointClass,
boolean isStandard)
|
|
static QName |
getDefaultServiceName(Class endpointClass,
boolean isStandard,
MetadataReader metadataReader)
|
|
static QName |
getDefaultServiceName(Class endpointClass,
MetadataReader metadataReader)
|
|
abstract
|
getEndpointReference(Class<T> clazz,
String address,
String wsdlAddress,
Element... referenceParameters)
Return EndpointReference instance, based on passed parameters and spec version represented by clazz |
|
abstract
|
getEndpointReference(Class<T> clazz,
String address,
String wsdlAddress,
List<Element> metadata,
List<Element> referenceParameters)
|
|
Engine |
getEngine()
Returns Engine for this endpoint |
|
abstract Class<T> |
getImplementationClass()
Gets the application endpoint Class that eventually serves the request. |
|
abstract org.glassfish.gmbal.ManagedObjectManager |
getManagedObjectManager()
Get the ManagedObjectManager for this endpoint. |
|
abstract OperationDispatcher |
getOperationDispatcher()
Nullable when there is no associated WSDL Model |
|
abstract com.sun.xml.ws.policy.PolicyMap |
getPolicyMap()
Deprecated. Do not use this method as the PolicyMap API is not final yet and might change in next few months. |
|
abstract WSDLPort |
getPort()
Gets the port that this endpoint is serving. |
|
abstract QName |
getPortName()
Gets the application endpoint's portName. |
|
abstract SEIModel |
getSEIModel()
Gets the SEIModel that represents the relationship
between WSDL and Java SEI. |
|
abstract ServiceDefinition |
getServiceDefinition()
Gets the description of the service. |
|
abstract QName |
getServiceName()
Gets the application endpoint's serviceName. |
|
|
getSPI(Class<S> spiType)
Gets the specified SPI. |
|
void |
process(Packet request,
WSEndpoint.CompletionCallback callback,
FiberContextSwitchInterceptor interceptor)
|
|
void |
schedule(Packet request,
WSEndpoint.CompletionCallback callback)
This method takes a Packet that represents
a request, run it through a Tube line, eventually
pass it to the user implementation code, which produces
a reply, then run that through the tubeline again,
and eventually return it as a return value through WSEndpoint.CompletionCallback . |
|
abstract void |
schedule(Packet request,
WSEndpoint.CompletionCallback callback,
FiberContextSwitchInterceptor interceptor)
Schedule invocation of web service asynchronously. |
|
abstract void |
setExecutor(Executor exec)
Set this Executor to run asynchronous requests using this executor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WSEndpoint()
Method Detail |
---|
@NotNull public abstract Codec createCodec()
Message
s. This is a
copy of the master codec and it shouldn't be shared across two requests running
concurrently(unless it is stateless).
@NotNull public abstract QName getServiceName()
@NotNull public abstract QName getPortName()
@NotNull public abstract Class<T> getImplementationClass()
Class
that eventually serves the request.
This is the same value given to the create(java.lang.Class
method.
@NotNull public abstract WSBinding getBinding()
WSEndpoint
is created for.
@NotNull public abstract Container getContainer()
Container
object.
The components inside WSEndpoint
uses this reference
to communicate with the hosting environment.
Container
instance
is given, Container.NONE
will be returned.@Nullable public abstract WSDLPort getPort()
A service is not required to have a WSDL, and when it doesn't,
this method returns null. Otherwise it returns an object that
describes the port that this WSEndpoint
is serving.
public abstract void setExecutor(@NotNull Executor exec)
Executor
to run asynchronous requests using this executor.
This executor is set on Engine
and must be set before
calling schedule(Packet,CompletionCallback)
and
schedule(Packet,CompletionCallback,FiberContextSwitchInterceptor)
methods.
exec
- Executor to run async requestspublic final void schedule(@NotNull Packet request, @NotNull WSEndpoint.CompletionCallback callback)
Packet
that represents
a request, run it through a Tube
line, eventually
pass it to the user implementation code, which produces
a reply, then run that through the tubeline again,
and eventually return it as a return value through WSEndpoint.CompletionCallback
.
This takes care of pooling of Tube
lines and reuses
tubeline for requests. Same instance of tubeline is not used concurrently
for two requests.
If the transport is capable of asynchronous execution, use this
instead of using WSEndpoint.PipeHead.process(com.sun.xml.ws.api.message.Packet, com.sun.xml.ws.api.server.WebServiceContextDelegate, com.sun.xml.ws.api.server.TransportBackChannel)
.
Before calling this method, set the executor using setExecutor(java.util.concurrent.Executor)
. The
executor may used multiple times to run this request in a asynchronous fashion.
The calling thread will be returned immediately, and the callback will be
called in a different a thread.
Packet.transportBackChannel
should have the correct value, so that
one-way message processing happens correctly. Packet.webServiceContextDelegate
should have the correct value, so that some WebServiceContext
methods correctly.
request
- web service requestcallback
- callback to get response packetPacket.transportBackChannel
,
Packet.webServiceContextDelegate
public abstract void schedule(@NotNull Packet request, @NotNull WSEndpoint.CompletionCallback callback, @Nullable FiberContextSwitchInterceptor interceptor)
request
- web service requestcallback
- callback to get response packet(exception if there is one)interceptor
- caller's interceptor to impose a context of executionschedule(Packet, CompletionCallback)
public void process(@NotNull Packet request, @NotNull WSEndpoint.CompletionCallback callback, @Nullable FiberContextSwitchInterceptor interceptor)
public Engine getEngine()
Engine
for this endpoint
@NotNull public abstract WSEndpoint.PipeHead createPipeHead()
WSEndpoint.PipeHead
to process
incoming requests.
This is not a cheap operation. The caller is expected
to reuse the returned WSEndpoint.PipeHead
. See
class javadoc
for details.
WSEndpoint.PipeHead
that's ready to serve.public abstract void dispose()
WSEndpoint
is about to be turned off,
and will no longer serve any packet anymore.
This method needs to be invoked for the JAX-WS RI to correctly
implement some of the spec semantics (TODO: pointer.)
It's the responsibility of the code that hosts a WSEndpoint
to invoke this method.
Once this method is called, the behavior is undefed for
all in-progress WSEndpoint.PipeHead.process(com.sun.xml.ws.api.message.Packet, com.sun.xml.ws.api.server.WebServiceContextDelegate, com.sun.xml.ws.api.server.TransportBackChannel)
methods (by other threads)
and future WSEndpoint.PipeHead.process(com.sun.xml.ws.api.message.Packet, com.sun.xml.ws.api.server.WebServiceContextDelegate, com.sun.xml.ws.api.server.TransportBackChannel)
method invocations.
@Nullable public abstract ServiceDefinition getServiceDefinition()
A description is a set of WSDL/schema and other documents that together describes a service. A service is not required to have a description, and when it doesn't, this method returns null.
public List<BoundEndpoint> getBoundEndpoints()
BoundEndpoint
that are associated
with this endpoint.
@NotNull public abstract Set<EndpointComponent> getComponentRegistry()
EndpointComponent
that are associated
with this endpoint.
Components (such as codec, tube, handler, etc) who wish to provide
some service to other components in the endpoint can iterate the
registry and call its EndpointComponent.getSPI(Class)
to
establish a private contract between components.
Components who wish to subscribe to such a service can add itself to this set.
@NotNull public Set<Component> getComponents()
ComponentRegistry
Component
s registered with this object
getComponents
in interface ComponentRegistry
@Nullable public <S> S getSPI(@NotNull Class<S> spiType)
Component
This method works as a kind of directory service for SPIs, allowing various components to define private contract and talk to each other.
getSPI
in interface Component
@Nullable public abstract SEIModel getSEIModel()
SEIModel
that represents the relationship
between WSDL and Java SEI.
This method returns a non-null value if and only if this endpoint is ultimately serving an application through an SEI.
public abstract com.sun.xml.ws.policy.PolicyMap getPolicyMap()
@NotNull public abstract org.glassfish.gmbal.ManagedObjectManager getManagedObjectManager()
public abstract void closeManagedObjectManager()
@NotNull public abstract ServerTubeAssemblerContext getAssemblerContext()
public static <T> WSEndpoint<T> create(@NotNull Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker, @Nullable QName serviceName, @Nullable QName portName, @Nullable Container container, @Nullable WSBinding binding, @Nullable SDDocumentSource primaryWsdl, @Nullable Collection<? extends SDDocumentSource> metadata, @Nullable EntityResolver resolver, boolean isTransportSynchronous)
This method works like the following:
ServiceDefinition
is modeleed from the given SEI type.
Invoker
that always serves implementationObject will be used.
implType
- Endpoint class(not SEI). Enpoint class must have @WebService or @WebServiceProvider
annotation.processHandlerAnnotation
- Flag to control processing of @HandlerChain on Impl class
if true, processes @HandlerChain on Impl
if false, DD might have set HandlerChain no need to parse.invoker
- Pass an object to invoke the actual endpoint object. If it is null, a default
invoker is created using InstanceResolver.createDefault(java.lang.Class, boolean)
. Appservers
could create its own invoker to do additional functions like transactions,
invoking the endpoint through proxy etc.serviceName
- Optional service name(may be from DD) to override the one given by the
implementation class. If it is null, it will be derived from annotations.portName
- Optional port name(may be from DD) to override the one given by the
implementation class. If it is null, it will be derived from annotations.container
- Allows technologies that are built on top of JAX-WS(such as WSIT) needs to
negotiate private contracts between them and the containerbinding
- JAX-WS implementation of Binding
. This object can be created by
BindingID.createBinding()
. Usually the binding can be got from
DD, BindingType
.
TODO: DD has a configuration for MTOM threshold.
Maybe we need something more generic so that other technologies
like Tango can get information from DD.
TODO: does it really make sense for this to take EntityResolver?
Given that all metadata has to be given as a list anyway.primaryWsdl
- The primary
WSDL.
If null, it'll be generated based on the SEI (if this is an SEI)
or no WSDL is associated (if it's a provider.)
TODO: shouldn't the implementation find this from the metadata list?metadata
- Other documents that become SDDocument
s. Can be null.resolver
- Optional resolver used to de-reference resources referenced from
WSDL. Must be null if the url
is null.isTransportSynchronous
- If the caller knows that the returned WSEndpoint
is going to be
used by a synchronous-only transport, then it may pass in true
to allow the callee to perform an optimization based on that knowledge
(since often synchronous version is cheaper than an asynchronous version.)
This value is visible from ServerTubeAssemblerContext.isSynchronous()
.
WSEndpoint
.
WebServiceException
- if the endpoint set up fails.public static <T> WSEndpoint<T> create(@NotNull Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker, @Nullable QName serviceName, @Nullable QName portName, @Nullable Container container, @Nullable WSBinding binding, @Nullable SDDocumentSource primaryWsdl, @Nullable Collection<? extends SDDocumentSource> metadata, @Nullable EntityResolver resolver, boolean isTransportSynchronous, boolean isStandard)
@Deprecated public static <T> WSEndpoint<T> create(@NotNull Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker, @Nullable QName serviceName, @Nullable QName portName, @Nullable Container container, @Nullable WSBinding binding, @Nullable SDDocumentSource primaryWsdl, @Nullable Collection<? extends SDDocumentSource> metadata, @Nullable EntityResolver resolver)
public static <T> WSEndpoint<T> create(@NotNull Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker, @Nullable QName serviceName, @Nullable QName portName, @Nullable Container container, @Nullable WSBinding binding, @Nullable SDDocumentSource primaryWsdl, @Nullable Collection<? extends SDDocumentSource> metadata, @Nullable URL catalogUrl)
create(Class, boolean, Invoker, QName, QName, Container, WSBinding, SDDocumentSource, Collection, EntityResolver)
except that this version takes an url of the jax-ws-catalog.xml.
catalogUrl
- if not null, an EntityResolver
is created from it and used.
otherwise no resolution will be performed.@NotNull public static QName getDefaultServiceName(Class endpointClass)
@NotNull public static QName getDefaultServiceName(Class endpointClass, MetadataReader metadataReader)
@NotNull public static QName getDefaultServiceName(Class endpointClass, boolean isStandard)
@NotNull public static QName getDefaultServiceName(Class endpointClass, boolean isStandard, MetadataReader metadataReader)
@NotNull public static QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass)
@NotNull public static QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass, MetadataReader metadataReader)
@NotNull public static QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass, boolean isStandard)
@NotNull public static QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass, boolean isStandard, MetadataReader metadataReader)
public abstract <T extends EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, Element... referenceParameters)
T
- clazz
- represents spec versionaddress
- endpoint addresswsdlAddress
- wsdl addressreferenceParameters
- any reference parameters to be added to the instance
public abstract <T extends EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, List<Element> metadata, List<Element> referenceParameters)
T
- clazz
- address
- wsdlAddress
- metadata
- referenceParameters
-
public boolean equalsProxiedInstance(WSEndpoint endpoint)
endpoint
-
@Nullable public abstract OperationDispatcher getOperationDispatcher()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |