Class ManagedEndpoint<T>
- java.lang.Object
-
- com.sun.xml.ws.api.server.WSEndpoint<T>
-
- 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
Constructors Constructor Description ManagedEndpoint(WSEndpoint<T> endpoint, EndpointCreationAttributes attributes)Initializes this endpoint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNotifier(ReconfigNotifier notifier)voidcloseManagedObjectManager()Close the ManagedObjectManager for this endpoint.CodeccreateCodec()Gets the Endpoint's codec that is used to encode/decodeMessages.WSEndpoint.PipeHeadcreatePipeHead()Creates a newWSEndpoint.PipeHeadto process incoming requests.PacketcreateServiceResponseForException(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.voiddispose()Indicates that theWSEndpointis about to be turned off, and will no longer serve any packet anymore.booleanequalsProxiedInstance(WSEndpoint endpoint)Used for managed endpoints infrastructure to compare equality of proxies vs proxied endpoints.ServerTubeAssemblerContextgetAssemblerContext()This is only needed to expose info for monitoring.WSBindinggetBinding()Represents the binding for which thisWSEndpointis created for.Set<EndpointComponent>getComponentRegistry()Gets the list ofEndpointComponentthat are associated with this endpoint.Set<Component>getComponents()Returns the set ofComponents registered with this objectContainergetContainer()Gets theContainerobject.EndpointCreationAttributesgetCreationAttributes()Returns attributes used for creation of this endpoint.<T extends javax.xml.ws.EndpointReference>
TgetEndpointReference(Class<T> clazz, String address, String wsdlAddress, List<Element> metadata, List<Element> referenceParameters)<T extends javax.xml.ws.EndpointReference>
TgetEndpointReference(Class<T> clazz, String address, String wsdlAddress, Element... referenceParameters)Return EndpointReference instance, based on passed parameters and spec version represented by clazzClass<T>getImplementationClass()Gets the application endpointClassthat eventually serves the request.org.glassfish.gmbal.ManagedObjectManagergetManagedObjectManager()Get the ManagedObjectManager for this endpoint.OperationDispatchergetOperationDispatcher()Nullable when there is no associated WSDL ModelPolicyMapgetPolicyMap()Gives the PolicMap that captures the Policy for the endpointWSDLPortgetPort()Gets the port that this endpoint is serving.QNamegetPortName()Gets the application endpoint's portName.SEIModelgetSEIModel()Gets theSEIModelthat represents the relationship between WSDL and Java SEI.ServiceDefinitiongetServiceDefinition()Gets the description of the service.QNamegetServiceName()Gets the application endpoint's serviceName.voidprocess(Packet request, WSEndpoint.CompletionCallback callback, FiberContextSwitchInterceptor interceptor)voidschedule(Packet request, WSEndpoint.CompletionCallback callback, FiberContextSwitchInterceptor interceptor)Schedule invocation of web service asynchronously.voidsetExecutor(Executor exec)Set thisExecutorto run asynchronous requests using this executor.voidswapEndpointDelegate(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
-
-
-
-
Constructor Detail
-
ManagedEndpoint
public ManagedEndpoint(WSEndpoint<T> endpoint, EndpointCreationAttributes attributes)
Initializes this endpoint.- Parameters:
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:WSEndpointIndicates that theWSEndpointis 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
WSEndpointto 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 futureWSEndpoint.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:
disposein classWSEndpoint<T>
-
createCodec
public Codec createCodec()
Description copied from class:WSEndpointGets the Endpoint's codec that is used to encode/decodeMessages. 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:
createCodecin classWSEndpoint<T>- Returns:
- codec to encode/decode
-
getServiceName
public QName getServiceName()
Description copied from class:WSEndpointGets the application endpoint's serviceName. It could be got from DD or annotations- Specified by:
getServiceNamein classWSEndpoint<T>- Returns:
- same as wsdl:service QName if WSDL exists or generated
-
getPortName
public QName getPortName()
Description copied from class:WSEndpointGets the application endpoint's portName. It could be got from DD or annotations- Specified by:
getPortNamein classWSEndpoint<T>- Returns:
- same as wsdl:port QName if WSDL exists or generated
-
getImplementationClass
public Class<T> getImplementationClass()
Description copied from class:WSEndpointGets the application endpointClassthat eventually serves the request.This is the same value given to the
WSEndpoint.create(java.lang.Class<T>, 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<? extends com.sun.xml.ws.api.server.SDDocumentSource>, org.xml.sax.EntityResolver, boolean)method.- Specified by:
getImplementationClassin classWSEndpoint<T>
-
getBinding
public WSBinding getBinding()
Description copied from class:WSEndpointRepresents the binding for which thisWSEndpointis created for.- Specified by:
getBindingin classWSEndpoint<T>- Returns:
- always same object.
-
getContainer
public Container getContainer()
Description copied from class:WSEndpointGets theContainerobject.The components inside
WSEndpointuses this reference to communicate with the hosting environment.- Specified by:
getContainerin classWSEndpoint<T>- Returns:
- always same object. If no "real"
Containerinstance is given,Container.NONEwill be returned.
-
getPort
public WSDLPort getPort()
Description copied from class:WSEndpointGets 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
WSEndpointis serving.- Specified by:
getPortin classWSEndpoint<T>- Returns:
- Possibly null, but always the same value.
-
setExecutor
public void setExecutor(Executor exec)
Description copied from class:WSEndpointSet thisExecutorto run asynchronous requests using this executor. This executor is set onEngineand must be set before callingWSEndpoint.schedule(Packet,CompletionCallback)andWSEndpoint.schedule(Packet,CompletionCallback,FiberContextSwitchInterceptor)methods.- Specified by:
setExecutorin classWSEndpoint<T>- Parameters:
exec- Executor to run async requests
-
schedule
public void schedule(Packet request, WSEndpoint.CompletionCallback callback, FiberContextSwitchInterceptor interceptor)
Description copied from class:WSEndpointSchedule invocation of web service asynchronously.- Specified by:
schedulein classWSEndpoint<T>- Parameters:
request- web service requestcallback- 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:
processin classWSEndpoint<T>
-
createPipeHead
public WSEndpoint.PipeHead createPipeHead()
Description copied from class:WSEndpointCreates a newWSEndpoint.PipeHeadto process incoming requests.This is not a cheap operation. The caller is expected to reuse the returned
WSEndpoint.PipeHead. Seeclass javadocfor details.- Specified by:
createPipeHeadin classWSEndpoint<T>- Returns:
- A newly created
WSEndpoint.PipeHeadthat's ready to serve.
-
getServiceDefinition
public ServiceDefinition getServiceDefinition()
Description copied from class:WSEndpointGets 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:
getServiceDefinitionin classWSEndpoint<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:WSEndpointGets the list ofEndpointComponentthat 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:
getComponentRegistryin classWSEndpoint<T>- Returns:
- always return the same set.
-
getComponents
@NotNull public Set<Component> getComponents()
Description copied from interface:ComponentRegistryReturns the set ofComponents registered with this object- Specified by:
getComponentsin interfaceComponentRegistry- Overrides:
getComponentsin classWSEndpoint<T>- Returns:
- set of registered components
-
getSEIModel
public SEIModel getSEIModel()
Description copied from class:WSEndpointGets theSEIModelthat 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:
getSEIModelin classWSEndpoint<T>- Returns:
- maybe null. See above for more discussion. Always the same value.
-
getPolicyMap
public PolicyMap getPolicyMap()
Description copied from class:WSEndpointGives the PolicMap that captures the Policy for the endpoint- Specified by:
getPolicyMapin classWSEndpoint<T>- Returns:
- PolicyMap
-
getManagedObjectManager
public org.glassfish.gmbal.ManagedObjectManager getManagedObjectManager()
Description copied from class:WSEndpointGet the ManagedObjectManager for this endpoint.- Specified by:
getManagedObjectManagerin classWSEndpoint<T>
-
closeManagedObjectManager
public void closeManagedObjectManager()
Description copied from class:WSEndpointClose 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:
closeManagedObjectManagerin classWSEndpoint<T>
-
getAssemblerContext
public ServerTubeAssemblerContext getAssemblerContext()
Description copied from class:WSEndpointThis is only needed to expose info for monitoring.- Specified by:
getAssemblerContextin classWSEndpoint<T>
-
equalsProxiedInstance
public boolean equalsProxiedInstance(WSEndpoint endpoint)
Description copied from class:WSEndpointUsed for managed endpoints infrastructure to compare equality of proxies vs proxied endpoints.- Overrides:
equalsProxiedInstancein classWSEndpoint<T>- Returns:
- true if the proxied endpoint instance held by this instance equals to 'endpoint', otherwise return false.
-
getEndpointReference
public <T extends javax.xml.ws.EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, Element... referenceParameters)
Description copied from class:WSEndpointReturn EndpointReference instance, based on passed parameters and spec version represented by clazz- Specified by:
getEndpointReferencein classWSEndpoint<T>- Parameters:
clazz- represents spec versionaddress- endpoint addresswsdlAddress- wsdl addressreferenceParameters- 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 javax.xml.ws.EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, List<Element> metadata, List<Element> referenceParameters)
- Specified by:
getEndpointReferencein classWSEndpoint<T>- Returns:
- EndpointReference instance based on passed parameters and values obtained from current instance
-
getOperationDispatcher
public OperationDispatcher getOperationDispatcher()
Description copied from class:WSEndpointNullable when there is no associated WSDL Model- Specified by:
getOperationDispatcherin classWSEndpoint<T>- Returns:
-
createServiceResponseForException
public Packet createServiceResponseForException(ThrowableContainerPropertySet tcps, Packet packet, SOAPVersion soapv, WSDLPort wsdlp, SEIModel seim, WSBinding wsb)
Description copied from class:WSEndpointThis is used by WsaServerTube and WSEndpointImpl to create a Packet with SOAPFault message from a Java exception.- Specified by:
createServiceResponseForExceptionin classWSEndpoint<T>
-
-