Class ChainingMetadataResolver

    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • detectDuplicateEntityIDs

        @Nonnull
        private DetectDuplicateEntityIDs detectDuplicateEntityIDs
        Strategy for detecting duplicate entityIDs across resolvers.
    • Constructor Detail

      • ChainingMetadataResolver

        public ChainingMetadataResolver()
        Constructor.
    • Method Detail

      • getDetectDuplicateEntityIDs

        @Nonnull
        public DetectDuplicateEntityIDs getDetectDuplicateEntityIDs()
        Get the strategy for detecting duplicate entityIDs across resolvers.
        Returns:
        the configured strategy
      • setDetectDuplicateEntityIDs

        public void setDetectDuplicateEntityIDs​(@Nullable
                                                DetectDuplicateEntityIDs strategy)
        Set the strategy for detecting duplicate entityIDs across resolvers.
        Parameters:
        strategy - the strategy to configure
      • isRequireValidMetadata

        public boolean isRequireValidMetadata()
        Gets whether the metadata returned by queries must be valid.

        At a minimum, metadata is valid only if the date expressed in the validUntil attribute of the element and all its ancestral elements has not passed. Specific implementations may add additional constraints.

        Specified by:
        isRequireValidMetadata in interface MetadataResolver
        Returns:
        whether the metadata returned by queries must be valid
      • setRequireValidMetadata

        public void setRequireValidMetadata​(boolean requireValidMetadata)
        Sets whether the metadata returned by queries must be valid.
        Specified by:
        setRequireValidMetadata in interface MetadataResolver
        Parameters:
        requireValidMetadata - whether the metadata returned by queries must be valid
      • setMetadataFilter

        public void setMetadataFilter​(MetadataFilter newFilter)
        Sets the metadata filter applied to the metadata.
        Specified by:
        setMetadataFilter in interface MetadataResolver
        Parameters:
        newFilter - the metadata filter applied to the metadata
      • detectDuplicateEntityIDs

        private void detectDuplicateEntityIDs​(@Nonnull
                                              MetadataResolver resolver,
                                              @Nonnull
                                              CriteriaSet criteria,
                                              @Nullable
                                              Set<String> resultEntityIDs,
                                              @Nonnull
                                              DetectDuplicateEntityIDs detectDuplicates)
        Perform duplicate entityID detection.
        Parameters:
        resolver - the metadata resolver over which to perform duplicate detection
        criteria - the current criteria set
        resultEntityIDs - the set of entityIDs contained in the effective results to be returned
        detectDuplicates - the effective strategy for duplicate detection
      • collectEntityIDs

        private Set<String> collectEntityIDs​(@Nonnull
                                             Iterable<EntityDescriptor> descriptors)
        Collect the unique entityIDs from the supplied iterable of entity descriptors.
        Parameters:
        descriptors -
        Returns:
        the unique entityIDs from the supplied descriptors
      • refresh

        public void refresh()
                     throws ResolverException
        Refresh the data exposed by the resolver.

        An implementation of this method should typically be either synchronized or make use other locking mechanisms to protect against concurrent access.

        Specified by:
        refresh in interface RefreshableMetadataResolver
        Throws:
        ResolverException - if the refresh operation was unsuccessful
      • getLastUpdate

        @Nullable
        public Instant getLastUpdate()
        Get the time that the currently available metadata was last updated. Note, this may be different than the time retrieved by RefreshableMetadataResolver.getLastRefresh() is the metadata was known not to have changed during the last refresh cycle. We iterate over all the children and return the earliest instant or null if one of them hasn't ever updated.
        Specified by:
        getLastUpdate in interface RefreshableMetadataResolver
        Returns:
        time when the currently metadata was last updated, null if metadata has never successfully been read in
      • getLastRefresh

        @Nullable
        public Instant getLastRefresh()
        Gets the time the last refresh cycle occurred. We iterate over all the children and return the earliest instant or null if one of them hasn't ever refreshed.
        Specified by:
        getLastRefresh in interface RefreshableMetadataResolver
        Returns:
        time the last refresh cycle occurred
      • getLastSuccessfulRefresh

        public Instant getLastSuccessfulRefresh()
        Gets the time the last successful refresh cycle occurred. We iterate over all the children and return the earliest instant or null if one of them hasn't ever refreshed successfully.
        Specified by:
        getLastSuccessfulRefresh in interface RefreshableMetadataResolver
        Returns:
        time the last successful refresh cycle occurred
      • wasLastRefreshSuccess

        public Boolean wasLastRefreshSuccess()
        Gets whether the last refresh cycle was successful. We iterate over all children - a failure of any is a failure.
        Specified by:
        wasLastRefreshSuccess in interface RefreshableMetadataResolver
        Returns:
        true if last refresh cycle was successful, false if not
      • getLastFailureCause

        public Throwable getLastFailureCause()
        Gets the reason the last refresh failed. We iterate over all children and return the first failure we find.
        Specified by:
        getLastFailureCause in interface RefreshableMetadataResolver
        Returns:
        reason the last refresh failed or null if the last refresh was successful