Package net.shibboleth.metadata.dom
Class ElementsStrippingStage
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<T>
net.shibboleth.metadata.pipeline.AbstractIteratingStage<Element>
net.shibboleth.metadata.dom.AbstractDOMTraversalStage<ElementsStrippingStage.Context>
net.shibboleth.metadata.dom.ElementsStrippingStage
- All Implemented Interfaces:
Stage<Element>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
@ThreadSafe
public class ElementsStrippingStage
extends AbstractDOMTraversalStage<ElementsStrippingStage.Context>
A stage which removes all instances of the specified elements from DOM metadata.
The elements to be removed are specified by the combination of a namespace
(as in ElementStrippingStage) and a collection of names.
The stage ignores all elements not in the specified namespace.
If an element is in the specified namespace, it is by default removed if its local name is in the specified list of names.
The default behaviour can be changed if the keeping property
is set. In this case, the stage still ignores any elements not in the specified
namespace, but elements within that namespace will be removed if their local names
do not appear in the collection of names.
- Since:
- 0.10.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classContext class for this kind of traversal. -
Field Summary
FieldsModifier and TypeFieldDescriptionNames of the elements to strip.private StringNamespace of the elements to strip.private booleanWhether we are keeping the designaed elements (falseby default). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanapplicable(Element element, ElementsStrippingStage.Context context) Indicates whether the visitor should be applied to a particularElement.protected ElementsStrippingStage.ContextbuildContext(Item<Element> item) Build the context for a particular traversal.protected voidfinal Collection<String>Get the names of the elements to strip.final StringGet the namespace of the elements to strip.booleanIndicates whether the designated elements are being kept or removed.voidsetElementNames(Collection<String> names) Set the names of the elements to strip.voidsetElementNamespace(String namespace) Set the namespace of the elements to strip.voidsetKeeping(boolean keep) Set whether the designated elements are to be kept.protected voidvisit(Element element, ElementsStrippingStage.Context context) Visit a particularElement.Methods inherited from class net.shibboleth.metadata.dom.AbstractDOMTraversalStage
addError, doExecute, errorPrefixMethods inherited from class net.shibboleth.metadata.pipeline.AbstractIteratingStage
doExecuteMethods inherited from class net.shibboleth.metadata.pipeline.AbstractStage
execute, getCollectionPredicate, setCollectionPredicateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
elementNamespace
Namespace of the elements to strip. -
elementNames
Names of the elements to strip. -
keeping
private boolean keepingWhether we are keeping the designaed elements (falseby default).
-
-
Constructor Details
-
ElementsStrippingStage
public ElementsStrippingStage()
-
-
Method Details
-
getElementNamespace
Get the namespace of the elements to strip.- Returns:
- namespace of the elements to strip
-
setElementNamespace
Set the namespace of the elements to strip.- Parameters:
namespace- namespace of the elements to strip
-
getElementNames
Get the names of the elements to strip.- Returns:
- the names of the elements to strip
-
setElementNames
public void setElementNames(@Nonnull @NonnullElements @Unmodifiable @NotEmpty Collection<String> names) Set the names of the elements to strip.- Parameters:
names- the names of the elements to strip
-
setKeeping
public void setKeeping(boolean keep) Set whether the designated elements are to be kept. The default behaviour is for the designated elements to be removed.- Parameters:
keep-trueif the designated elements are to be keot
-
isKeeping
public boolean isKeeping()Indicates whether the designated elements are being kept or removed.- Returns:
trueif the designated elements are being kept
-
applicable
protected boolean applicable(@Nonnull Element element, @Nonnull ElementsStrippingStage.Context context) Description copied from class:AbstractDOMTraversalStageIndicates whether the visitor should be applied to a particularElement.- Specified by:
applicablein classAbstractDOMTraversalStage<ElementsStrippingStage.Context>- Parameters:
element-Elementto which we may wish to apply the visitorcontext-DOMTraversalContextimplementation being used to manage the traversal- Returns:
trueif the visitor should be applied to thisElement.
-
visit
Description copied from class:AbstractDOMTraversalStageVisit a particularElement.- Specified by:
visitin classAbstractDOMTraversalStage<ElementsStrippingStage.Context>- Parameters:
element- theElementto visitcontext- the traversal context
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-
buildContext
Description copied from class:AbstractDOMTraversalStageBuild the context for a particular traversal.- Specified by:
buildContextin classAbstractDOMTraversalStage<ElementsStrippingStage.Context>- Parameters:
item- theItemwe are traversing- Returns:
- an appropriate context
-