com.sun.xml.ws.metro.api.config.management
Class ManagedEndpoint<T>

java.lang.Object
  extended by com.sun.xml.ws.api.server.WSEndpoint<T>
      extended by com.sun.xml.ws.metro.api.config.management.ManagedEndpoint<T>
Type Parameters:
T - The implementation class of the endpoint.
All Implemented Interfaces:
Component, ComponentRegistry

public class ManagedEndpoint<T>
extends WSEndpoint<T>

Wraps an existing WSEndpoint instance and provides a method to swap the WSEndpoint instance. This class also brings up the management communication interfaces when it is instantiated. This class forwards all method invocations to the wrapped WSEndpoint instance.

Author:
Fabian Ritzmann, Martin Grebac

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.xml.ws.api.server.WSEndpoint
WSEndpoint.CompletionCallback, WSEndpoint.PipeHead
 
Constructor Summary
ManagedEndpoint(WSEndpoint<T> endpoint, EndpointCreationAttributes attributes)
          Initializes this endpoint.
 
Method Summary
 void addNotifier(ReconfigNotifier notifier)
           
 void closeManagedObjectManager()
          Close the ManagedObjectManager for this endpoint.
 Codec createCodec()
          Gets the Endpoint's codec that is used to encode/decode Messages.
 WSEndpoint.PipeHead createPipeHead()
          Creates a new WSEndpoint.PipeHead to process incoming requests.
 Packet createServiceResponseForException(ThrowableContainerPropertySet tcps, Packet packet, SOAPVersion soapv, WSDLPort wsdlp, SEIModel seim, WSBinding wsb)
          This is used by WsaServerTube and WSEndpointImpl to create a Packet with SOAPFault message from a Java exception.
 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.
 ServerTubeAssemblerContext getAssemblerContext()
          This is only needed to expose info for monitoring.
 WSBinding getBinding()
          Represents the binding for which this WSEndpoint is created for.
 Set<EndpointComponent> getComponentRegistry()
          Gets the list of EndpointComponent that are associated with this endpoint.
 Set<Component> getComponents()
          Returns the set of Components registered with this object
 Container getContainer()
          Gets the Container object.
 EndpointCreationAttributes getCreationAttributes()
          Returns attributes used for creation of this endpoint.
<T extends EndpointReference>
T
getEndpointReference(Class<T> clazz, String address, String wsdlAddress, Element... referenceParameters)
          Return EndpointReference instance, based on passed parameters and spec version represented by clazz
<T extends EndpointReference>
T
getEndpointReference(Class<T> clazz, String address, String wsdlAddress, List<Element> metadata, List<Element> referenceParameters)
           
 Class<T> getImplementationClass()
          Gets the application endpoint Class that eventually serves the request.
 ManagedObjectManager getManagedObjectManager()
          Get the ManagedObjectManager for this endpoint.
 OperationDispatcher getOperationDispatcher()
          Nullable when there is no associated WSDL Model
 PolicyMap getPolicyMap()
          Gives the PolicMap that captures the Policy for the endpoint
 WSDLPort getPort()
          Gets the port that this endpoint is serving.
 QName getPortName()
          Gets the application endpoint's portName.
 SEIModel getSEIModel()
          Gets the SEIModel that represents the relationship between WSDL and Java SEI.
 ServiceDefinition getServiceDefinition()
          Gets the description of the service.
 QName getServiceName()
          Gets the application endpoint's serviceName.
 void process(Packet request, WSEndpoint.CompletionCallback callback, FiberContextSwitchInterceptor interceptor)
           
 void schedule(Packet request, WSEndpoint.CompletionCallback callback, FiberContextSwitchInterceptor interceptor)
          Schedule invocation of web service asynchronously.
 void setExecutor(Executor exec)
          Set this Executor to run asynchronous requests using this executor.
 void swapEndpointDelegate(WSEndpoint<T> endpoint)
          Sets a new WSEndpoint instance to which method calls will be forwarded from then on.
 
Methods inherited from class com.sun.xml.ws.api.server.WSEndpoint
create, create, create, create, getBoundEndpoints, getDefaultPortName, getDefaultPortName, getDefaultPortName, getDefaultPortName, getDefaultServiceName, getDefaultServiceName, getDefaultServiceName, getDefaultServiceName, getEngine, getSPI, schedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedEndpoint

public ManagedEndpoint(WSEndpoint<T> endpoint,
                       EndpointCreationAttributes attributes)
Initializes this endpoint.

Parameters:
id - A unique ID of the managed endpoint.
endpoint - The wrapped WSEndpoint instance.
attributes - Several attributes that were used to create the original WSEndpoint instance and that cannot be queried from WSEndpoint itself. This is used by the communication API to recreate WSEndpoint instances with the same parameters.
Method Detail

addNotifier

public void addNotifier(ReconfigNotifier notifier)
Parameters:
notifier - Callback object allows us to send a notification when the endpoint was reconfigured.

getCreationAttributes

public EndpointCreationAttributes getCreationAttributes()
Returns attributes used for creation of this endpoint.

Returns:

swapEndpointDelegate

public void swapEndpointDelegate(WSEndpoint<T> endpoint)
Sets a new WSEndpoint instance to which method calls will be forwarded from then on.

Parameters:
endpoint - The WSEndpoint instance. May not be null.

dispose

public void dispose()
Description copied from class: WSEndpoint
Indicates that the 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.

Specified by:
dispose in class WSEndpoint<T>

createCodec

public Codec createCodec()
Description copied from class: WSEndpoint
Gets the Endpoint's codec that is used to encode/decode Messages. This is a copy of the master codec and it shouldn't be shared across two requests running concurrently(unless it is stateless).

Specified by:
createCodec in class WSEndpoint<T>
Returns:
codec to encode/decode

getServiceName

public QName getServiceName()
Description copied from class: WSEndpoint
Gets the application endpoint's serviceName. It could be got from DD or annotations

Specified by:
getServiceName in class WSEndpoint<T>
Returns:
same as wsdl:service QName if WSDL exists or generated

getPortName

public QName getPortName()
Description copied from class: WSEndpoint
Gets the application endpoint's portName. It could be got from DD or annotations

Specified by:
getPortName in class WSEndpoint<T>
Returns:
same as wsdl:port QName if WSDL exists or generated

getImplementationClass

public Class<T> getImplementationClass()
Description copied from class: WSEndpoint
Gets the application endpoint Class that eventually serves the request.

This is the same value given to the WSEndpoint.create(java.lang.Class, boolean, com.sun.xml.ws.api.server.Invoker, javax.xml.namespace.QName, javax.xml.namespace.QName, com.sun.xml.ws.api.server.Container, com.sun.xml.ws.api.WSBinding, com.sun.xml.ws.api.server.SDDocumentSource, java.util.Collection, org.xml.sax.EntityResolver, boolean) method.

Specified by:
getImplementationClass in class WSEndpoint<T>

getBinding

public WSBinding getBinding()
Description copied from class: WSEndpoint
Represents the binding for which this WSEndpoint is created for.

Specified by:
getBinding in class WSEndpoint<T>
Returns:
always same object.

getContainer

public Container getContainer()
Description copied from class: WSEndpoint
Gets the Container object.

The components inside WSEndpoint uses this reference to communicate with the hosting environment.

Specified by:
getContainer in class WSEndpoint<T>
Returns:
always same object. If no "real" Container instance is given, Container.NONE will be returned.

getPort

public WSDLPort getPort()
Description copied from class: WSEndpoint
Gets the port that this endpoint is serving.

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.

Specified by:
getPort in class WSEndpoint<T>
Returns:
Possibly null, but always the same value.

setExecutor

public void setExecutor(Executor exec)
Description copied from class: WSEndpoint
Set this Executor to run asynchronous requests using this executor. This executor is set on Engine and must be set before calling WSEndpoint.schedule(Packet,CompletionCallback) and WSEndpoint.schedule(Packet,CompletionCallback,FiberContextSwitchInterceptor) methods.

Specified by:
setExecutor in class WSEndpoint<T>
Parameters:
exec - Executor to run async requests

schedule

public void schedule(Packet request,
                     WSEndpoint.CompletionCallback callback,
                     FiberContextSwitchInterceptor interceptor)
Description copied from class: WSEndpoint
Schedule invocation of web service asynchronously.

Specified by:
schedule in class WSEndpoint<T>
Parameters:
request - web service request
callback - callback to get response packet(exception if there is one)
interceptor - caller's interceptor to impose a context of execution
See Also:
WSEndpoint.schedule(Packet, CompletionCallback)

process

public void process(Packet request,
                    WSEndpoint.CompletionCallback callback,
                    FiberContextSwitchInterceptor interceptor)
Overrides:
process in class WSEndpoint<T>

createPipeHead

public WSEndpoint.PipeHead createPipeHead()
Description copied from class: WSEndpoint
Creates a new 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.

Specified by:
createPipeHead in class WSEndpoint<T>
Returns:
A newly created WSEndpoint.PipeHead that's ready to serve.

getServiceDefinition

public ServiceDefinition getServiceDefinition()
Description copied from class: WSEndpoint
Gets the description of the service.

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.

Specified by:
getServiceDefinition in class WSEndpoint<T>
Returns:
Possibly null, always the same value under ordinary circumstances but may change if the endpoint is managed.

getComponentRegistry

public Set<EndpointComponent> getComponentRegistry()
Description copied from class: WSEndpoint
Gets the list of 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.

Specified by:
getComponentRegistry in class WSEndpoint<T>
Returns:
always return the same set.

getComponents

@NotNull
public Set<Component> getComponents()
Description copied from interface: ComponentRegistry
Returns the set of Components registered with this object

Specified by:
getComponents in interface ComponentRegistry
Overrides:
getComponents in class WSEndpoint<T>
Returns:
set of registered components

getSEIModel

public SEIModel getSEIModel()
Description copied from class: WSEndpoint
Gets the 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.

Specified by:
getSEIModel in class WSEndpoint<T>
Returns:
maybe null. See above for more discussion. Always the same value.

getPolicyMap

public PolicyMap getPolicyMap()
Description copied from class: WSEndpoint
Gives the PolicMap that captures the Policy for the endpoint

Specified by:
getPolicyMap in class WSEndpoint<T>
Returns:
PolicyMap

getManagedObjectManager

public ManagedObjectManager getManagedObjectManager()
Description copied from class: WSEndpoint
Get the ManagedObjectManager for this endpoint.

Specified by:
getManagedObjectManager in class WSEndpoint<T>

closeManagedObjectManager

public void closeManagedObjectManager()
Description copied from class: WSEndpoint
Close the ManagedObjectManager for this endpoint. This is used by the Web Service Configuration Management system so that it closes the MOM before it creates a new WSEndpoint. Then it calls dispose on the existing endpoint and then installs the new endpoint. The call to dispose also calls closeManagedObjectManager, but is a noop if that method has already been called.

Specified by:
closeManagedObjectManager in class WSEndpoint<T>

getAssemblerContext

public ServerTubeAssemblerContext getAssemblerContext()
Description copied from class: WSEndpoint
This is only needed to expose info for monitoring.

Specified by:
getAssemblerContext in class WSEndpoint<T>

equalsProxiedInstance

public boolean equalsProxiedInstance(WSEndpoint endpoint)
Description copied from class: WSEndpoint
Used for managed endpoints infrastructure to compare equality of proxies vs proxied endpoints.

Overrides:
equalsProxiedInstance in class WSEndpoint<T>
Returns:
true if the proxied endpoint instance held by this instance equals to 'endpoint', otherwise return false.

getEndpointReference

public <T extends EndpointReference> T getEndpointReference(Class<T> clazz,
                                                            String address,
                                                            String wsdlAddress,
                                                            Element... referenceParameters)
Description copied from class: WSEndpoint
Return EndpointReference instance, based on passed parameters and spec version represented by clazz

Specified by:
getEndpointReference in class WSEndpoint<T>
Parameters:
clazz - represents spec version
address - endpoint address
wsdlAddress - wsdl address
referenceParameters - any reference parameters to be added to the instance
Returns:
EndpointReference instance based on passed parameters and values obtained from current instance

getEndpointReference

public <T extends EndpointReference> T getEndpointReference(Class<T> clazz,
                                                            String address,
                                                            String wsdlAddress,
                                                            List<Element> metadata,
                                                            List<Element> referenceParameters)
Specified by:
getEndpointReference in class WSEndpoint<T>
Returns:
EndpointReference instance based on passed parameters and values obtained from current instance

getOperationDispatcher

public OperationDispatcher getOperationDispatcher()
Description copied from class: WSEndpoint
Nullable when there is no associated WSDL Model

Specified by:
getOperationDispatcher in class WSEndpoint<T>
Returns:

createServiceResponseForException

public Packet createServiceResponseForException(ThrowableContainerPropertySet tcps,
                                                Packet packet,
                                                SOAPVersion soapv,
                                                WSDLPort wsdlp,
                                                SEIModel seim,
                                                WSBinding wsb)
Description copied from class: WSEndpoint
This is used by WsaServerTube and WSEndpointImpl to create a Packet with SOAPFault message from a Java exception.

Specified by:
createServiceResponseForException in class WSEndpoint<T>


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.