Package org.jboss.as.controller
Class CapabilityRegistry
- java.lang.Object
-
- org.jboss.as.controller.CapabilityRegistry
-
- All Implemented Interfaces:
ImmutableCapabilityRegistry
,PossibleCapabilityRegistry
,RuntimeCapabilityRegistry
public final class CapabilityRegistry extends Object implements ImmutableCapabilityRegistry, PossibleCapabilityRegistry, RuntimeCapabilityRegistry
Registry ofcapabilities
available in the system.- Author:
- Brian Stansberry (c) 2014 Red Hat Inc., Tomaz Cerar (c) 2015 Red Hat Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry
RuntimeCapabilityRegistry.RuntimeStatus
-
-
Constructor Summary
Constructors Constructor Description CapabilityRegistry(boolean forServer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
capabilityReloadRequired(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Notification that any capabilities associated with the given address require reload in order to bring their runtime services into sync with their persistent configuration.void
capabilityRestartRequired(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Notification that any capabilities associated with the given address require restart in order to bring their runtime services into sync with their persistent configuration.Set<CapabilityRegistration<?>>
getCapabilities()
Returns set of runtime capabilities registered in the registryCapabilityRegistration<?>
getCapability(CapabilityId capabilityId)
returns capability registration for capability id pass as parameter<T> T
getCapabilityRuntimeAPI(String capabilityName, CapabilityScope scope, Class<T> apiType)
Gets the runtime API associated with a given capability, if there is one.org.jboss.msc.service.ServiceName
getCapabilityServiceName(String capabilityName, CapabilityScope scope, Class<?> serviceType)
Gets the name of the service provided by the capability, if there is one.Set<String>
getDynamicCapabilityNames(String referencedCapability, CapabilityScope dependentScope)
Retrieve all the capability names that the passed scope can accessSet<CapabilityRegistration<?>>
getPossibleCapabilities()
Returns set of possible capabilities with there registration points registered in the registrySet<PathAddress>
getPossibleProviderPoints(CapabilityId capabilityId)
Returns possible provider points for passed capabilityIdMap<CapabilityId,RuntimeCapabilityRegistry.RuntimeStatus>
getRuntimeStatus(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Gets the status of any capabilities associated with the given resource address.boolean
hasCapability(String capabilityName, CapabilityScope scope)
Gets whether a runtime capability with the given name is registered.void
registerAdditionalCapabilityRequirement(RuntimeRequirementRegistration requirement)
Registers an additional requirement a capability has beyond what it was aware of whencapability
was passed toregisterCapability(RuntimeCapabilityRegistration)
.void
registerCapability(RuntimeCapabilityRegistration capabilityRegistration)
Registers a capability with the system.void
registerPossibleCapability(Capability capability, PathAddress registrationPoint)
Registers a capability with the system.RuntimeCapabilityRegistration
removeCapability(String capabilityName, CapabilityScope scope, PathAddress registrationPoint)
Remove a previously registered capability if all registration points for it have been removed.void
removeCapabilityRequirement(RuntimeRequirementRegistration requirementRegistration)
Remove a previously registered requirement for a capability.CapabilityRegistration<?>
removePossibleCapability(Capability capability, PathAddress registrationPoint)
Remove a previously registered capability if all registration points for it have been removed.
-
-
-
Method Detail
-
registerCapability
public void registerCapability(RuntimeCapabilityRegistration capabilityRegistration)
Registers a capability with the system. Anyrequirements
associated with the capability will be recorded as requirements.- Specified by:
registerCapability
in interfaceRuntimeCapabilityRegistry
- Parameters:
capabilityRegistration
- the capability. Cannot benull
-
registerAdditionalCapabilityRequirement
public void registerAdditionalCapabilityRequirement(RuntimeRequirementRegistration requirement)
Registers an additional requirement a capability has beyond what it was aware of whencapability
was passed toregisterCapability(RuntimeCapabilityRegistration)
. Used for cases where a capability optionally depends on another capability, and whether or not that requirement is needed is not known when the capability is first registered.- Specified by:
registerAdditionalCapabilityRequirement
in interfaceRuntimeCapabilityRegistry
- Parameters:
requirement
- the requirement- Throws:
IllegalArgumentException
- if no matching capability is currentlyregistered
for eitherrequired
ordependent
-
removeCapabilityRequirement
public void removeCapabilityRequirement(RuntimeRequirementRegistration requirementRegistration)
Remove a previously registered requirement for a capability.- Specified by:
removeCapabilityRequirement
in interfaceRuntimeCapabilityRegistry
- Parameters:
requirementRegistration
- the requirement. Cannot benull
- See Also:
registerAdditionalCapabilityRequirement(org.jboss.as.controller.capability.registry.RuntimeRequirementRegistration)
-
removeCapability
public RuntimeCapabilityRegistration removeCapability(String capabilityName, CapabilityScope scope, PathAddress registrationPoint)
Remove a previously registered capability if all registration points for it have been removed.- Specified by:
removeCapability
in interfaceRuntimeCapabilityRegistry
- Parameters:
capabilityName
- the name of the capability. Cannot benull
scope
- the context in which the capability is registered. Cannot benull
registrationPoint
- the specific registration point that is being removed- Returns:
- the capability that was removed, or
null
if no matching capability was registered or other registration points for the capability still exist
-
getRuntimeStatus
public Map<CapabilityId,RuntimeCapabilityRegistry.RuntimeStatus> getRuntimeStatus(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Description copied from interface:RuntimeCapabilityRegistry
Gets the status of any capabilities associated with the given resource address.- Specified by:
getRuntimeStatus
in interfaceRuntimeCapabilityRegistry
- Parameters:
address
- the address. Cannot benull
resourceRegistration
- the registration for the resource ataddress
. Cannot benull
- Returns:
- a map of capability ids to their runtime status. Will not return
null
but may return an empty map if no capabilities are associated with the address.
-
capabilityReloadRequired
public void capabilityReloadRequired(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Description copied from interface:RuntimeCapabilityRegistry
Notification that any capabilities associated with the given address require reload in order to bring their runtime services into sync with their persistent configuration.- Specified by:
capabilityReloadRequired
in interfaceRuntimeCapabilityRegistry
- Parameters:
address
- the address. Cannot benull
resourceRegistration
- the registration for the resource ataddress
. Cannot benull
-
capabilityRestartRequired
public void capabilityRestartRequired(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Description copied from interface:RuntimeCapabilityRegistry
Notification that any capabilities associated with the given address require restart in order to bring their runtime services into sync with their persistent configuration.- Specified by:
capabilityRestartRequired
in interfaceRuntimeCapabilityRegistry
- Parameters:
address
- the address. Cannot benull
resourceRegistration
- the registration for the resource ataddress
. Cannot benull
-
registerPossibleCapability
public void registerPossibleCapability(Capability capability, PathAddress registrationPoint)
Registers a capability with the system. Anyrequirements
associated with the capability will be recorded as requirements.- Specified by:
registerPossibleCapability
in interfacePossibleCapabilityRegistry
- Parameters:
capability
- the capability. Cannot benull
-
removePossibleCapability
public CapabilityRegistration<?> removePossibleCapability(Capability capability, PathAddress registrationPoint)
Remove a previously registered capability if all registration points for it have been removed.- Specified by:
removePossibleCapability
in interfacePossibleCapabilityRegistry
- Parameters:
capability
- the capability. Cannot benull
registrationPoint
- the specific registration point that is being removed- Returns:
- the capability that was removed, or
null
if no matching capability was registered or other registration points for the capability still exist
-
hasCapability
public boolean hasCapability(String capabilityName, CapabilityScope scope)
Description copied from interface:ImmutableCapabilityRegistry
Gets whether a runtime capability with the given name is registered.- Specified by:
hasCapability
in interfaceImmutableCapabilityRegistry
- Parameters:
capabilityName
- the name of the capability. Cannot benull
scope
- the scope in which to check for the capability- Returns:
true
if there is a capability with the given name registered
-
getCapabilityRuntimeAPI
public <T> T getCapabilityRuntimeAPI(String capabilityName, CapabilityScope scope, Class<T> apiType)
Description copied from interface:ImmutableCapabilityRegistry
Gets the runtime API associated with a given capability, if there is one.- Specified by:
getCapabilityRuntimeAPI
in interfaceImmutableCapabilityRegistry
- Type Parameters:
T
- the java type that exposes the API- Parameters:
capabilityName
- the name of the capability. Cannot benull
scope
- the scope in which to resolve the capability. Cannot benull
apiType
- class of the java type that exposes the API. Cannot benull
- Returns:
- the runtime API. Will not return
null
-
getCapabilities
public Set<CapabilityRegistration<?>> getCapabilities()
Description copied from interface:ImmutableCapabilityRegistry
Returns set of runtime capabilities registered in the registry- Specified by:
getCapabilities
in interfaceImmutableCapabilityRegistry
- Returns:
- read only
Set
with all runtime capabilities and where ware they registered
-
getPossibleCapabilities
public Set<CapabilityRegistration<?>> getPossibleCapabilities()
Description copied from interface:ImmutableCapabilityRegistry
Returns set of possible capabilities with there registration points registered in the registry- Specified by:
getPossibleCapabilities
in interfaceImmutableCapabilityRegistry
- Returns:
- read only
Set
with all possible capabilities and where ware they registered
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(String capabilityName, CapabilityScope scope, Class<?> serviceType)
Description copied from interface:ImmutableCapabilityRegistry
Gets the name of the service provided by the capability, if there is one.- Specified by:
getCapabilityServiceName
in interfaceImmutableCapabilityRegistry
- Parameters:
capabilityName
- the name of the capability. Cannot benull
scope
- the scope in which to resolve the capability. Cannot benull
serviceType
- the type of the value provided by the service. May benull
if the caller is unconcerned about checking that its understanding of the service type provided by the capability is correct- Returns:
- the service name. Will not return
null
-
getPossibleProviderPoints
public Set<PathAddress> getPossibleProviderPoints(CapabilityId capabilityId)
Description copied from interface:ImmutableCapabilityRegistry
Returns possible provider points for passed capabilityId- Specified by:
getPossibleProviderPoints
in interfaceImmutableCapabilityRegistry
- Parameters:
capabilityId
- id of capability- Returns:
- set of PathAddress-es where capability could be registered, will not return
null
but can be empty
-
getCapability
public CapabilityRegistration<?> getCapability(CapabilityId capabilityId)
Description copied from interface:ImmutableCapabilityRegistry
returns capability registration for capability id pass as parameter- Specified by:
getCapability
in interfaceImmutableCapabilityRegistry
- Parameters:
capabilityId
- id of capability with its scope.- Returns:
- CapabilityRegistration or null if none is found
-
getDynamicCapabilityNames
public Set<String> getDynamicCapabilityNames(String referencedCapability, CapabilityScope dependentScope)
Description copied from interface:ImmutableCapabilityRegistry
Retrieve all the capability names that the passed scope can access- Specified by:
getDynamicCapabilityNames
in interfaceImmutableCapabilityRegistry
- Parameters:
referencedCapability
- The static name of the capabilitydependentScope
- The scope from which the capability is referenced- Returns:
- A set of capabilities name. Only the dynamic part of the name is returned
-
-