uk.org.ogsadai.common
Class DocumentValidator
java.lang.Object
|
+--uk.org.ogsadai.common.DocumentValidator
- Direct Known Subclasses:
- ActivityClassDocumentValidator, ActivityPropertyDocumentValidator, ConfigurableActivitiesDocumentValidator, SchemaDocumentValidator, UnknownActivityDocumentValidator
- public abstract class DocumentValidator
- extends java.lang.Object
A DocumentValidator
validates a Document
in an application-specific way.
The class throws a DocumentValidationException
with a
descriptive error message if it is deemed invalid. This abstract
base class uses a variation of the Chain of Command design
pattern, so a sequence of document validators can be chained
together using the setSuccessor
method. The document
passed to the first document validator's validate
method will then pass along the chain until either a
DocumentValidationException
is raised or the end of
the chain is reached. Implementation classes must implement the
abstract performValidation
method.
- Author:
- The OGSA-DAI Project Team
Method Summary |
protected abstract void |
performValidation(org.w3c.dom.Document doc)
Validates the specified document and throws a
DocumentValidationException with a desctiptive
error message if the document is invalid. |
void |
setSuccessor(DocumentValidator validator)
Sets the next DocumentValidator in the chain. |
void |
validate(org.w3c.dom.Document doc)
Validates the specified document then, if an exception has not
been raised, passes it on to the next document validator in the
chain, if the end of the chain has not been reached. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
- See Also:
- Constant Field Values
LOG
private static final DAILogger LOG
mSuccessor
private DocumentValidator mSuccessor
DocumentValidator
public DocumentValidator()
setSuccessor
public final void setSuccessor(DocumentValidator validator)
- Sets the next
DocumentValidator
in the chain.
- Parameters:
validator
- A DocumentValidator
.
validate
public final void validate(org.w3c.dom.Document doc)
throws DocumentValidationException
- Validates the specified document then, if an exception has not
been raised, passes it on to the next document validator in the
chain, if the end of the chain has not been reached.
- Parameters:
doc
- The document to validate.
- Throws:
DocumentValidationException
- if the document is
invalid.
performValidation
protected abstract void performValidation(org.w3c.dom.Document doc)
throws DocumentValidationException
- Validates the specified document and throws a
DocumentValidationException
with a desctiptive
error message if the document is invalid.
- Parameters:
doc
- Document to validate.
- Throws:
DocumentValidationException
- if the document is
invalid.