Package org.eclipse.sisu.plexus
Class PlexusXmlScanner
java.lang.Object
org.eclipse.sisu.plexus.PlexusXmlScanner
Helper class that can scan XML resources for Plexus metadata.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlexusXmlScanner(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 TypeMethodDescriptionprivate static ReaderfilteredXmlReader(InputStream in, Map variables) Wraps the givenInputStreamas aReaderwith XML encoding detection and optional interpolation.private voidparseComponent(org.codehaus.plexus.util.xml.pull.MXParser parser, PlexusTypeRegistry registry) Parses a <component> XML stanza into a deferred implementation, configuration, and requirements.private voidparseComponentsXml(URL url, PlexusTypeRegistry registry) Parses acomponents.xmlresource into a series of Plexus bean metadata.private static voidparseConfiguration(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 voidparseLoadOnStart(org.codehaus.plexus.util.xml.pull.MXParser parser, PlexusTypeRegistry registry) Parses a load-on-start <component> XML stanza into a Plexus role-hint.private voidparsePlexusXml(URL url, PlexusTypeRegistry registry) Parses aplexus.xmlresource into load-on-start settings and Plexus bean metadata.private static voidparseRequirement(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 StringTEXT(org.codehaus.plexus.util.xml.pull.XmlPullParser parser) Returns the text contained inside the current XML element, without any surrounding whitespace.private voidupdatePlexusBeanMetadata(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.
-
Field Details
-
variables
-
plexusXml
-
metadata
-
-
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 variablesplexusXml- The plexus.xml URLmetadata- The metadata map
-
-
Method Details
-
scan
Map<org.codehaus.plexus.component.annotations.Component,DeferredClass<?>> scan(ClassSpace space, boolean root) -
filteredXmlReader
Wraps the givenInputStreamas aReaderwith XML encoding detection and optional interpolation.- Parameters:
in- The input streamvariables- The filter variables- Returns:
- Reader that can automatically detect XML encodings and optionally interpolate variables
- Throws:
IOException
-
parsePlexusXml
Parses aplexus.xmlresource into load-on-start settings and Plexus bean metadata.- Parameters:
url- The plexus.xml URLregistry- The parsed components
-
parseComponentsXml
Parses acomponents.xmlresource into a series of Plexus bean metadata.- Parameters:
url- The components.xml URLregistry- 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 parserregistry- The parsed components- Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionIOException
-
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 parserregistry- The parsed components- Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionIOException
-
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 implementationconfigurationMap- The field -> @ConfigurationmaprequirementMap- The field -> @Requirementmap
-
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, IOExceptionParses a <requirement> XML stanza into a mapping from a field name to a @Requirement.- Parameters:
parser- The XML parserspace- The class spacerequirementMap- The field -> @Requirementmap- Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionIOException
-
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, IOExceptionParses a <configuration> XML stanza into a mapping from a field name to a @Configuration.- Parameters:
parser- The XML parserconfigurationMap- The field -> @Configurationmap- Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionIOException
-
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.XmlPullParserExceptionIOException
-