5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-b27-fcs
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// Any modifications to this file will be lost upon recompilation of the source schema.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// Generated on: 2012.06.11 at 10:34:07 AM PDT
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpackage com.sun.identity.saml2.jaxb.assertion.impl.runtime;
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenkimport javax.xml.bind.helpers.DefaultValidationEventHandler;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reorganize classes into appropriate packages.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk to reflect the fact that some of the classes in
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk the marshaller package are used for both marshalling
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk and validation.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk In particular, the MarshallingContext interface should be
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk renamed. It is not only for marshalling.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk (something like "Serializer", maybe).
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Validator implementation of JAXB RI.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** Validation errors will be reported to this object. */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public ValidatorImpl( DefaultJAXBContextImpl c ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // initialize datatype converter with ours
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk DatatypeConverter.setDatatypeConverter(DatatypeConverterImpl.theInstance);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * We need to know whether an validation error was detected or not.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * For this purpose, we set up the validation so that this interceptor
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * will "intercept" errors before the application receives it.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private static class EventInterceptor implements ValidationEventHandler {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk EventInterceptor( ValidationEventHandler _next ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** event will be passed to this component. */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public boolean handleEvent( ValidationEvent e ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // pass it to the application
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // if the client event handler causes a RuntimeException,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // then we have to return false
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // if no error handler was specified, there is no point
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // in continuing the validation.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public boolean validateRoot( Object o ) throws ValidationException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if( o == null ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk Messages.format( Messages.MUST_NOT_BE_NULL, "rootObj" ) );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return validate(o,true);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public boolean validate( Object o ) throws ValidationException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if( o == null ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk Messages.format( Messages.MUST_NOT_BE_NULL, "subrootObj" ) );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return validate(o,false);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private boolean validate( Object o, boolean validateId )
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //ValidatableObject vo = Util.toValidatableObject(o);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ValidatableObject vo = jaxbContext.getGrammarInfo().castToValidatableObject(o);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk EventInterceptor ei = new EventInterceptor(eventHandler);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ValidationContext context = new ValidationContext(jaxbContext,ei,validateId);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } catch( SAXException e ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // we need a consistent mechanism to convert SAXException into JAXBException
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //return false;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public ValidationEventHandler getEventHandler() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void setEventHandler( ValidationEventHandler handler ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk eventHandler = new DefaultValidationEventHandler();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * There are no required properties, so simply throw an exception. Other
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * providers may have support for properties on Validator, but the RI doesn't
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void setProperty( String name, Object value )
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * There are no required properties, so simply throw an exception. Other
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * providers may have support for properties on Validator, but the RI doesn't