Class AbstractMetadataProviderParser

All Implemented Interfaces:
BeanDefinitionParser
Direct Known Subclasses:
AbstractDynamicMetadataProviderParser, AbstractReloadingMetadataProviderParser, ChainingMetadataProviderParser, InlineMetadataProviderParser

public abstract class AbstractMetadataProviderParser extends AbstractCustomBeanDefinitionParser
Parser for the MetadataProviderType in the urn:mace:shibboleth:2.0:metadata namespace. If we are the top most element then we need to summon up a MetadataProviderContainer and inject what we would usually create into that.
  • Field Details

    • SECURITY_NAMESPACE

      @Nonnull @NotEmpty public static final String SECURITY_NAMESPACE
      Namespace for Security.
      See Also:
    • METADATA_NAMESPACE

      @Nonnull @NotEmpty public static final String METADATA_NAMESPACE
      Namespace for Metadata.
      See Also:
    • METADATA_FILTER_ELEMENT_NAME

      @Nonnull public static final QName METADATA_FILTER_ELEMENT_NAME
      MetadataFilter Element name.
    • CHAINING_PROVIDER_ELEMENT_NAME

      @Nonnull public static final QName CHAINING_PROVIDER_ELEMENT_NAME
      ChainingMetadataProviderElement name.
    • TRUST_ENGINE_ELEMENT_NAME

      @Nonnull public static final QName TRUST_ENGINE_ELEMENT_NAME
      TrustEngine Element name.
    • log

      @Nonnull private final org.slf4j.Logger log
      Logger.
    • byReferenceBridgeRef

      @Nullable private final String byReferenceBridgeRef
      Bean ID for defaulted ByReferenceMetadataFilterBridge instance.
    • autoWiredNodeProcessingRef

      @Nullable private final String autoWiredNodeProcessingRef
      Bean ID for defaulted AutoWiredNodeProcessingMetadataFilter instance.
  • Constructor Details

    • AbstractMetadataProviderParser

      public AbstractMetadataProviderParser()
      Constructor.
  • Method Details

    • isPresentNotChaining

      private boolean isPresentNotChaining(@Nonnull Element element, @Nonnull String attribute)
      Handle attributes which are inappropriate for specific implementations. The chaining metadata provider cannot have "requireValidMetadata" or "failFastInitialization" set, even though they are present in the schema.

      This method detects whether these elements are present and if the element is not a chaining provider returns true, otherwise it returns false and emits a warning.

      Parameters:
      element - the element
      attribute - the attribute
      Returns:
      true iff this is not a chaining resolver and the attribute is present
    • isChaining

      private boolean isChaining(@Nonnull Element element)
      Is this a chaining resolver?
      Parameters:
      element - root element of resolver
      Returns:
      whether the type is Chaining
    • isTopMost

      private boolean isTopMost(@Nonnull Element element)
      Is this the element at the top of the file? Yes, if it has no parent. In this situation we need to wrap the element in a MetadataProviderContainer.
      Parameters:
      element - the element.
      Returns:
      whether it is the outmost element.
    • getNativeBeanClass

      @Nonnull protected abstract Class<? extends MetadataResolver> getNativeBeanClass(@Nonnull Element element)
      Return the real class implement by this type. This has the same function as the more usual AbstractSingleBeanDefinitionParser.getBeanClass(Element) but it may need to be shimmed in AbstractMetadataProviderParser which may need to insert an extra bean.
      Parameters:
      element - the Element that is being parsed
      Returns:
      the Class of the bean that is being defined via parsing the supplied Element, or null if none
      See Also:
    • getBeanClass

      protected final Class<?> getBeanClass(@Nonnull Element element)
      Overrides:
      getBeanClass in class AbstractSingleBeanDefinitionParser
    • doParse

      protected final void doParse(@Nonnull Element element, @Nonnull ParserContext parserContext, @Nonnull BeanDefinitionBuilder builder)
      Overrides:
      doParse in class AbstractSingleBeanDefinitionParser
    • doNativeParse

      protected void doNativeParse(@Nonnull Element element, @Nonnull ParserContext parserContext, @Nonnull BeanDefinitionBuilder builder)
      Parse the element into the provider builder. This has the same function as the more usual AbstractSingleBeanDefinitionParser.doParse(Element, ParserContext, BeanDefinitionBuilder) but it may need to be shimmed in this class which may need to insert an extra bean.
      Parameters:
      element - the XML element being parsed
      parserContext - the object encapsulating the current state of the parsing process
      builder - used to define the BeanDefinition
      See Also:
    • processMetadataFilters

      private void processMetadataFilters(@Nonnull Element element, @Nonnull ParserContext parserContext, @Nonnull BeanDefinitionBuilder builder)
      Handle set up of metadata filters with chaining and auto-install of node processing filter.
      Parameters:
      element - the current element being processed
      parserContext - the current parser context
      builder - the current bean definition builder
    • processPredicateOptions

      private void processPredicateOptions(@Nonnull Element element, @Nonnull ParserContext parserContext, @Nonnull BeanDefinitionBuilder builder)
      Process predicate-related options.
      Parameters:
      element - the current element being processed
      parserContext - the current parser context
      builder - the current bean definition builder