Class InputProcessorChainImpl
- java.lang.Object
-
- org.apache.xml.security.stax.impl.InputProcessorChainImpl
-
- All Implemented Interfaces:
InputProcessorChain
,ProcessorChain
public class InputProcessorChainImpl extends java.lang.Object implements InputProcessorChain
Implementation of a InputProcessorChain
-
-
Field Summary
Fields Modifier and Type Field Description private int
curPos
private DocumentContextImpl
documentContext
private InboundSecurityContext
inboundSecurityContext
private java.util.List<InputProcessor>
inputProcessors
protected static org.slf4j.Logger
LOG
private int
startPos
-
Constructor Summary
Constructors Modifier Constructor Description InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext)
InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, int startPos)
InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, DocumentContextImpl documentContext)
protected
InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, DocumentContextImpl documentContextImpl, int startPos, java.util.List<InputProcessor> inputProcessors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProcessor(InputProcessor newInputProcessor)
Adds an InputProcessor to the chain.InputProcessorChain
createSubChain(InputProcessor inputProcessor)
Create a new SubChain.InputProcessorChain
createSubChain(InputProcessor inputProcessor, boolean clone)
Create a new SubChain.void
doFinal()
Will finally be called when the whole document is processed Important note: Every processor in the chain has to call doFinal() in its own doFinal() method.DocumentContext
getDocumentContext()
The actual processed document's document contextjava.util.List<InputProcessor>
getProcessors()
Returns a list with the active processors.InboundSecurityContext
getSecurityContext()
The actual processed document's security contextXMLSecEvent
processEvent()
Requests the next XMLEvent from the next processor in the chain.XMLSecEvent
processHeaderEvent()
Requests the next security header XMLEvent from the next processor in the chain.void
removeProcessor(InputProcessor inputProcessor)
Removes the specified InputProcessor from this chain.void
reset()
resets the chain so that the next event will go again to the first processor in the chain.
-
-
-
Field Detail
-
LOG
protected static final transient org.slf4j.Logger LOG
-
inputProcessors
private java.util.List<InputProcessor> inputProcessors
-
startPos
private int startPos
-
curPos
private int curPos
-
inboundSecurityContext
private final InboundSecurityContext inboundSecurityContext
-
documentContext
private final DocumentContextImpl documentContext
-
-
Constructor Detail
-
InputProcessorChainImpl
public InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext)
-
InputProcessorChainImpl
public InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, int startPos)
-
InputProcessorChainImpl
public InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, DocumentContextImpl documentContext)
-
InputProcessorChainImpl
protected InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, DocumentContextImpl documentContextImpl, int startPos, java.util.List<InputProcessor> inputProcessors)
-
-
Method Detail
-
reset
public void reset()
Description copied from interface:ProcessorChain
resets the chain so that the next event will go again to the first processor in the chain.- Specified by:
reset
in interfaceProcessorChain
-
getSecurityContext
public InboundSecurityContext getSecurityContext()
Description copied from interface:InputProcessorChain
The actual processed document's security context- Specified by:
getSecurityContext
in interfaceInputProcessorChain
- Returns:
- The InboundSecurityContext
-
getDocumentContext
public DocumentContext getDocumentContext()
Description copied from interface:InputProcessorChain
The actual processed document's document context- Specified by:
getDocumentContext
in interfaceInputProcessorChain
- Returns:
- The DocumentContext
-
addProcessor
public void addProcessor(InputProcessor newInputProcessor)
Description copied from interface:InputProcessorChain
Adds an InputProcessor to the chain. The place where it will be applied can be controlled through the Phase, getBeforeProcessors and getAfterProcessors. @see Interface InputProcessor- Specified by:
addProcessor
in interfaceInputProcessorChain
- Parameters:
newInputProcessor
- The InputProcessor which should be placed in the chain
-
removeProcessor
public void removeProcessor(InputProcessor inputProcessor)
Description copied from interface:InputProcessorChain
Removes the specified InputProcessor from this chain.- Specified by:
removeProcessor
in interfaceInputProcessorChain
- Parameters:
inputProcessor
- to remove
-
getProcessors
public java.util.List<InputProcessor> getProcessors()
Description copied from interface:InputProcessorChain
Returns a list with the active processors.- Specified by:
getProcessors
in interfaceInputProcessorChain
- Returns:
- a list with the active processors
-
processHeaderEvent
public XMLSecEvent processHeaderEvent() throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessorChain
Requests the next security header XMLEvent from the next processor in the chain.- Specified by:
processHeaderEvent
in interfaceInputProcessorChain
- Returns:
- The next XMLEvent from the previous processor
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
processEvent
public XMLSecEvent processEvent() throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessorChain
Requests the next XMLEvent from the next processor in the chain.- Specified by:
processEvent
in interfaceInputProcessorChain
- Returns:
- The next XMLEvent from the previous processor
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
doFinal
public void doFinal() throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:ProcessorChain
Will finally be called when the whole document is processed Important note: Every processor in the chain has to call doFinal() in its own doFinal() method. InputProcessors should call it before doing other stuff to keep the processing order. Remember the input-chain is in principle processed in the reverse order since we "leech" the events through the chain. So that means that we should do the same for the doFinal method, otherwise we may run into troubles.- Specified by:
doFinal
in interfaceProcessorChain
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
createSubChain
public InputProcessorChain createSubChain(InputProcessor inputProcessor) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessorChain
Create a new SubChain. The XMLEvents will be only be processed from the given InputProcessor to the end. All earlier InputProcessors don't get these events. In other words the chain will be splitted in two parts. The associated DocumentContext will be cloned.- Specified by:
createSubChain
in interfaceInputProcessorChain
- Parameters:
inputProcessor
- The InputProcessor position the XMLEvents should be processed over this SubChain.- Returns:
- A new InputProcessorChain
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
createSubChain
public InputProcessorChain createSubChain(InputProcessor inputProcessor, boolean clone) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessorChain
Create a new SubChain. The XMLEvents will be only be processed from the given InputProcessor to the end. All earlier InputProcessors don't get these events. In other words the chain will be splitted in two parts. The parameter clone controls if the associated DocumentContext should be cloned or reference the existing one.- Specified by:
createSubChain
in interfaceInputProcessorChain
- Parameters:
inputProcessor
- The InputProcessor position the XMLEvents should be processed over this SubChain.clone
- if true the associated DocumentContext will be cloned otherwise the DocumentContext will be referenced.- Returns:
- A new InputProcessorChain
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
-