net.shibboleth.metadata.dom
Class NamespaceStrippingStage

java.lang.Object
  extended by net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
      extended by net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
          extended by net.shibboleth.metadata.pipeline.BaseStage<DomElementItem>
              extended by net.shibboleth.metadata.dom.NamespaceStrippingStage
All Implemented Interfaces:
Stage<DomElementItem>, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.IdentifiableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent

@ThreadSafe
public class NamespaceStrippingStage
extends BaseStage<DomElementItem>

A stage which removes all evidence of a given XML namespace from each metadata item.


Field Summary
private  Logger log
          Class logger.
private  String namespace
          XML namespace to remove.
 
Constructor Summary
NamespaceStrippingStage()
           
 
Method Summary
protected  void doDestroy()
          
protected  void doExecute(Collection<DomElementItem> items)
          Performs the stage processing on the given Item collection.
protected  void doInitialize()
          
 String getNamespace()
          Gets the namespace being checked for.
private  void processAttributes(Element element)
          Process the attributes on an element.
private  void processElement(Element element, int depth)
          Process an individual DOM element.
private  void processItem(DomElementItem item)
          Processes the given DomElementItem.
 void setNamespace(String ns)
          Sets the namespace to check for.
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage
execute, setId
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
getId
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
destroy, initialize, isDestroyed, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiableComponent
getId
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
 

Field Detail

log

private final Logger log
Class logger.


namespace

private String namespace
XML namespace to remove.

Constructor Detail

NamespaceStrippingStage

public NamespaceStrippingStage()
Method Detail

getNamespace

@Nullable
public String getNamespace()
Gets the namespace being checked for.

Returns:
namespace URI

setNamespace

public void setNamespace(@Nonnull@NotEmpty
                         String ns)
Sets the namespace to check for.

Parameters:
ns - namespace URI as a string

processItem

private void processItem(@Nonnull
                         DomElementItem item)
Processes the given DomElementItem.

Parameters:
item - DomElementItem to process.

processAttributes

private void processAttributes(@Nonnull
                               Element element)
Process the attributes on an element. Assumes that the element itself does not reside in the target namespace, and that all child elements have already been processed.

Parameters:
element - the Element to process

processElement

private void processElement(@Nonnull
                            Element element,
                            int depth)
Process an individual DOM element.

Parameters:
element - element to process
depth - processing depth, starting with 0 for the document element.

doExecute

protected void doExecute(@Nonnull@NonnullElements
                         Collection<DomElementItem> items)
                  throws StageProcessingException
Performs the stage processing on the given Item collection.

The stage is guaranteed to be have been initialized and not destroyed when this is invoked.

Specified by:
doExecute in class BaseStage<DomElementItem>
Parameters:
items - collection to be processed
Throws:
StageProcessingException - thrown if there is an unrecoverable problem when processing the stage

doDestroy

protected void doDestroy()

Overrides:
doDestroy in class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent

doInitialize

protected void doInitialize()
                     throws net.shibboleth.utilities.java.support.component.ComponentInitializationException

Overrides:
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
Throws:
net.shibboleth.utilities.java.support.component.ComponentInitializationException


Copyright © 1999-2012. All Rights Reserved.