|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.schema.SchemaContextTracker
org.jibx.schema.validation.ValidationContext
public class ValidationContext
Tracks the schema validation state. This includes order-dependent state information collected while walking the tree structure of a schema model. Collects all errors and warnings and maintains a summary of the severity of the problems found. For ease of use, this also wraps the schema name register with convenience methods for validation. TODO: separate out a generalized base class and move the base out of the schema package
Field Summary | |
---|---|
private java.util.Set |
m_duplicateNamespaces
Set of namespaces with multiple schemas. |
private int |
m_errorCount
Number of errors reported. |
private int |
m_fatalCount
Number of fatals reported. |
private java.util.Map |
m_idSchemaMap
Map from identifier to schema. |
private java.util.Map |
m_namespaceSchemaMap
Map from namespace URI to schema. |
private java.util.ArrayList |
m_problemList
List of problem items reported by validation. |
private java.util.Set |
m_skipSet
Set of elements to be skipped in walking tree. |
private int |
m_unimplementedCount
Number of unimplementeds reported. |
private int |
m_warningCount
Number of warnings reported. |
private static Logger |
s_logger
Logger for class. |
Fields inherited from class org.jibx.schema.SchemaContextTracker |
---|
m_nameRegister |
Constructor Summary | |
---|---|
ValidationContext()
Constructor. |
Method Summary | |
---|---|
boolean |
addError(java.lang.String msg,
java.lang.Object obj)
Add error item. |
void |
addFatal(java.lang.String msg,
java.lang.Object obj)
Add fatal item. |
void |
addProblem(ValidationProblem problem)
Add problem report. |
protected void |
addSkip(java.lang.Object skip)
Add element to set to be skipped. |
void |
addUnimplemented(java.lang.String msg,
java.lang.Object obj)
Add unimplemented feature item for current element. |
void |
addWarning(java.lang.String msg,
java.lang.Object obj)
Add warning item. |
AttributeElement |
findAttribute(QName qname)
Find global attribute by name. |
AttributeGroupElement |
findAttributeGroup(QName qname)
Find attribute group by name. |
ElementElement |
findElement(QName qname)
Find global element by name. |
GroupElement |
findGroup(QName qname)
Find group by name. |
CommonTypeDefinition |
findType(QName qname)
Find global type by name. |
int |
getErrorCount()
Get number of error problems reported. |
int |
getFatalCount()
Get number of fatal problems reported. |
java.util.ArrayList |
getProblems()
Get list of problems. |
SchemaElement |
getSchemaById(java.lang.String id)
Get schema element by identifier. |
SchemaElement |
getSchemaByNamespace(java.lang.String uri)
Get schema element by target namespace. |
int |
getSchemaCount()
Get the number of schemas processed by this context. |
int |
getUnimplementedCount()
Get number of unimplemented feature problems reported. |
int |
getWarningCount()
Get number of warning problems reported. |
boolean |
isSkipped(java.lang.Object obj)
Check if a component is being skipped due to a fatal error. |
java.util.Iterator |
iterateSchemas()
Get iterator for all schemas defined in this context. |
void |
registerAttribute(QName qname,
AttributeElement def)
Register global attribute in the current schema definition. |
void |
registerAttributeGroup(QName qname,
AttributeGroupElement def)
Register global attribute group in the current schema definition. |
void |
registerElement(QName qname,
ElementElement def)
Register global element in the current schema definition. |
void |
registerGroup(QName qname,
GroupElement def)
Register global group in the current schema definition. |
void |
registerType(QName qname,
CommonTypeDefinition def)
Register global type in the current schema definition. |
boolean |
reportProblems(ProblemHandler handler)
Report problems using handler. |
void |
reset()
Reset context for reuse. |
void |
setSchema(java.lang.String id,
SchemaElement schema)
Add schema element with identifier. |
Methods inherited from class org.jibx.schema.SchemaContextTracker |
---|
clearTraversed, enterSchema, exitSchema, getCurrentSchema, getNameRegister, setNameRegister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger s_logger
private java.util.Map m_idSchemaMap
private java.util.Map m_namespaceSchemaMap
private java.util.Set m_duplicateNamespaces
private int m_unimplementedCount
private int m_warningCount
private int m_errorCount
private int m_fatalCount
private java.util.ArrayList m_problemList
private java.util.Set m_skipSet
Constructor Detail |
---|
public ValidationContext()
Method Detail |
---|
public void reset()
public SchemaElement getSchemaByNamespace(java.lang.String uri)
uri
- unique namespace URI
null
if not loaded or non-unique namespacepublic SchemaElement getSchemaById(java.lang.String id)
id
-
null
if not loadedpublic java.util.Iterator iterateSchemas()
public void setSchema(java.lang.String id, SchemaElement schema)
id
- schema
- public int getSchemaCount()
public int getUnimplementedCount()
public int getWarningCount()
public int getErrorCount()
public int getFatalCount()
public void registerAttribute(QName qname, AttributeElement def)
qname
- namedef
- attribute definitionpublic void registerAttributeGroup(QName qname, AttributeGroupElement def)
qname
- namedef
- attribute definitionpublic void registerElement(QName qname, ElementElement def)
qname
- namedef
- element definitionpublic void registerGroup(QName qname, GroupElement def)
qname
- namedef
- attribute definitionpublic void registerType(QName qname, CommonTypeDefinition def)
qname
- namedef
- attribute definitionpublic AttributeElement findAttribute(QName qname)
qname
- name
null
if not registeredpublic AttributeGroupElement findAttributeGroup(QName qname)
qname
- name
null
if not registeredpublic ElementElement findElement(QName qname)
qname
- name
null
if not registeredpublic GroupElement findGroup(QName qname)
qname
- name
null
if not registeredpublic CommonTypeDefinition findType(QName qname)
qname
- name
null
if not registeredpublic void addUnimplemented(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation errorpublic void addWarning(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation errorpublic boolean addError(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation error
true
if to continue validation, false
if notpublic void addFatal(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation error (should be an element)public void addProblem(ValidationProblem problem)
problem
- details of problem reportpublic java.util.ArrayList getProblems()
protected void addSkip(java.lang.Object skip)
skip
- public boolean reportProblems(ProblemHandler handler)
handler
- problem handler
true
if one or more errors, false
if notpublic boolean isSkipped(java.lang.Object obj)
ISkipElements
isSkipped
in interface ISkipElements
obj
- component to be checked
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |