Interface ImmutableCapabilityRegistry

  • All Known Subinterfaces:
    RuntimeCapabilityRegistry
    All Known Implementing Classes:
    CapabilityRegistry

    public interface ImmutableCapabilityRegistry
    A read-only view of CapabilityRegistry Capability registry contains two kinds of capabilities: - possible capabilities which are defined on each resource to provide what said resource and provide at runtime - runtime or actual capabilities which are runtime instances of possible capabilities
    Author:
    Tomaz Cerar (c) 2015 Red Hat Inc.
    • Method Detail

      • hasCapability

        boolean hasCapability​(String capabilityName,
                              CapabilityScope scope)
        Gets whether a runtime capability with the given name is registered.
        Parameters:
        capabilityName - the name of the capability. Cannot be null
        scope - the scope in which to check for the capability
        Returns:
        true if there is a capability with the given name registered
      • getCapabilityRuntimeAPI

        <T> T getCapabilityRuntimeAPI​(String capabilityName,
                                      CapabilityScope scope,
                                      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
        scope - the scope in which to resolve the capability. Cannot be null
        apiType - class of the java type that exposes the API. Cannot be null
        Returns:
        the runtime API. Will not return null
        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}
      • getCapabilities

        Set<CapabilityRegistration<?>> getCapabilities()
        Returns set of runtime capabilities registered in the registry
        Returns:
        read only Set with all runtime capabilities and where ware they registered
      • getPossibleCapabilities

        Set<CapabilityRegistration<?>> getPossibleCapabilities()
        Returns set of possible capabilities with there registration points registered in the registry
        Returns:
        read only Set with all possible capabilities and where ware they registered
      • getCapabilityServiceName

        org.jboss.msc.service.ServiceName getCapabilityServiceName​(String capabilityName,
                                                                   CapabilityScope scope,
                                                                   Class<?> serviceType)
        Gets the name of the service provided by the capability, if there is one.
        Parameters:
        capabilityName - the name of the capability. Cannot be null
        scope - the scope in which to resolve the capability. Cannot be null
        serviceType - the type of the value provided by the service. May be null if 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
        Throws:
        IllegalStateException - if no capability with the given name is available in the given context
        IllegalArgumentException - if the capability does not provide a service, or if serviceType is not null and the type of the service the capability provides is not assignable from it
      • getPossibleProviderPoints

        Set<PathAddress> getPossibleProviderPoints​(CapabilityId capabilityId)
        Returns possible provider points for passed capabilityId
        Parameters:
        capabilityId - id of capability
        Returns:
        set of PathAddress-es where capability could be registered, will not return null but can be empty
      • getCapability

        CapabilityRegistration<?> getCapability​(CapabilityId capabilityId)
        returns capability registration for capability id pass as parameter
        Parameters:
        capabilityId - id of capability with its scope.
        Returns:
        CapabilityRegistration or null if none is found
      • getDynamicCapabilityNames

        Set<String> getDynamicCapabilityNames​(String referencedCapability,
                                              CapabilityScope dependentScope)
        Retrieve all the capability names that the passed scope can access
        Parameters:
        referencedCapability - The static name of the capability
        dependentScope - The scope from which the capability is referenced
        Returns:
        A set of capabilities name. Only the dynamic part of the name is returned