Package org.glassfish.hk2.extras
Class ExtrasUtilities
java.lang.Object
org.glassfish.hk2.extras.ExtrasUtilities
These are utilities for the extra features of hk2.
Generally they allow for
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
static final String
This will be put into the metadata of a descriptor that is bridged from another service locator.static final String
This will be put into the metadata of a descriptor that is bridged from another service locator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
bridgeServiceLocator
(ServiceLocator into, ServiceLocator from) This method will bridge all non-local services from the from ServiceLocator into the into ServiceLocator.private static void
static void
This method adds in a default implementation of theInterceptionService
which uses annotations to denote which services should intercept other services.static void
enableOperations
(ServiceLocator locator) This method adds in the infrastructure necessary to enable HK2 Operations support.static void
enableTopicDistribution
(ServiceLocator locator) This method will enable the default topic distribution service.private static String
getBridgeName
(ServiceLocator into, ServiceLocator from) private static boolean
static void
unbridgeServiceLocator
(ServiceLocator into, ServiceLocator from) This method will remove all non-local services from the from ServiceLocator into the into ServiceLocator.
-
Field Details
-
HK2BRIDGE_LOCATOR_ID
This will be put into the metadata of a descriptor that is bridged from another service locator. The value will be the locator id of the service locator from which the service originates- See Also:
-
HK2BRIDGE_SERVICE_ID
This will be put into the metadata of a descriptor that is bridged from another service locator. The value will be the service id of the descriptor from which the service originates- See Also:
-
BRIDGE_NAME_PREFIX
- See Also:
-
COMMA
- See Also:
-
BRIDGE_NAME_POSTFIX
- See Also:
-
-
Constructor Details
-
ExtrasUtilities
public ExtrasUtilities()
-
-
Method Details
-
enableDefaultInterceptorServiceImplementation
This method adds in a default implementation of theInterceptionService
which uses annotations to denote which services should intercept other services. For more information see the org.glassfish.hk2.extras.interception package. This method is idempotent, if the service is already available it will not add it- Parameters:
locator
- The locator to add the default interception service implementation to. May not be null
-
enableOperations
This method adds in the infrastructure necessary to enable HK2 Operations support. For more information seeOperationManager
. This method is idempotent, if the service is already available it will not add it- Parameters:
locator
- The locator to add the infrastructure needed to use the HK2 Operations support
-
getBridgeName
-
checkParentage
-
bridgeServiceLocator
This method will bridge all non-local services from the from ServiceLocator into the into ServiceLocator. Changes to the set of services in the from ServiceLocator will be reflected in the into ServiceLocator. The two ServiceLocators involved must not have a parent/child relationship- Parameters:
into
- The non-null ServiceLocator that will have services added to it from the from ServiceLocatorfrom
- The non-null ServiceLocator that will add services to the into ServiceLocator
-
unbridgeServiceLocator
This method will remove all non-local services from the from ServiceLocator into the into ServiceLocator. The service locator will no longer be related by this bridge The two ServiceLocators involved must not have a parent/child relationship- Parameters:
into
- The non-null ServiceLocator that will have services added to it from the from ServiceLocatorfrom
- The non-null ServiceLocator that will add services to the into ServiceLocator
-
enableTopicDistribution
This method will enable the default topic distribution service.The default distribution service distributes messages on the same thread as the caller of
Topic.publish(Object)
. Objects to be distributed to will be held with SoftReferences, and hence if they go out of scope they will not be distributed to. Only services created AFTER the topic distribution service is enabled will be distributed to.This method is idempotent, so that if there is already a TopicDistributionService with the default name is available this method will do nothing
- Parameters:
locator
- The service locator to enable topic distribution on. May not be null
-
isDupException
-