org.opensaml.xml.validation
Class ValidatorSuite

java.lang.Object
  extended by org.opensaml.xml.validation.ValidatorSuite

public class ValidatorSuite
extends Object

A collection of validators that can be applied to an XMLObject and its children. These collections can represent usage specific checks, such as those outlined in things like profiles for specific XML specification. Registered Validators must be stateless. The xmlObjectTarget may be the XMLObject's element QName retrieved by XMLObject.getElementQName() or schema type, retrieved by XMLObject.getSchemaType(), with schema type registered checks performed first.


Field Summary
private  String id
          Unique ID for this suite.
private  Logger log
          Class logger.
private  Map<QName,List<Validator>> validators
          Validators registered in this suite.
 
Constructor Summary
ValidatorSuite(String suiteId)
          Constructor.
 
Method Summary
 void deregisterValidator(QName xmlObjectTarget, Validator validator)
          Removes a validator from this suite.
 String getId()
          Gets a unique ID for this suite.
 List<Validator> getValidators(QName xmlObjectTarget)
          Gets an immutable list of validators for a given XMLObject target.
private  void performValidation(QName validatorSetKey, XMLObject xmlObject)
          Validates the given XMLObject against the validators registered under the given key.
private  void performValidation(XMLObject xmlObject)
          Validates the given XMLObject.
 void registerValidator(QName xmlObjectTarget, Validator validator)
          Registers a new validator in the suite.
 void validate(XMLObject xmlObject)
          Evaluates the registered validators against the given XMLObject and it's children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private final Logger log
Class logger.


id

private String id
Unique ID for this suite.


validators

private Map<QName,List<Validator>> validators
Validators registered in this suite.

Constructor Detail

ValidatorSuite

public ValidatorSuite(String suiteId)
Constructor.

Parameters:
suiteId - unique ID for this suite
Method Detail

getId

public String getId()
Gets a unique ID for this suite.

Returns:
a unique ID for this suite

validate

public void validate(XMLObject xmlObject)
              throws ValidationException
Evaluates the registered validators against the given XMLObject and it's children.

Parameters:
xmlObject - the XMLObject to validate
Throws:
ValidationException - thrown if the element is not valid

getValidators

public List<Validator> getValidators(QName xmlObjectTarget)
Gets an immutable list of validators for a given XMLObject target.

Parameters:
xmlObjectTarget - the XMLObject the returned list of validators operates on
Returns:
the list of validators for the XMLObject

registerValidator

public void registerValidator(QName xmlObjectTarget,
                              Validator validator)
Registers a new validator in the suite.

Parameters:
validator - the validator
xmlObjectTarget - the XMLObject the validator should operate on

deregisterValidator

public void deregisterValidator(QName xmlObjectTarget,
                                Validator validator)
Removes a validator from this suite.

Parameters:
xmlObjectTarget - the XMLObject the validator is currently registered for
validator - the validator to remove

performValidation

private void performValidation(XMLObject xmlObject)
                        throws ValidationException
Validates the given XMLObject. Does NOT validate its children.

Parameters:
xmlObject - the XMLObject to validate.
Throws:
ValidationException - thrown if the XMLObject does not validate

performValidation

private void performValidation(QName validatorSetKey,
                               XMLObject xmlObject)
                        throws ValidationException
Validates the given XMLObject against the validators registered under the given key.

Parameters:
validatorSetKey - the key to the list of validators
xmlObject - the XMLObject to validate
Throws:
ValidationException - thrown if any validations fail


Copyright © 1999-2012. All Rights Reserved.