Interface CapabilityServiceSupport
-
public interface CapabilityServiceSupport
Provides 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 class
CapabilityServiceSupport.NoSuchCapabilityException
Exception thrown when support for an unregistered capability is requested.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
getCapabilityRuntimeAPI(String capabilityName, Class<T> apiType)
Gets the runtime API associated with a given capability, if there is one.<T> T
getCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType)
Gets the runtime API associated with a givendynamically named
capability, if there is one.org.jboss.msc.service.ServiceName
getCapabilityServiceName(String capabilityName)
Gets the name of a service associated with a given capability.org.jboss.msc.service.ServiceName
getCapabilityServiceName(String capabilityBaseName, String... dynamicParts)
Gets the name of a service associated with a givendynamically named
capability.<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 named
capability, if there is one.boolean
hasCapability(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:
true
if 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 benull
apiType
- 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 named
capability, if there is one.- Type Parameters:
T
- the java type that exposes the API- Parameters:
capabilityBaseName
- the base name of the capability. Cannot benull
dynamicPart
- the dynamic part of the capability name. Cannot benull
apiType
- 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 benull
apiType
- 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 named
capability, if there is one.- Type Parameters:
T
- the java type that exposes the API- Parameters:
capabilityBaseName
- the base name of the capability. Cannot benull
dynamicPart
- the dynamic part of the capability name. Cannot benull
apiType
- 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 named
capability. This method does not confirm that the capability is currently registered.- Parameters:
capabilityBaseName
- the base name of the capability. Cannot benull
dynamicParts
- the dynamic parts of the capability name. Cannot benull
Can be multiple if capability supports that- Returns:
- the name of the service. Will not return
null
-
-