org.apache.ws.jaxme.util
public class Configurator extends Object implements ContentHandler, NamespaceResolver
The Configurator is an idea borrowed by the Ant project. It is a SAX2 handler that reads a config file which is represented by a hierarchy of Java beans. For example:
<outerBean foo="true" bar="Quite right"> <innerBean whatever="57"> </innerBean </outerBean>The example would create an object outerBean and call its methods
setFoo(boolean)
and
setBar(String)
to process the attributes.
It would also create a bean innerBean by calling the
outerBeans method createInnerBean()
.
Finally the innerBean is configured by calling
setWhatever(int)
.
Version: $Id: Configurator.java 232067 2005-03-10 10:14:08Z jochen $
Method Summary | |
---|---|
void | characters(char[] ch, int start, int length) Handles atomic child elements by invoking their method
|
void | endDocument() |
void | endElement(String namespaceURI, String qName, String localName) Terminates parsing the current bean by calling its
|
void | endPrefixMapping(String pPrefix) |
Object | getBeanFactory() Returns the bean factory, creating the outermost element. |
Locator | getDocumentLocator() Returns the Locator being used in error messages. |
protected String | getMethodNameFor(String pPrefix, String pName) Given a prefix and a name, creates a method name matching the prefix and the name. |
String[] | getNamespaces() Returns the namespaces handled by the configurator. |
Object | getResult() Returns the parsed result bean. |
Object | getRootObject() An alternative to using the bean factory. |
void | ignorableWhitespace(char[] ch, int start, int length) |
protected Object | invokeMethod(String pMethodName, Object pBean, Class[] pSignature, Object[] pArgs) |
protected boolean | isNamespaceMatching(String pNamespace) Returns whether a namespace is matching the configured namespace. |
void | processingInstruction(String target, String data) |
boolean | processName(String pName, String[] parts) |
void | setBeanFactory(Object pFactory) Sets the bean factory, creating the outermost element. |
void | setDocumentLocator(Locator pLocator) Sets the Locator being used in error messages. |
void | setNamespace(String pNamespace) Sets the namespace handled by the configurator. |
void | setNamespaces(String[] pNamespaces) Sets the namespaces handled by the configurator. |
void | setRootObject(Object pRootObject) An alternative to using the bean factory. |
void | skippedEntity(String name) |
void | startDocument() |
void | startElement(String pNamespaceURI, String pQName, String pLocalName, Attributes pAttr) Creates a new bean, matching the element name |
void | startPrefixMapping(String pPrefix, String pURI) |
Handles atomic child elements by invoking their method
addText(String pText)
. Note that it may happen,
that this method is invoked multiple times, if the parser
splits a piece of text into multiple SAX events.
Terminates parsing the current bean by calling its
finish()
method, if any.
Returns the bean factory, creating the outermost element.
The bean factory must have a matching createElementName()
method, with ElementName being the element name
of the document element.
Returns the Locator being used in error messages.
Given a prefix and a name, creates a method name matching the prefix and the name.
Returns the namespaces handled by the configurator. Defaults to no namespace.
An alternative to using the bean factory. This object is used as the root object, regardless of its name.
Returns whether a namespace is matching the configured namespace.
Sets the bean factory, creating the outermost element.
The bean factory must have a matching createElementName()
method, with ElementName being the element name
of the document element.
Sets the Locator being used in error messages.
Sets the namespace handled by the configurator. Defaults
to no namespace. Shortcut for
setNamespace(new String[]{pNamespace})
.
Parameters: pNamespace The namespace being set
Sets the namespaces handled by the configurator. Defaults to no namespace.
Parameters: pNamespaces The namespaces being set
An alternative to using the bean factory. This object is used as the root object, regardless of its name.
Creates a new bean, matching the element name pLocalName
.
If this is the outermost bean, calls the bean factorys
createBeanName()
method, otherwise calls the current beans
createBeanName()
method, with beanName
being the value of the pLocalName
parameter.