Package org.jvnet.hk2.config
Class ConfigParser
java.lang.Object
org.jvnet.hk2.config.ConfigParser
Parses configuration files, builds
s,
and add them to
.
invalid reference
Inhabitant
invalid reference
Habitat
This class also maintains the model of various elements in the configuration file.
This class can be sub-classed to create a ConfigParser with a custom non-standard behavior.
- Author:
- Kohsuke Kawaguchi
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.glassfish.hk2.api.ServiceLocatorThis is where we put parsed inhabitants into. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DomhandleElement(XMLStreamReader in, DomDocument document, Dom parent) Parses a whole XML tree and builds aDomtree.protected DomhandleElement(XMLStreamReader in, DomDocument document, Dom parent, ConfigModel model) Parses a whole XML tree and builds aDomtree, by using the given model for the top-level element.Parses the given source as a config file, and adds resultingDoms intoasinvalid reference
Habitats.invalid reference
Inhabitantparse(URL source, DomDocument document) parse(URL source, DomDocument document, Dom parent) parse(XMLStreamReader in) voidparse(XMLStreamReader in, DomDocument document) voidparse(XMLStreamReader in, DomDocument document, Dom parent)
-
Field Details
-
habitat
protected final org.glassfish.hk2.api.ServiceLocator habitatThis is where we put parsed inhabitants into.
-
-
Constructor Details
-
ConfigParser
public ConfigParser(org.glassfish.hk2.api.ServiceLocator habitat)
-
-
Method Details
-
parse
- Throws:
XMLStreamException
-
parse
- Throws:
XMLStreamException
-
parse
- Throws:
XMLStreamException
-
parse
Parses the given source as a config file, and adds resultingDoms intoasinvalid reference
Habitats.invalid reference
Inhabitant -
parse
-
parse
-
handleElement
protected Dom handleElement(XMLStreamReader in, DomDocument document, Dom parent) throws XMLStreamException Parses a whole XML tree and builds aDomtree.This is the entry point for the root element of a configuration tree.
- Parameters:
in- pre-condition: 'in' is at the start element. post-condition: 'in' is at the end element.document- The document that we are building right now. Newly createdDomwill belong to this document.parent- The parent element- Returns:
- Null if the XML element didn't yield anything (which can happen if the element is skipped.)
Otherwise fully parsed valid
Domobject. - Throws:
XMLStreamException
-
handleElement
protected Dom handleElement(XMLStreamReader in, DomDocument document, Dom parent, ConfigModel model) throws XMLStreamException Parses a whole XML tree and builds aDomtree, by using the given model for the top-level element.This is the entry point for recursively parsing inside a configuration tree. Since not every element is global, you don't always want to infer the model just from the element name (as is the case with
handleElement(XMLStreamReader, DomDocument, Dom).- Parameters:
in- pre-condition: 'in' is at the start element. post-condition: 'in' is at the end element.document- The document that we are building right now. Newly createdDomwill belong to this document.parent- The parent element- Returns:
- Null if the XML element didn't yield anything (which can happen if the element is skipped.)
Otherwise fully parsed valid
Domobject. - Throws:
XMLStreamException
-