net.shibboleth.metadata.dom
Class XMLSchemaValidationStage

java.lang.Object
  extended by net.shibboleth.metadata.pipeline.AbstractComponent
      extended by net.shibboleth.metadata.pipeline.BaseStage<ItemType>
          extended by net.shibboleth.metadata.pipeline.BaseIteratingStage<DomElementItem>
              extended by net.shibboleth.metadata.dom.XMLSchemaValidationStage
All Implemented Interfaces:
Component, Stage<DomElementItem>

@ThreadSafe
public class XMLSchemaValidationStage
extends BaseIteratingStage<DomElementItem>

A pipeline stage that XML schema validates the elements within the DomElementItem collection.

This stage requires the following properties be set prior to initialization:

If DOM Elements are required to be valid, per isElementRequiredToBeSchemaValid() and an Element is found to be invalid than an ErrorStatus object is set on the element. If the Element is not required to be valid and an Element is found to be invalid than an WarningStatus is set on the Element.


Field Summary
private  boolean elementRequiredToBeSchemaValid
          Whether Elements are required to be schema valid.
private  Logger log
          Class logger.
private  List<org.opensaml.util.resource.Resource> schemaResources
          Collection of schema resources.
private  Schema validationSchema
          Schema used to validate Elements.
 
Constructor Summary
XMLSchemaValidationStage()
           
 
Method Summary
protected  boolean doExecute(DomElementItem item)
          Processes a given Item.
protected  void doInitialize()
          Do the initialization of the component.
 List<org.opensaml.util.resource.Resource> getSchemaResources()
          Gets an unmodifiable list of schema resources against which Elements are validated.
 boolean isElementRequiredToBeSchemaValid()
          Gets whether Elements are required to be schema valid.
 void setElementRequiredToBeSchemaValid(boolean isRequired)
          Sets whether Elements are required to be schema valid.
 void setSchemaResources(List<org.opensaml.util.resource.Resource> resources)
          Sets the schema resources against which Elements are validated.
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseIteratingStage
doExecute
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage
execute
 
Methods inherited from class net.shibboleth.metadata.pipeline.AbstractComponent
equals, getId, getInitializationInstant, hashCode, initialize, isInitialized, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.shibboleth.metadata.pipeline.Component
getId, getInitializationInstant, initialize, isInitialized
 

Field Detail

log

private final Logger log
Class logger.


schemaResources

private List<org.opensaml.util.resource.Resource> schemaResources
Collection of schema resources.


elementRequiredToBeSchemaValid

private boolean elementRequiredToBeSchemaValid
Whether Elements are required to be schema valid. Default value: true


validationSchema

private Schema validationSchema
Schema used to validate Elements.

Constructor Detail

XMLSchemaValidationStage

public XMLSchemaValidationStage()
Method Detail

getSchemaResources

public List<org.opensaml.util.resource.Resource> getSchemaResources()
Gets an unmodifiable list of schema resources against which Elements are validated.

Returns:
unmodifiable list of schema resources against which Elements are validated

setSchemaResources

public void setSchemaResources(List<org.opensaml.util.resource.Resource> resources)
Sets the schema resources against which Elements are validated.

Parameters:
resources - schema resources against which Elements are validated

isElementRequiredToBeSchemaValid

public boolean isElementRequiredToBeSchemaValid()
Gets whether Elements are required to be schema valid.

Returns:
whether Elements are required to be schema valid

setElementRequiredToBeSchemaValid

public void setElementRequiredToBeSchemaValid(boolean isRequired)
Sets whether Elements are required to be schema valid.

Parameters:
isRequired - whether Elements are required to be schema valid

doExecute

protected boolean doExecute(DomElementItem item)
                     throws StageProcessingException
Processes a given Item.

Specified by:
doExecute in class BaseIteratingStage<DomElementItem>
Parameters:
item - Item on which to operate
Returns:
true if the Item should be retained in the collection, false if not
Throws:
StageProcessingException - thrown if there is a problem with the stage processing

doInitialize

protected void doInitialize()
                     throws ComponentInitializationException
Do the initialization of the component. Default implementation of this method is a no-op. Extending classes should override this method to perform any initialization logic necessary.

Overrides:
doInitialize in class AbstractComponent
Throws:
ComponentInitializationException - throw if there is a problem initializing the component


Copyright © 2009-2011. All Rights Reserved.