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
    • 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 be null
        Returns:
        true if there is a capability with the given name registered
      • 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 be null
        apiType - class of the java type that exposes the API. Cannot be null
        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 API
        ClassCastException - 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 given dynamically 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 be null
        dynamicPart - the dynamic part of the capability name. Cannot be null
        apiType - class of the java type that exposes the API. Cannot be null
        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 API
        ClassCastException - 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 be null
        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 given dynamically named capability. This method does not confirm that the capability is currently registered.
        Parameters:
        capabilityBaseName - the base name of the capability. Cannot be null
        dynamicParts - the dynamic parts of the capability name. Cannot be null Can be multiple if capability supports that
        Returns:
        the name of the service. Will not return null