Interface CapabilityServiceSupport
-
public interface CapabilityServiceSupportProvides support for capability integration outside the management layer, in service implementations.Note that use of this interface in no way creates a requirement on the referenced capability by the caller.
- Author:
- Brian Stansberry
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCapabilityServiceSupport.NoSuchCapabilityExceptionException thrown when support for an unregistered capability is requested.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TgetCapabilityRuntimeAPI(String capabilityName, Class<T> apiType)Gets the runtime API associated with a given capability, if there is one.<T> TgetCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType)Gets the runtime API associated with a givendynamically namedcapability, if there is one.org.jboss.msc.service.ServiceNamegetCapabilityServiceName(String capabilityName)Gets the name of a service associated with a given capability.org.jboss.msc.service.ServiceNamegetCapabilityServiceName(String capabilityBaseName, String... dynamicParts)Gets the name of a service associated with a givendynamically namedcapability.<T> Optional<T>getOptionalCapabilityRuntimeAPI(String capabilityName, Class<T> apiType)Gets the runtime API associated with a given capability, if there is one.<T> Optional<T>getOptionalCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType)Gets the runtime API associated with a givendynamically namedcapability, if there is one.booleanhasCapability(String capabilityName)Gets whether a runtime capability with the given name is registered.
-
-
-
Method Detail
-
hasCapability
boolean hasCapability(String capabilityName)
Gets whether a runtime capability with the given name is registered.- Parameters:
capabilityName- the name of the capability. Cannot benull- Returns:
trueif there is a capability with the given name registered
-
getCapabilityRuntimeAPI
<T> T getCapabilityRuntimeAPI(String capabilityName, Class<T> apiType) throws CapabilityServiceSupport.NoSuchCapabilityException
Gets the runtime API associated with a given capability, if there is one.- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityName- the name of the capability. Cannot benullapiType- class of the java type that exposes the API. Cannot benull- Returns:
- the runtime API. Will not return
null - Throws:
CapabilityServiceSupport.NoSuchCapabilityException- if no matching capability is registeredIllegalArgumentException- if the capability does not provide a runtime APIClassCastException- if the runtime API exposed by the capability cannot be cast to type {code T}
-
getCapabilityRuntimeAPI
<T> T getCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType) throws CapabilityServiceSupport.NoSuchCapabilityException
Gets the runtime API associated with a givendynamically namedcapability, if there is one.- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityBaseName- the base name of the capability. Cannot benulldynamicPart- the dynamic part of the capability name. Cannot benullapiType- class of the java type that exposes the API. Cannot benull- Returns:
- the runtime API. Will not return
null - Throws:
CapabilityServiceSupport.NoSuchCapabilityException- if no matching capability is registeredIllegalArgumentException- if the capability does not provide a runtime APIClassCastException- if the runtime API exposed by the capability cannot be cast to type {code T}
-
getOptionalCapabilityRuntimeAPI
<T> Optional<T> getOptionalCapabilityRuntimeAPI(String capabilityName, Class<T> apiType)
Gets the runtime API associated with a given capability, if there is one.- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityName- the name of the capability. Cannot benullapiType- class of the java type that exposes the API. Cannot benull- Returns:
- an Optional describing the value of the runtime API. If no matching capability is registered, the optional will be empty.
- Throws:
IllegalArgumentException- if the capability does not provide a runtime APIClassCastException- if the runtime API exposed by the capability cannot be cast to type {code T}
-
getOptionalCapabilityRuntimeAPI
<T> Optional<T> getOptionalCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType)
Gets the runtime API associated with a givendynamically namedcapability, if there is one.- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityBaseName- the base name of the capability. Cannot benulldynamicPart- the dynamic part of the capability name. Cannot benullapiType- class of the java type that exposes the API. Cannot benull- Returns:
- an Optional describing the value of the runtime API. If no matching capability is registered, the optional will be empty.
- Throws:
IllegalArgumentException- if the capability does not provide a runtime APIClassCastException- if the runtime API exposed by the capability cannot be cast to type {code T}
-
getCapabilityServiceName
org.jboss.msc.service.ServiceName getCapabilityServiceName(String capabilityName)
Gets the name of a service associated with a given capability. This method does not confirm that the capability is currently registered.- Parameters:
capabilityName- the name of the capability. Cannot benull- Returns:
- the name of the service. Will not return
null
-
getCapabilityServiceName
org.jboss.msc.service.ServiceName getCapabilityServiceName(String capabilityBaseName, String... dynamicParts)
Gets the name of a service associated with a givendynamically namedcapability. This method does not confirm that the capability is currently registered.- Parameters:
capabilityBaseName- the base name of the capability. Cannot benulldynamicParts- the dynamic parts of the capability name. Cannot benullCan be multiple if capability supports that- Returns:
- the name of the service. Will not return
null
-
-