Class RuntimeCapability<T>
- java.lang.Object
-
- org.jboss.as.controller.capability.AbstractCapability
-
- org.jboss.as.controller.capability.RuntimeCapability<T>
-
- Type Parameters:
T
- the type of the runtime API object exposed by the capability
- All Implemented Interfaces:
Capability
public class RuntimeCapability<T> extends AbstractCapability
A capability exposed in a running WildFly process.- Author:
- Brian Stansberry (c) 2014 Red Hat Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RuntimeCapability.Builder<T>
Builder for aRuntimeCapability
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
buildDynamicCapabilityName(String baseName, String dynamicNameElement)
static String
buildDynamicCapabilityName(String baseName, String... dynamicNameElement)
Constructs a full capability name from a static base name and a dynamic element.boolean
equals(Object o)
RuntimeCapability<T>
fromBaseCapability(String dynamicElement)
RuntimeCapability<T>
fromBaseCapability(String... dynamicElement)
Creates a fully named capability from adynamically named
base capability.RuntimeCapability<T>
fromBaseCapability(PathAddress path)
Creates a fully named capability from adynamically named
base capability.Set<String>
getAdditionalRequiredPackages()
Gets the names of any "additional" Galleon packages that must be installed in order for this capability to function.org.jboss.msc.service.ServiceName
getCapabilityServiceName()
Gets the name of the service provided by this capability, if there is one.org.jboss.msc.service.ServiceName
getCapabilityServiceName(Class<?> serviceValueType)
Gets the name of service provided by this capability.org.jboss.msc.service.ServiceName
getCapabilityServiceName(Class<?> serviceValueType, String... dynamicNameElements)
org.jboss.msc.service.ServiceName
getCapabilityServiceName(String... dynamicNameElements)
Gets the name of the service provided by this capability, if there is one.org.jboss.msc.service.ServiceName
getCapabilityServiceName(String dynamicNameElement, Class<?> serviceValueType)
Gets the name of service provided by this capability.org.jboss.msc.service.ServiceName
getCapabilityServiceName(PathAddress address)
Gets the name of the service provided by this capability, if there is one.org.jboss.msc.service.ServiceName
getCapabilityServiceName(PathAddress address, Class<?> serviceValueType)
Gets the name of service provided by this capability.Class<?>
getCapabilityServiceValueType()
Gets the valid type to pass togetCapabilityServiceName(Class)
.String
getDynamicName(String dynamicNameElement)
Gets the full name of a capability, including a dynamic elementString
getDynamicName(PathAddress address)
String
getName()
Gets the basic name of the capability.Set<String>
getRequirements()
Gets the names of other capabilities required by this capability.T
getRuntimeAPI()
Object encapsulating the API exposed by this capability to other capabilities that require it, if it does expose such an API.int
hashCode()
boolean
isAllowMultipleRegistrations()
Gets whether this capability can be registered at more than one point within the same overall scope.boolean
isDynamicallyNamed()
Gets whether this capability is a dynamically named one, whose runtime variants will have a dynamic element added to the base name provided byCapability.getName()
.String
toString()
-
Methods inherited from class org.jboss.as.controller.capability.AbstractCapability
getDynamicOptionalRequirements, getDynamicRequirements, getOptionalRequirements, getRuntimeOnlyRequirements
-
-
-
-
Method Detail
-
buildDynamicCapabilityName
public static String buildDynamicCapabilityName(String baseName, String dynamicNameElement)
-
fromBaseCapability
public RuntimeCapability<T> fromBaseCapability(String dynamicElement)
-
buildDynamicCapabilityName
public static String buildDynamicCapabilityName(String baseName, String... dynamicNameElement)
Constructs a full capability name from a static base name and a dynamic element.- Parameters:
baseName
- the base name. Cannot benull
dynamicNameElement
- the dynamic portion of the name. Cannot benull
- Returns:
- the full capability name. Will not return
null
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName()
Gets the name of the service provided by this capability, if there is one.- Returns:
- the name of the service. Will not be
null
- Throws:
IllegalArgumentException
- if the capability does not provide a service
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(Class<?> serviceValueType)
Gets the name of service provided by this capability.- Parameters:
serviceValueType
- the expected type of the service's value. Only used to provide validate that the service value type provided by the capability matches the caller's expectation. May benull
in which case no validation is performed- Returns:
- the name of the service. Will not be
null
- Throws:
IllegalArgumentException
- if the capability does not provide a service or if its value type is not assignable toserviceValueType
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(String... dynamicNameElements)
Gets the name of the service provided by this capability, if there is one. Only usable withdynamically named
capabilities.- Parameters:
dynamicNameElements
- the dynamic portion of the capability name. Cannot benull
- Returns:
- the name of the service. Will not be
null
- Throws:
IllegalArgumentException
- if the capability does not provide a serviceAssertionError
- ifisDynamicallyNamed()
does not returntrue
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(PathAddress address)
Gets the name of the service provided by this capability, if there is one. Only usable withdynamically named
capabilities.- Parameters:
address
- Path address for which service name is calculated from Cannot benull
- Returns:
- the name of the service. Will not be
null
- Throws:
IllegalArgumentException
- if the capability does not provide a serviceAssertionError
- ifisDynamicallyNamed()
does not returntrue
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(String dynamicNameElement, Class<?> serviceValueType)
Gets the name of service provided by this capability.- Parameters:
dynamicNameElement
- the dynamic portion of the capability name. Cannot benull
serviceValueType
- the expected type of the service's value. Only used to provide validate that the service value type provided by the capability matches the caller's expectation. May benull
in which case no validation is performed- Returns:
- the name of the service. Will not be
null
- Throws:
IllegalArgumentException
- if the capability does not provide a service or if its value type is not assignable toserviceValueType
IllegalStateException
- ifisDynamicallyNamed()
does not returntrue
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(Class<?> serviceValueType, String... dynamicNameElements)
-
getCapabilityServiceName
public org.jboss.msc.service.ServiceName getCapabilityServiceName(PathAddress address, Class<?> serviceValueType)
Gets the name of service provided by this capability.- Parameters:
address
- the path from which dynamic portion of the capability name is calculated from. Cannot benull
serviceValueType
- the expected type of the service's value. Only used to provide validate that the service value type provided by the capability matches the caller's expectation. May benull
in which case no validation is performed- Returns:
- the name of the service. Will not be
null
- Throws:
IllegalArgumentException
- if the capability does not provide a service or if its value type is not assignable toserviceValueType
IllegalStateException
- ifisDynamicallyNamed()
does not returntrue
-
getCapabilityServiceValueType
public Class<?> getCapabilityServiceValueType()
Gets the valid type to pass togetCapabilityServiceName(Class)
.- Returns:
- the valid type. May be
null
if this capability does not provide a service
-
getRuntimeAPI
public T getRuntimeAPI()
Object encapsulating the API exposed by this capability to other capabilities that require it, if it does expose such an API.- Returns:
- the API object, or
null
if the capability exposes no API to other capabilities
-
isAllowMultipleRegistrations
public boolean isAllowMultipleRegistrations()
Gets whether this capability can be registered at more than one point within the same overall scope.- Returns:
true
if the capability can legally be registered in more than one location in the same scope;false
if an attempt to do this should result in an exception
-
fromBaseCapability
public RuntimeCapability<T> fromBaseCapability(String... dynamicElement)
Creates a fully named capability from adynamically named
base capability. Capability providers should use this method to generate fully named capabilities in logic that handles dynamically named resources.- Parameters:
dynamicElement
- the dynamic portion of the full capability name. Cannot benull
or empty- Returns:
- the fully named capability.
- Throws:
AssertionError
- ifisDynamicallyNamed()
returnsfalse
-
fromBaseCapability
public RuntimeCapability<T> fromBaseCapability(PathAddress path)
Creates a fully named capability from adynamically named
base capability. Capability providers should use this method to generate fully named capabilities in logic that handles dynamically named resources.- Parameters:
path
- the dynamic portion of the full capability name. Cannot benull
or empty- Returns:
- the fully named capability.
- Throws:
AssertionError
- ifisDynamicallyNamed()
returnsfalse
-
getAdditionalRequiredPackages
public Set<String> getAdditionalRequiredPackages()
Description copied from interface:Capability
Gets the names of any "additional" Galleon packages that must be installed in order for this capability to function. The purpose of providing this information is to make it available to the Galleon tooling that produces Galleon feature-specs, in order to allow the tooling to include the package information in the relevant spec.A package is "additional" if it is not one of the "standard" packages that must be installed. The names of "standard" packages should not be returned. The "standard" packages are:
- The root package for the process type; i.e. the package that provides the main module whose name is passed to JBoss Modules when the process is launched.
-
If this capability is provided by an
Extension
, the package that installs the module that provides the extension. -
Any package that is listed as an additional required package by capability
upon which this capability has a
requirement
. - Any package that is non-optionally required, either directly or transitively, by one of the other types of standard packages.
- Returns:
- the additional package names. Will not return
null
but may be empty
-
getName
public String getName()
Description copied from interface:Capability
Gets the basic name of the capability. IfCapability.isDynamicallyNamed()
returnstrue
this will be the basic name of the capability, not including any dynamic portions.- Specified by:
getName
in interfaceCapability
- Overrides:
getName
in classAbstractCapability
- Returns:
- the name. Will not be
null
- See Also:
Capability.getDynamicName(String)
-
getRequirements
public Set<String> getRequirements()
Description copied from interface:Capability
Gets the names of other capabilities required by this capability. These are static requirements.- Specified by:
getRequirements
in interfaceCapability
- Overrides:
getRequirements
in classAbstractCapability
- Returns:
- the capability names. Will not be
null
but may be empty.
-
isDynamicallyNamed
public boolean isDynamicallyNamed()
Description copied from interface:Capability
Gets whether this capability is a dynamically named one, whose runtime variants will have a dynamic element added to the base name provided byCapability.getName()
.- Specified by:
isDynamicallyNamed
in interfaceCapability
- Overrides:
isDynamicallyNamed
in classAbstractCapability
- Returns:
true
if this capability is dynamically named
-
getDynamicName
public String getDynamicName(String dynamicNameElement)
Description copied from interface:Capability
Gets the full name of a capability, including a dynamic element- Specified by:
getDynamicName
in interfaceCapability
- Overrides:
getDynamicName
in classAbstractCapability
- Parameters:
dynamicNameElement
- the dynamic portion of the name. Cannot benull
- Returns:
- the full capability name
-
getDynamicName
public String getDynamicName(PathAddress address)
- Specified by:
getDynamicName
in interfaceCapability
- Overrides:
getDynamicName
in classAbstractCapability
-
equals
public boolean equals(Object o)
Description copied from class:AbstractCapability
- Overrides:
equals
in classAbstractCapability
- Returns:
true
ifo
is the same type as this object and itsname
is equal
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractCapability
-
toString
public String toString()
Description copied from class:AbstractCapability
- Overrides:
toString
in classAbstractCapability
- Returns:
- the value returned by
AbstractCapability.getName()
-
-