|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.components.validation.impl.AbstractValidator org.apache.cocoon.components.validation.impl.DefaultValidator org.apache.cocoon.components.validation.impl.CachingValidator
public class CachingValidator
An extension of the DefaultValidator
class allowing Schema
instances to be cached.
The getSchema(SchemaParser, Source, String)
method will manage
whether to return a cached or a freshly parsed Schema
instance.
Field Summary |
---|
Fields inherited from class org.apache.cocoon.components.validation.impl.AbstractValidator |
---|
logger, manager, resolver |
Fields inherited from interface org.apache.cocoon.components.validation.Validator |
---|
GRAMMAR_ISO_SCHEMATRON, GRAMMAR_RELAX_CORE, GRAMMAR_RELAX_NG, GRAMMAR_RELAX_NS, GRAMMAR_SCHEMATRON, GRAMMAR_TREX, GRAMMAR_XML_DTD, GRAMMAR_XML_SCHEMA, ROLE |
Constructor Summary | |
---|---|
CachingValidator()
Create a new CachingValidator instance. |
Method Summary | |
---|---|
protected String |
detectGrammar(Source source)
Attempt to detect the grammar language used by the schema identified by the specified Source . |
void |
dispose()
Dispose this component instance. |
Schema |
getSchema(SchemaParser parser,
Source source,
String grammar)
Return a Schema instance from the specified SchemaParser
associated with the given Source and grammar language. |
void |
initialize()
Initialize this component instance. |
Methods inherited from class org.apache.cocoon.components.validation.impl.DefaultValidator |
---|
configure, contextualize, isSelectable, lookupParserByGrammar, lookupParserByName, release, releaseParser, select |
Methods inherited from class org.apache.cocoon.components.validation.impl.AbstractValidator |
---|
enableLogging, getValidationHandler, getValidationHandler, getValidationHandler, getValidationHandler, getValidationHandler, getValidationHandler, getValidationHandler, getValidationHandler, service |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CachingValidator()
Create a new CachingValidator
instance.
Method Detail |
---|
public void initialize() throws Exception
Initialize this component instance.
initialize
in interface Initializable
initialize
in class DefaultValidator
Exception
public void dispose()
Dispose this component instance.
dispose
in interface Disposable
dispose
in class DefaultValidator
public Schema getSchema(SchemaParser parser, Source source, String grammar) throws IOException, SAXException
Return a Schema
instance from the specified SchemaParser
associated with the given Source
and grammar language.
This method will overriding the default behaviour specified by the
AbstractValidator.getSchema(SchemaParser, Source, String)
method,
and supports cacheability of Schema
instances through the use of
a Store
looked up using the Store.TRANSIENT_STORE
Avalon
role.
Cached Schema
instances will be retained in the configured
Store
until the checks on the validity obtained calling the
Schema.getValidity()
method will declare that the schema is still
valid.
getSchema
in class AbstractValidator
parser
- the SchemaParser
producing the Schema
.source
- the Source
associated with the Schema
to return.grammar
- the grammar language of the schema to produce.
SAXException
- if a grammar error occurred parsing the schema.
IOException
- if an I/O error occurred parsing the schema.protected String detectGrammar(Source source) throws IOException, SAXException, ValidatorException
Attempt to detect the grammar language used by the schema identified
by the specified Source
.
The grammar languages detected will be cached until the Source
's
SourceValidity
declares that the schema is valid.
detectGrammar
in class AbstractValidator
source
- a Source
instance pointing to the schema to be analyzed.
IOException
- if an I/O error occurred accessing the schema.
SAXException
- if an error occurred parsing the schema.
ValidatorException
- if the language of the schema could not be guessed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |