Interface CapabilityScope


  • public interface CapabilityScope
    Scope in which a capability is available.

    The GLOBAL scope can be used for most cases. A Host Controller will use a different implementation of this interface for capabilities that are limited to some subset of the domain-wide model, e.g. a single profile.

    Implementations of this interface should override #equals(Object) and #hashCode() such that logically equivalent but non-identical instances can function as keys in a hash map.

    Author:
    Brian Stansberry (c) 2014 Red Hat Inc.
    • Field Detail

      • GLOBAL

        static final CapabilityScope GLOBAL
        A CapabilityScope that can satisfy any dependent scope. Meant for capabilities that are present regardless of any scope, or for convenience use in cases where there is only one scope.
    • Method Detail

      • canSatisfyRequirement

        boolean canSatisfyRequirement​(String requiredName,
                                      CapabilityScope dependentScope,
                                      CapabilityResolutionContext context)
        Gets whether a given capability associated with this scope can satisfy the given requirement.
        Parameters:
        requiredName - the name of the required capability
        dependentScope - the scope of the dependent capability
        context - resolution context in use for this resolution run
        Returns:
        true if the requirement can be satisfied from this scope; false otherwise
      • requiresConsistencyCheck

        boolean requiresConsistencyCheck()
        Gets whether a consistency check must be performed when other capabilities depend on capabilities in this scope. A consistency check is necessary if different capabilities in the dependent scope can potentially require capabilities in different other scopes, but all such capabilities must be available in at least one scope.
        Returns:
        true if a consistency check is required
      • getName

        String getName()
        Gets a descriptive name of the scope
        Returns:
        the name. Will not return null
      • getIncludingScopes

        default Set<CapabilityScope> getIncludingScopes​(CapabilityResolutionContext context)
        Gets any scope that logically include this one, i.e. where this scope can satisfy requirements as if it were the including scope.
        Parameters:
        context - resolution context in use for this resolution run
        Returns:
        the including scopes. Will not be null but may be empty.