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 Reader
filteredXmlReader
(InputStream in, Map variables) Wraps the givenInputStream
as aReader
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
parseComponentsXml
(URL url, PlexusTypeRegistry registry) Parses acomponents.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
parsePlexusXml
(URL url, PlexusTypeRegistry registry) Parses aplexus.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.
-
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 givenInputStream
as aReader
with 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.xml
resource into load-on-start settings and Plexus bean metadata.- Parameters:
url
- The plexus.xml URLregistry
- The parsed components
-
parseComponentsXml
Parses acomponents.xml
resource 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.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 parserregistry
- 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 implementationconfigurationMap
- The field -> @Configuration
maprequirementMap
- 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, 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 -> @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, IOExceptionParses a <configuration> XML stanza into a mapping from a field name to a @Configuration
.- Parameters:
parser
- The XML parserconfigurationMap
- 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
-