Class PlexusXmlScanner

java.lang.Object
org.eclipse.sisu.plexus.PlexusXmlScanner

final class PlexusXmlScanner extends Object
Helper class that can scan XML resources for Plexus metadata.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private final URL
     
    private final Map<?,?>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlexusXmlScanner(Map<?,?> variables, URL plexusXml, Map<String,PlexusBeanMetadata> metadata)
    Creates an XML scanner that also accumulates Plexus bean metadata in the given map.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static Reader
    Wraps the given InputStream as a Reader with XML encoding detection and optional interpolation.
    private void
    parseComponent(org.codehaus.plexus.util.xml.pull.MXParser parser, PlexusTypeRegistry registry)
    Parses a <component> XML stanza into a deferred implementation, configuration, and requirements.
    private void
    Parses a components.xml resource into a series of Plexus bean metadata.
    private static void
    parseConfiguration(org.codehaus.plexus.util.xml.pull.MXParser parser, Map<String,org.codehaus.plexus.component.annotations.Configuration> configurationMap)
    Parses a <configuration> XML stanza into a mapping from a field name to a @Configuration.
    private static void
    parseLoadOnStart(org.codehaus.plexus.util.xml.pull.MXParser parser, PlexusTypeRegistry registry)
    Parses a load-on-start <component> XML stanza into a Plexus role-hint.
    private void
    Parses a plexus.xml resource into load-on-start settings and Plexus bean metadata.
    private static void
    parseRequirement(org.codehaus.plexus.util.xml.pull.MXParser parser, ClassSpace space, Map<String,org.codehaus.plexus.component.annotations.Requirement> requirementMap)
    Parses a <requirement> XML stanza into a mapping from a field name to a @Requirement.
    (package private) Map<org.codehaus.plexus.component.annotations.Component,DeferredClass<?>>
    scan(ClassSpace space, boolean root)
     
    private static String
    TEXT(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
    Returns the text contained inside the current XML element, without any surrounding whitespace.
    private void
    updatePlexusBeanMetadata(String implementation, Map<String,org.codehaus.plexus.component.annotations.Configuration> configurationMap, Map<String,org.codehaus.plexus.component.annotations.Requirement> requirementMap)
    Updates the shared Plexus bean metadata with the given local information.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • PlexusXmlScanner

      PlexusXmlScanner(Map<?,?> variables, URL plexusXml, Map<String,PlexusBeanMetadata> metadata)
      Creates an XML scanner that also accumulates Plexus bean metadata in the given map.
      Parameters:
      variables - The filter variables
      plexusXml - The plexus.xml URL
      metadata - The metadata map
  • Method Details

    • scan

      Map<org.codehaus.plexus.component.annotations.Component,DeferredClass<?>> scan(ClassSpace space, boolean root)
    • filteredXmlReader

      private static Reader filteredXmlReader(InputStream in, Map variables) throws IOException
      Wraps the given InputStream as a Reader with XML encoding detection and optional interpolation.
      Parameters:
      in - The input stream
      variables - The filter variables
      Returns:
      Reader that can automatically detect XML encodings and optionally interpolate variables
      Throws:
      IOException
    • parsePlexusXml

      private void parsePlexusXml(URL url, PlexusTypeRegistry registry)
      Parses a plexus.xml resource into load-on-start settings and Plexus bean metadata.
      Parameters:
      url - The plexus.xml URL
      registry - The parsed components
    • parseComponentsXml

      private void parseComponentsXml(URL url, PlexusTypeRegistry registry)
      Parses a components.xml resource into a series of Plexus bean metadata.
      Parameters:
      url - The components.xml URL
      registry - The parsed components
    • parseLoadOnStart

      private static void parseLoadOnStart(org.codehaus.plexus.util.xml.pull.MXParser parser, PlexusTypeRegistry registry) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
      Parses a load-on-start <component> XML stanza into a Plexus role-hint.
      Parameters:
      parser - The XML parser
      registry - The parsed components
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException
      IOException
    • parseComponent

      private void parseComponent(org.codehaus.plexus.util.xml.pull.MXParser parser, PlexusTypeRegistry registry) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
      Parses a <component> XML stanza into a deferred implementation, configuration, and requirements.
      Parameters:
      parser - The XML parser
      registry - The parsed components
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException
      IOException
    • updatePlexusBeanMetadata

      private void updatePlexusBeanMetadata(String implementation, Map<String,org.codehaus.plexus.component.annotations.Configuration> configurationMap, Map<String,org.codehaus.plexus.component.annotations.Requirement> requirementMap)
      Updates the shared Plexus bean metadata with the given local information.
      Parameters:
      implementation - The component implementation
      configurationMap - The field -> @Configuration map
      requirementMap - The field -> @Requirement map
    • parseRequirement

      private static void parseRequirement(org.codehaus.plexus.util.xml.pull.MXParser parser, ClassSpace space, Map<String,org.codehaus.plexus.component.annotations.Requirement> requirementMap) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
      Parses a <requirement> XML stanza into a mapping from a field name to a @Requirement.
      Parameters:
      parser - The XML parser
      space - The class space
      requirementMap - The field -> @Requirement map
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException
      IOException
    • parseConfiguration

      private static void parseConfiguration(org.codehaus.plexus.util.xml.pull.MXParser parser, Map<String,org.codehaus.plexus.component.annotations.Configuration> configurationMap) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
      Parses a <configuration> XML stanza into a mapping from a field name to a @Configuration.
      Parameters:
      parser - The XML parser
      configurationMap - The field -> @Configuration map
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException
      IOException
    • TEXT

      private static String TEXT(org.codehaus.plexus.util.xml.pull.XmlPullParser parser) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
      Returns the text contained inside the current XML element, without any surrounding whitespace.
      Parameters:
      parser - The XML parser
      Returns:
      Trimmed TEXT element
      Throws:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException
      IOException