Package com.sun.xml.ws.api.server
Enum LazyMOMProvider
- java.lang.Object
-
- java.lang.Enum<LazyMOMProvider>
-
- com.sun.xml.ws.api.server.LazyMOMProvider
-
- All Implemented Interfaces:
Serializable,Comparable<LazyMOMProvider>
public enum LazyMOMProvider extends Enum<LazyMOMProvider>
The lazy provider is intended to defer Gmbal API calls until there is a JMX connection. The provider is scope (environment) aware and behaves accordingly to actual scope. The default behaviour does not defers Gmbal API calls. There are two kind of method allowing registration of an object as a listener. One is forWSEndpointImplinstances (implementingWSEndpointScopeChangeListener) and the other is for arbitrary objects (implementingDefaultScopeChangeListener) that want to be notified about scope changes. The distinction is made because of the fact that endpoints should be registered first and other objects (e.g. dependants on endpoints) must be registered after all the endpoints are processed so no inconsistency is present. Glassfish:WebServicesContaineris one of two classes for which aManagedObjectManagerinstance (see Gmbal API) is created when a webservice application is deployed into the Glassfish. For the purpose of postponing Gmbal API calls theWebServicesContainerextendsMBeanListener.CallbackImplso it can register itself as a listener ofAMXGlassfishand receive a notification about a connection of a JMX client to the Glassfish server (seeWebServicesContainer#postConstructfor registration details). The moment the JMX client is connected a notification is sent to the listeners ofAMXGlassfish. When this event is received byWebServiceContainer(see the callback methodmbeanRegistered) aManagedObjectManagerinstance is created and no further deferring of Gmbal API calls is needed. Metro/JAX-WS: The situation in Metro/JAX-WS is slightly different from the one described above. Metro/JAX-WS can be used as standalone libraries (outside of Glassfish) so no notification from the Glassfish server can be expected in this case. This leads to a situation when Metro/JAX-WS has to be aware of context in which it is used and acts appropriately. There are 3 scopes an application using Metro/JAX-WS can be in:STANDALONE,GLASSFISH_NO_JMX,GLASSFISH_JMX(scope). The default scope isSTANDALONEand all Gmbal API calls are invoked as they are requested. The other two scopes are applied only when an application is deployed into a Glassfish server. TheGLASSFISH_NO_JMXis set at the moment the application is deployed (see below) and its purpose is to defer Gmbal API calls for as long as possible. For some classes e.g.ManagedObjectManagerproxy classes were introduced to avoid the necessity of creating the real Gmbal objects but if a method is invoked on these proxies the creation of real Gmbal objects is forced even in this scope. TheGLASSFISH_JMXscope is set when a JMX client is connected to the Glassfish server and it processes Gmbal API calls without deferring (as if the application was in theSTANDALONEscope). The entry point for postponing the Gmbal API calls / creating Gmbal objects in Metro/JAX-WS isLazyMOMProvider. This class is capable of receiving notifications from the Glassfish server (LazyMOMProvider.initMOMForScope) about the scope change and it also spread this information to its listeners. The listeners ofLazyMOMProviderare of two kinds:LazyMOMProvider.WSEndpointScopeChangeListenerandLazyMOMProvider.DefaultScopeChangeListener. Extensions ofWSEndpoint(e.g.WSEndpointImpl) should implement theLazyMOMProvider.WSEndpointScopeChangeListenerand register themselves as endpoint listeners ofLazyMOMProvider. Other classes should implement the latter mentioned interface and register themselves as a non-endpoint listener. The differences between these two kind of listeners are described inLazyMOMProviderclass comment. An implementation ofLazyMOMProvider.DefaultScopeChangeListeneris provided in Metro (WSEndpointCollectionBasedMOMListener). As mentioned above this listener register itself as a non-endpoint listener ofLazyMOMProvider(WSEndpointCollectionBasedMOMListener.init). An instance of this class is used in these factories:SessionManager,NonceManagerandSequenceManagerFactory.SessionManager,NonceManager,PersistentSequenceManagerandInVmSequenceManageralso (indirectly) implementMOMRegistrationAwarefor providing information whether a manager is registered atManagedObjectManageror not. Registration of a manager atManagedObjectManagercan be processed directly (ifWSEndpointCollectionBasedMOMListener.canRegisterAtMOMreturnstrue) viaWSEndpointCollectionBasedMOMListener.registerAtMOMor is deferred by putting the manager intoWSEndpointCollectionBasedMOMListener.registrationAwareMap. Managers stored in for deferred registration are processed at the moment theLazyMOMProvidernotifies theWSEndpointCollectionBasedMOMListenerabout the scope change. The mentioned postponing of Gmbal API calls applies only to the server side of the webservice application.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLazyMOMProvider.DefaultScopeChangeListenerDefault interface for all object that want to be notified about scope change.static classLazyMOMProvider.ScopePossible scopes (environments) in which the provider (and object associated with it) could be in.static interfaceLazyMOMProvider.ScopeChangeListenerInterface for all object that want to be notified about scope change, introducing required methods.static interfaceLazyMOMProvider.WSEndpointScopeChangeListenerInterface used for distinguishing between a registration of a WSEndpointImpl rather than of other classes.
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LazyMOMProvider.ScopegetScope()voidinitMOMForScope(LazyMOMProvider.Scope scope)Initializes this provider with a given scope.voidregisterEndpoint(LazyMOMProvider.WSEndpointScopeChangeListener wsEndpoint)Registers a Webservice Endpoint as a listener.voidregisterListener(LazyMOMProvider.DefaultScopeChangeListener listener)Registers the given object as a listener.voidunregisterEndpoint(LazyMOMProvider.WSEndpointScopeChangeListener wsEndpoint)Unregisters a Webservice Endpoint from the list of listeners.static LazyMOMProvidervalueOf(String name)Returns the enum constant of this type with the specified name.static LazyMOMProvider[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final LazyMOMProvider INSTANCE
-
-
Method Detail
-
values
public static LazyMOMProvider[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LazyMOMProvider c : LazyMOMProvider.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LazyMOMProvider valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
initMOMForScope
public void initMOMForScope(LazyMOMProvider.Scope scope)
Initializes this provider with a given scope. If the given scope is different than the one this provider is currently in and the transition between scopes is valid then a event is fired to all registered listeners.- Parameters:
scope- a scope to initialize this provider with
-
registerListener
public void registerListener(LazyMOMProvider.DefaultScopeChangeListener listener)
Registers the given object as a listener.- Parameters:
listener- a listener to be registered
-
getScope
public LazyMOMProvider.Scope getScope()
-
registerEndpoint
public void registerEndpoint(LazyMOMProvider.WSEndpointScopeChangeListener wsEndpoint)
Registers a Webservice Endpoint as a listener. Webservice Endpoints should rather register through this method than through LazyMOMProvider#registerListener because generally they need to be notified sooner than arbitrary listener (i.e. object that is dependant on Webservice Endpoint)- Parameters:
wsEndpoint- a Webservice Endpoint to be registered
-
unregisterEndpoint
public void unregisterEndpoint(LazyMOMProvider.WSEndpointScopeChangeListener wsEndpoint)
Unregisters a Webservice Endpoint from the list of listeners.- Parameters:
wsEndpoint- a Webservice Endpoint to be unregistered
-
-