edu.ksi.virtualclassroom.mappers.jaxb.xmlwrapper.impl.runtime
Class ValidationContext

java.lang.Object
  extended byedu.ksi.virtualclassroom.mappers.jaxb.xmlwrapper.impl.runtime.ValidationContext

class ValidationContext
extends java.lang.Object

Maintains information that needs to be stored across * validations of multiple objects. * * Specifically, this object is responsible for: * *

    *
  1. detecting a cycle in a content tree by keeping track of * objects that were validated. * *
  2. keeping an instance of NamespaceContextImpl, which is * shared by all MSVValidators. * *
  3. keeping a reference to ValidationErrorHandler. * MSVValidators should use this error handler to report any error. *
* @author Administrator * @version $Revision$


Field Summary
private  javax.xml.bind.ValidationEventHandler eventHandler
          Field eventHandler
private  java.util.HashMap IDREFs
          Field IDREFs
private  java.util.HashSet IDs
          Field IDs
(package private)  DefaultJAXBContextImpl jaxbContext
          Field jaxbContext
private  NamespaceContextImpl nsContext
          namespace context.
private  java.util.HashSet validatedObjects
          Set of all validated objects.
private  boolean validateID
          ID/IDREF validation is done only when this flag is true.
 
Constructor Summary
(package private) ValidationContext(DefaultJAXBContextImpl _context, javax.xml.bind.ValidationEventHandler _eventHandler, boolean validateID)
           
 
Method Summary
 NamespaceContextImpl getNamespaceContext()
          Method getNamespaceContext
 java.lang.String onID(XMLSerializable owner, java.lang.String value)
          Method onID
 java.lang.String onIDREF(XMLSerializable referer, java.lang.String value)
          Method onIDREF
protected  void reconcileIDs()
          Tests if all IDREFs have corresponding IDs.
 void reportEvent(ValidatableObject source, java.lang.Exception nestedException)
          Reports an error to the client.
 void reportEvent(ValidatableObject source, java.lang.String formattedMessage)
          Reports an error to the application.
 void reportEvent(ValidatableObject source, javax.xml.bind.ValidationEvent event)
          Method reportEvent
 void validate(ValidatableObject vo)
          Validates the sub-tree rooted at vo and reports any errors/warnings to the error handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jaxbContext

final DefaultJAXBContextImpl jaxbContext
Field jaxbContext


validatedObjects

private final java.util.HashSet validatedObjects
Set of all validated objects. Used to detect a cycle.


nsContext

private final NamespaceContextImpl nsContext
namespace context.


validateID

private final boolean validateID
ID/IDREF validation is done only when this flag is true.


IDs

private final java.util.HashSet IDs
Field IDs


IDREFs

private final java.util.HashMap IDREFs
Field IDREFs


eventHandler

private final javax.xml.bind.ValidationEventHandler eventHandler
Field eventHandler

Constructor Detail

ValidationContext

ValidationContext(DefaultJAXBContextImpl _context,
                  javax.xml.bind.ValidationEventHandler _eventHandler,
                  boolean validateID)
Parameters:
_context - DefaultJAXBContextImpl
_eventHandler - ValidationEventHandler
validateID - if true, ID/IDREF validation will be performed.
Method Detail

validate

public void validate(ValidatableObject vo)
              throws org.xml.sax.SAXException
Validates the sub-tree rooted at vo and reports any errors/warnings to the error handler.

Parameters:
vo - ValidatableObject
Throws:
org.xml.sax.SAXException

getNamespaceContext

public NamespaceContextImpl getNamespaceContext()
Method getNamespaceContext

Returns:
NamespaceContextImpl

onID

public java.lang.String onID(XMLSerializable owner,
                             java.lang.String value)
                      throws org.xml.sax.SAXException
Method onID

Parameters:
owner - XMLSerializable
value - String
Returns:
String
Throws:
org.xml.sax.SAXException

onIDREF

public java.lang.String onIDREF(XMLSerializable referer,
                                java.lang.String value)
                         throws org.xml.sax.SAXException
Method onIDREF

Parameters:
referer - XMLSerializable
value - String
Returns:
String
Throws:
org.xml.sax.SAXException

reconcileIDs

protected void reconcileIDs()
                     throws org.xml.sax.SAXException
Tests if all IDREFs have corresponding IDs. * @throws SAXException

Throws:
org.xml.sax.SAXException

reportEvent

public void reportEvent(ValidatableObject source,
                        java.lang.String formattedMessage)
                 throws com.sun.xml.bind.serializer.AbortSerializationException
Reports an error to the application.

Parameters:
source - ValidatableObject
formattedMessage - String
Throws:
com.sun.xml.bind.serializer.AbortSerializationException

reportEvent

public void reportEvent(ValidatableObject source,
                        java.lang.Exception nestedException)
                 throws com.sun.xml.bind.serializer.AbortSerializationException
Reports an error to the client. This version should be used when an exception is thrown from sub-modules.

Parameters:
source - ValidatableObject
nestedException - Exception
Throws:
com.sun.xml.bind.serializer.AbortSerializationException

reportEvent

public void reportEvent(ValidatableObject source,
                        javax.xml.bind.ValidationEvent event)
                 throws com.sun.xml.bind.serializer.AbortSerializationException
Method reportEvent

Parameters:
source - ValidatableObject
event - ValidationEvent
Throws:
com.sun.xml.bind.serializer.AbortSerializationException