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 intcurPosprivate DocumentContextImpldocumentContextprivate InboundSecurityContextinboundSecurityContextprivate java.util.List<InputProcessor>inputProcessorsprotected static org.slf4j.LoggerLOGprivate intstartPos
-
Constructor Summary
Constructors Modifier Constructor Description InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext)InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, int startPos)InputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, DocumentContextImpl documentContext)protectedInputProcessorChainImpl(InboundSecurityContext inboundSecurityContext, DocumentContextImpl documentContextImpl, int startPos, java.util.List<InputProcessor> inputProcessors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProcessor(InputProcessor newInputProcessor)Adds an InputProcessor to the chain.InputProcessorChaincreateSubChain(InputProcessor inputProcessor)Create a new SubChain.InputProcessorChaincreateSubChain(InputProcessor inputProcessor, boolean clone)Create a new SubChain.voiddoFinal()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.DocumentContextgetDocumentContext()The actual processed document's document contextjava.util.List<InputProcessor>getProcessors()Returns a list with the active processors.InboundSecurityContextgetSecurityContext()The actual processed document's security contextXMLSecEventprocessEvent()Requests the next XMLEvent from the next processor in the chain.XMLSecEventprocessHeaderEvent()Requests the next security header XMLEvent from the next processor in the chain.voidremoveProcessor(InputProcessor inputProcessor)Removes the specified InputProcessor from this chain.voidreset()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:ProcessorChainresets the chain so that the next event will go again to the first processor in the chain.- Specified by:
resetin interfaceProcessorChain
-
getSecurityContext
public InboundSecurityContext getSecurityContext()
Description copied from interface:InputProcessorChainThe actual processed document's security context- Specified by:
getSecurityContextin interfaceInputProcessorChain- Returns:
- The InboundSecurityContext
-
getDocumentContext
public DocumentContext getDocumentContext()
Description copied from interface:InputProcessorChainThe actual processed document's document context- Specified by:
getDocumentContextin interfaceInputProcessorChain- Returns:
- The DocumentContext
-
addProcessor
public void addProcessor(InputProcessor newInputProcessor)
Description copied from interface:InputProcessorChainAdds 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:
addProcessorin interfaceInputProcessorChain- Parameters:
newInputProcessor- The InputProcessor which should be placed in the chain
-
removeProcessor
public void removeProcessor(InputProcessor inputProcessor)
Description copied from interface:InputProcessorChainRemoves the specified InputProcessor from this chain.- Specified by:
removeProcessorin interfaceInputProcessorChain- Parameters:
inputProcessor- to remove
-
getProcessors
public java.util.List<InputProcessor> getProcessors()
Description copied from interface:InputProcessorChainReturns a list with the active processors.- Specified by:
getProcessorsin interfaceInputProcessorChain- Returns:
- a list with the active processors
-
processHeaderEvent
public XMLSecEvent processHeaderEvent() throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessorChainRequests the next security header XMLEvent from the next processor in the chain.- Specified by:
processHeaderEventin 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:InputProcessorChainRequests the next XMLEvent from the next processor in the chain.- Specified by:
processEventin 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, XMLSecurityExceptionDescription copied from interface:ProcessorChainWill 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:
doFinalin 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:InputProcessorChainCreate 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:
createSubChainin 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:InputProcessorChainCreate 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:
createSubChainin 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
-
-