|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tiles.definition.digester.DigesterDefinitionsReader
public class DigesterDefinitionsReader
Reads Definition
objects from
an XML InputStream using Digester.
This DefinitionsReader
implementation expects the source to be
passed as an InputStream
. It parses XML data from the source
and builds a Map of Definition objects.
The Digester object can be configured by passing in initialization
parameters. Currently the only parameter that is supported is the
validating
parameter. This value is set to false
by default. To enable DTD validation for XML Definition files, give the init
method a parameter with a key of
org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE
and a value of "true"
.
The Definition objects are stored internally in a Map. The Map is stored as
an instance variable rather than a local variable in the read
method. This means that instances of this class are not
thread-safe and access by multiple threads must be synchronized.
Field Summary | |
---|---|
protected Digester |
digester
Digester object used to read Definition data
from the source. |
static String |
PARSER_VALIDATE_PARAMETER_NAME
Digester validation parameter name. |
protected String[] |
registrations
The set of public identifiers, and corresponding resource names for the versions of the configuration file DTDs we know about. |
protected boolean |
validating
Should we use a validating XML parser to read the configuration file. |
Constructor Summary | |
---|---|
DigesterDefinitionsReader()
Creates a new instance of DigesterDefinitionsReader. |
Method Summary | |
---|---|
void |
addDefinition(Definition definition)
Adds a new Definition to the internal Map or replaces
an existing one. |
void |
init(Map<String,String> params)
Initializes the DefinitionsReader object. |
Map<String,Definition> |
read(Object source)
Reads objects from a source. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PARSER_VALIDATE_PARAMETER_NAME
protected Digester digester
Digester
object used to read Definition data
from the source.
protected boolean validating
true
.
protected String[] registrations
Constructor Detail |
---|
public DigesterDefinitionsReader()
Method Detail |
---|
public Map<String,Definition> read(Object source) throws DefinitionsFactoryException
Definition
objects from a source.
Implementations should publish what type of source object is expected.
read
in interface DefinitionsReader
source
- The InputStream
source from which definitions
will be read.
Definition
objects read from
the source.
DefinitionsFactoryException
- if the source is invalid or
an error occurs when reading definitions.public void init(Map<String,String> params) throws DefinitionsFactoryException
DefinitionsReader
object.
This method must be called before the read(java.lang.Object)
method is called.
init
in interface DefinitionsReader
params
- A map of properties used to set up the reader.
DefinitionsFactoryException
- if required properties are not
passed in or the initialization fails.public void addDefinition(Definition definition)
Definition
to the internal Map or replaces
an existing one.
definition
- The Definition object to be added.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |