Class OutputProcessorChainImpl
- java.lang.Object
-
- org.apache.xml.security.stax.impl.OutputProcessorChainImpl
-
- All Implemented Interfaces:
OutputProcessorChain,ProcessorChain
public class OutputProcessorChainImpl extends java.lang.Object implements OutputProcessorChain
Implementation of a OutputProcessorChain
-
-
Field Summary
Fields Modifier and Type Field Description private intcurPosprivate DocumentContextImpldocumentContextprotected static org.slf4j.LoggerLOGprivate OutboundSecurityContextoutboundSecurityContextprivate java.util.List<OutputProcessor>outputProcessorsprivate XMLSecStartElementparentXmlSecStartElementprivate intstartPos
-
Constructor Summary
Constructors Modifier Constructor Description OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext)OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext, int startPos)OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext, DocumentContextImpl documentContext)protectedOutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext, DocumentContextImpl documentContextImpl, int startPos, java.util.List<OutputProcessor> outputProcessors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProcessor(OutputProcessor newOutputProcessor)Adds an OutputProcessor to the chain.OutputProcessorChaincreateSubChain(OutputProcessor outputProcessor)Create a new SubChain.OutputProcessorChaincreateSubChain(OutputProcessor outputProcessor, XMLSecStartElement parentXMLSecStartElement)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<OutputProcessor>getProcessors()Returns a list with the active processors.OutboundSecurityContextgetSecurityContext()The actual processed document's security contextvoidprocessEvent(XMLSecEvent xmlSecEvent)Forwards the XMLEvent to the next processor in the chain.voidremoveProcessor(OutputProcessor outputProcessor)Removes the specified OutputProcessor from this chain.voidreset()resets the chain so that the next event will go again to the first processor in the chain.private voidsetParentXmlSecStartElement(XMLSecStartElement xmlSecStartElement)
-
-
-
Field Detail
-
LOG
protected static final transient org.slf4j.Logger LOG
-
outputProcessors
private java.util.List<OutputProcessor> outputProcessors
-
startPos
private int startPos
-
curPos
private int curPos
-
parentXmlSecStartElement
private XMLSecStartElement parentXmlSecStartElement
-
outboundSecurityContext
private final OutboundSecurityContext outboundSecurityContext
-
documentContext
private final DocumentContextImpl documentContext
-
-
Constructor Detail
-
OutputProcessorChainImpl
public OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext)
-
OutputProcessorChainImpl
public OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext, int startPos)
-
OutputProcessorChainImpl
public OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext, DocumentContextImpl documentContext)
-
OutputProcessorChainImpl
protected OutputProcessorChainImpl(OutboundSecurityContext outboundSecurityContext, DocumentContextImpl documentContextImpl, int startPos, java.util.List<OutputProcessor> outputProcessors)
-
-
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 OutboundSecurityContext getSecurityContext()
Description copied from interface:OutputProcessorChainThe actual processed document's security context- Specified by:
getSecurityContextin interfaceOutputProcessorChain- Returns:
- The InboundSecurityContext
-
getDocumentContext
public DocumentContext getDocumentContext()
Description copied from interface:OutputProcessorChainThe actual processed document's document context- Specified by:
getDocumentContextin interfaceOutputProcessorChain- Returns:
- The DocumentContext
-
addProcessor
public void addProcessor(OutputProcessor newOutputProcessor)
Description copied from interface:OutputProcessorChainAdds an OutputProcessor to the chain. The place where it will be applied can be controlled through the Phase, getBeforeProcessors and getAfterProcessors. @see Interface OutputProcessor- Specified by:
addProcessorin interfaceOutputProcessorChain- Parameters:
newOutputProcessor- The OutputProcessor which should be placed in the chain
-
removeProcessor
public void removeProcessor(OutputProcessor outputProcessor)
Description copied from interface:OutputProcessorChainRemoves the specified OutputProcessor from this chain.- Specified by:
removeProcessorin interfaceOutputProcessorChain- Parameters:
outputProcessor- to remove
-
getProcessors
public java.util.List<OutputProcessor> getProcessors()
Description copied from interface:OutputProcessorChainReturns a list with the active processors.- Specified by:
getProcessorsin interfaceOutputProcessorChain- Returns:
- a list with the active processors
-
setParentXmlSecStartElement
private void setParentXmlSecStartElement(XMLSecStartElement xmlSecStartElement)
-
processEvent
public void processEvent(XMLSecEvent xmlSecEvent) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:OutputProcessorChainForwards the XMLEvent to the next processor in the chain.- Specified by:
processEventin interfaceOutputProcessorChain- Parameters:
xmlSecEvent- The XMLEvent which should be forwarded to the next 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 OutputProcessorChain createSubChain(OutputProcessor outputProcessor) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:OutputProcessorChainCreate a new SubChain. The XMLEvents will be only be processed from the given OutputProcessor to the end. All earlier OutputProcessors don't get these events. In other words the chain will be splitted in two parts.- Specified by:
createSubChainin interfaceOutputProcessorChain- Parameters:
outputProcessor- The OutputProcessor position the XMLEvents should be processed over this SubChain.- Returns:
- A new OutputProcessorChain
- Throws:
javax.xml.stream.XMLStreamException- thrown when a streaming error occursXMLSecurityException- thrown when a Security failure occurs
-
createSubChain
public OutputProcessorChain createSubChain(OutputProcessor outputProcessor, XMLSecStartElement parentXMLSecStartElement) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Specified by:
createSubChainin interfaceOutputProcessorChain- Throws:
javax.xml.stream.XMLStreamExceptionXMLSecurityException
-
-