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 ofcapabilitiesavailable 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 voidcapabilityReloadRequired(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.voidcapabilityRestartRequired(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> TgetCapabilityRuntimeAPI(String capabilityName, CapabilityScope scope, Class<T> apiType)Gets the runtime API associated with a given capability, if there is one.org.jboss.msc.service.ServiceNamegetCapabilityServiceName(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.booleanhasCapability(String capabilityName, CapabilityScope scope)Gets whether a runtime capability with the given name is registered.voidregisterAdditionalCapabilityRequirement(RuntimeRequirementRegistration requirement)Registers an additional requirement a capability has beyond what it was aware of whencapabilitywas passed toregisterCapability(RuntimeCapabilityRegistration).voidregisterCapability(RuntimeCapabilityRegistration capabilityRegistration)Registers a capability with the system.voidregisterPossibleCapability(Capability capability, PathAddress registrationPoint)Registers a capability with the system.RuntimeCapabilityRegistrationremoveCapability(String capabilityName, CapabilityScope scope, PathAddress registrationPoint)Remove a previously registered capability if all registration points for it have been removed.voidremoveCapabilityRequirement(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. Anyrequirementsassociated with the capability will be recorded as requirements.- Specified by:
registerCapabilityin 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 whencapabilitywas 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:
registerAdditionalCapabilityRequirementin interfaceRuntimeCapabilityRegistry- Parameters:
requirement- the requirement- Throws:
IllegalArgumentException- if no matching capability is currentlyregisteredfor eitherrequiredordependent
-
removeCapabilityRequirement
public void removeCapabilityRequirement(RuntimeRequirementRegistration requirementRegistration)
Remove a previously registered requirement for a capability.- Specified by:
removeCapabilityRequirementin 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:
removeCapabilityin interfaceRuntimeCapabilityRegistry- Parameters:
capabilityName- the name of the capability. Cannot benullscope- the context in which the capability is registered. Cannot benullregistrationPoint- the specific registration point that is being removed- Returns:
- the capability that was removed, or
nullif 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:RuntimeCapabilityRegistryGets the status of any capabilities associated with the given resource address.- Specified by:
getRuntimeStatusin interfaceRuntimeCapabilityRegistry- Parameters:
address- the address. Cannot benullresourceRegistration- the registration for the resource ataddress. Cannot benull- Returns:
- a map of capability ids to their runtime status. Will not return
nullbut 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:RuntimeCapabilityRegistryNotification 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:
capabilityReloadRequiredin interfaceRuntimeCapabilityRegistry- Parameters:
address- the address. Cannot benullresourceRegistration- the registration for the resource ataddress. Cannot benull
-
capabilityRestartRequired
public void capabilityRestartRequired(PathAddress address, ImmutableManagementResourceRegistration resourceRegistration)
Description copied from interface:RuntimeCapabilityRegistryNotification 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:
capabilityRestartRequiredin interfaceRuntimeCapabilityRegistry- Parameters:
address- the address. Cannot benullresourceRegistration- the registration for the resource ataddress. Cannot benull
-
registerPossibleCapability
public void registerPossibleCapability(Capability capability, PathAddress registrationPoint)
Registers a capability with the system. Anyrequirementsassociated with the capability will be recorded as requirements.- Specified by:
registerPossibleCapabilityin 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:
removePossibleCapabilityin interfacePossibleCapabilityRegistry- Parameters:
capability- the capability. Cannot benullregistrationPoint- the specific registration point that is being removed- Returns:
- the capability that was removed, or
nullif 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:ImmutableCapabilityRegistryGets whether a runtime capability with the given name is registered.- Specified by:
hasCapabilityin interfaceImmutableCapabilityRegistry- Parameters:
capabilityName- the name of the capability. Cannot benullscope- the scope in which to check for the capability- Returns:
trueif 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:ImmutableCapabilityRegistryGets the runtime API associated with a given capability, if there is one.- Specified by:
getCapabilityRuntimeAPIin interfaceImmutableCapabilityRegistry- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityName- the name of the capability. Cannot benullscope- the scope in which to resolve the capability. Cannot benullapiType- 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:ImmutableCapabilityRegistryReturns set of runtime capabilities registered in the registry- Specified by:
getCapabilitiesin interfaceImmutableCapabilityRegistry- Returns:
- read only
Setwith all runtime capabilities and where ware they registered
-
getPossibleCapabilities
public Set<CapabilityRegistration<?>> getPossibleCapabilities()
Description copied from interface:ImmutableCapabilityRegistryReturns set of possible capabilities with there registration points registered in the registry- Specified by:
getPossibleCapabilitiesin interfaceImmutableCapabilityRegistry- Returns:
- read only
Setwith 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:ImmutableCapabilityRegistryGets the name of the service provided by the capability, if there is one.- Specified by:
getCapabilityServiceNamein interfaceImmutableCapabilityRegistry- Parameters:
capabilityName- the name of the capability. Cannot benullscope- the scope in which to resolve the capability. Cannot benullserviceType- the type of the value provided by the service. May benullif 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:ImmutableCapabilityRegistryReturns possible provider points for passed capabilityId- Specified by:
getPossibleProviderPointsin interfaceImmutableCapabilityRegistry- Parameters:
capabilityId- id of capability- Returns:
- set of PathAddress-es where capability could be registered, will not return
nullbut can be empty
-
getCapability
public CapabilityRegistration<?> getCapability(CapabilityId capabilityId)
Description copied from interface:ImmutableCapabilityRegistryreturns capability registration for capability id pass as parameter- Specified by:
getCapabilityin 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:ImmutableCapabilityRegistryRetrieve all the capability names that the passed scope can access- Specified by:
getDynamicCapabilityNamesin 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
-
-