Package org.frankframework.pipes
Class ForEachChildElementPipe
java.lang.Object
org.frankframework.core.TransactionAttributes
org.frankframework.pipes.AbstractPipe
org.frankframework.pipes.FixedForwardPipe
org.frankframework.pipes.MessageSendingPipe
org.frankframework.pipes.IteratingPipe<String>
org.frankframework.pipes.StringIteratorPipe
org.frankframework.pipes.ForEachChildElementPipe
- All Implemented Interfaces:
HasSender
,HasTransactionAttribute
,IConfigurable
,IConfigurationAware
,IForwardTarget
,INamedObject
,IPipe
,IScopeProvider
,IWithParameters
,EventThrowing
,HasStatistics
,IThreadCreator
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
@Category(BASIC)
public class ForEachChildElementPipe
extends StringIteratorPipe
implements IThreadCreator
Sends a message to a Sender for each child element of the input XML.
Input can be a String containing XML, a filename (set processFile true), an InputStream or a Reader.
- Since:
- 4.6.1
- Author:
- Gerrit van Brakel
- Parameters
- all parameters will be applied to the xslt if an elementXPathExpression is specified
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
SAXException thrown to signal that the consumer of a stream does not want to receive more of it.static class
SAXException thrown to signal that a timeout occurred in consuming the stream.Nested classes/interfaces inherited from class org.frankframework.pipes.IteratingPipe
IteratingPipe.ItemCallback, IteratingPipe.StopReason
Nested classes/interfaces inherited from class org.frankframework.pipes.MessageSendingPipe
MessageSendingPipe.LinkMethod
-
Field Summary
Fields inherited from class org.frankframework.pipes.IteratingPipe
MAX_ITEMS_REACHED_FORWARD, msgTransformerPool, STOP_CONDITION_MET_FORWARD
Fields inherited from class org.frankframework.pipes.MessageSendingPipe
configurationMetrics, INPUT_VALIDATOR_NAME_PREFIX, INPUT_VALIDATOR_NAME_SUFFIX, INPUT_WRAPPER_NAME_PREFIX, INPUT_WRAPPER_NAME_SUFFIX, MAX_RETRY_INTERVAL, MESSAGE_LOG_NAME_PREFIX, MESSAGE_LOG_NAME_SUFFIX, MIN_RETRY_INTERVAL, msgLog, OUTPUT_VALIDATOR_NAME_PREFIX, OUTPUT_VALIDATOR_NAME_SUFFIX, OUTPUT_WRAPPER_NAME_PREFIX, OUTPUT_WRAPPER_NAME_SUFFIX, PIPE_CLEAR_TIMEOUT_MONITOR_EVENT, PIPE_EXCEPTION_MONITOR_EVENT, PIPE_TIMEOUT_MONITOR_EVENT
Fields inherited from class org.frankframework.pipes.AbstractPipe
parameterNamesMustBeUnique
Fields inherited from class org.frankframework.core.TransactionAttributes
log
Fields inherited from interface org.frankframework.core.IPipe
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checks for correct configuration of forwardprotected void
createHandler
(org.frankframework.pipes.ForEachChildElementPipe.HandlerRecord result, ThreadConnector<?> threadConnector, Message input, PipeLineSession session, IteratingPipe<String>.ItemCallback callback) protected TransformerPool
int
boolean
boolean
protected IteratingPipe.StopReason
iterateOverInput
(Message input, PipeLineSession session, Map<String, Object> threadContext, IteratingPipe<String>.ItemCallback callback) protected String
makeEncapsulatingXslt
(String rootElementname, String xpathExpression, int xsltVersion, String namespaceDefs) void
setContainerElement
(String containerElement) Element name (not an XPath-expression), qualified via attributenamespaceDefs
, used to determine the 'root' of elements to be iterated over, i.e. the root of the set of child elements.void
setElementXPathExpression
(String string) XPath-expression used to determine the set of elements to be iterated over, i.e. the set of child elements.void
setProcessFile
(boolean b) Deprecated, for removal: This API element is subject to removal in a future version.void
setRemoveNamespaces
(boolean b) If settrue
namespaces (and prefixes) are removed from the items just before forwarding them to the sender.void
setTargetElement
(String targetElement) Element name (not an XPath-expression), qualified via attributenamespaceDefs
, used to determine the type of elements to be iterated over, i.e. the element name of each of the child elements.void
setThreadLifeCycleEventListener
(ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener) void
setTxManager
(IThreadConnectableTransactionManager<?, ?> txManager) void
setXmlDebugger
(IXmlDebugger xmlDebugger) void
setXsltVersion
(int xsltVersion) If set to2
or3
a Saxon (net.sf.saxon) XSLT processor 2.0 or 3.0 will be used, supporting XPath 2.0 or 3.0 respectively, otherwise an XSLT processor 1.0 (org.apache.xalan), supporting XPath 1.0.void
start()
Perform necessary action to start the pipe.void
stop()
Perform necessary actions to stop thePipe
.
For instance, closing JMS connections, DBMS connections etc.Methods inherited from class org.frankframework.pipes.StringIteratorPipe
createItemCallBack, getBlockPrefix, getBlockSuffix, getEndPosition, getKey, getLinePrefix, getLineSuffix, getStartPosition, getStringIteratorPipeBlockSize, isCombineBlocks, isEscapeXml, setBlockPrefix, setBlockSize, setBlockSuffix, setCombineBlocks, setEndPosition, setEscapeXml, setLinePrefix, setLineSuffix, setStartPosition
Methods inherited from class org.frankframework.pipes.IteratingPipe
getBlockSize, getItem, getItemNoSessionKey, getIterator, getMaxChildThreads, getMaxItems, getNamespaceDefs, getOutputType, getStatisticsKeeper, getStopConditionTp, getStopConditionXPathExpression, getStyleSheetName, getTaskExecutor, getXpathExpression, isAddInputToResult, isCloseIteratorOnExit, isCollectResults, isIgnoreExceptions, isOmitXmlDeclaration, isParallel, isRemoveDuplicates, isRemoveXmlDeclarationInResults, itemToMessage, sendMessage, setAddInputToResult, setCloseIteratorOnExit, setCollectResults, setIgnoreExceptions, setItemNoSessionKey, setMaxChildThreads, setMaxItems, setNamespaceDefs, setOmitXmlDeclaration, setOutputType, setParallel, setRemoveDuplicates, setRemoveXmlDeclarationInResults, setSender, setStopConditionXPathExpression, setStyleSheetName, setTaskExecutor, setXpathExpression
Methods inherited from class org.frankframework.pipes.MessageSendingPipe
consumesSessionVariable, doLogToMessageLog, doPipe, getCheckRootTag, getConfigurationMetrics, getExceptionOnResult, getHideMethod, getInputValidator, getInputWrapper, getLinkMethod, getMaxRetries, getMessageLog, getOutputValidator, getOutputWrapper, getPresumedTimeOutInterval, getResultOnTimeOut, getRetryMaxInterval, getRetryMinInterval, getRetryNamespaceDefs, getRetryXPath, getSender, getStubFilename, getTimeoutOnResult, increaseRetryIntervalAndWait, isCheckXmlWellFormed, postSendAction, preserve, propagateName, sendMessageWithRetries, setCheckRootTag, setCheckXmlWellFormed, setConfigurationMetrics, setExceptionOnResult, setHideMethod, setHideRegex, setInputValidator, setInputWrapper, setLinkMethod, setMaxRetries, setMessageLog, setName, setOutputValidator, setOutputWrapper, setPipeProcessor, setPresumedTimeOutInterval, setResultOnTimeOut, setRetryMaxInterval, setRetryMinInterval, setRetryNamespaceDefs, setRetryXPath, setStubFilename, setTimeoutOnResult, setTimeOutOnResult, sizeStatisticsEnabled, storeMessage
Methods inherited from class org.frankframework.pipes.FixedForwardPipe
getIfParam, getIfValue, getOnlyIfSessionKey, getOnlyIfValue, getParameterValue, getSuccessForward, getUnlessSessionKey, getUnlessValue, isSkipOnEmptyInput, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipe
Methods inherited from class org.frankframework.pipes.AbstractPipe
addForward, addParameter, createBean, findForward, getAdapter, getApplicationContext, getChompCharSize, getConfigurationClassLoader, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getEventSourceName, getForwards, getGetInputFromFixedValue, getGetInputFromSessionKey, getHideRegex, getLocker, getLogIntermediaryResults, getMaxThreads, getName, getParameterList, getPipeLine, getSecLogSessionKeys, getStoreResultInSessionKey, hasRegisteredForward, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, registerEvent, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setEventPublisher, setGetInputFromFixedValue, setGetInputFromSessionKey, setLocker, setLogIntermediaryResults, setMaxThreads, setPipeLine, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, throwEvent
Methods inherited from class org.frankframework.core.TransactionAttributes
configureTransactionAttributes, getTransactionAttribute, getTransactionTimeout, getTxDef, isTransacted, isTransacted, setTransacted, setTransactionAttribute, setTransactionTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.frankframework.core.INamedObject
getName
Methods inherited from interface org.frankframework.core.IPipe
throwEvent
-
Field Details
-
DEFAULT_XSLT_VERSION
public static final int DEFAULT_XSLT_VERSION- See Also:
-
-
Constructor Details
-
ForEachChildElementPipe
public ForEachChildElementPipe()
-
-
Method Details
-
configure
Description copied from class:FixedForwardPipe
checks for correct configuration of forward- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIPipe
- Overrides:
configure
in classStringIteratorPipe
- Throws:
ConfigurationException
-
start
public void start()Description copied from interface:IPipe
Perform necessary action to start the pipe. This method is executed after theIPipe.configure()
method, for each start and stop command of the adapter.- Specified by:
start
in interfaceIPipe
- Overrides:
start
in classMessageSendingPipe
-
stop
public void stop()Description copied from interface:IPipe
Perform necessary actions to stop thePipe
.
For instance, closing JMS connections, DBMS connections etc.- Specified by:
stop
in interfaceIPipe
- Overrides:
stop
in classMessageSendingPipe
-
makeEncapsulatingXslt
-
createHandler
protected void createHandler(org.frankframework.pipes.ForEachChildElementPipe.HandlerRecord result, ThreadConnector<?> threadConnector, Message input, PipeLineSession session, IteratingPipe<String>.ItemCallback callback) throws TransformerConfigurationException -
iterateOverInput
protected IteratingPipe.StopReason iterateOverInput(Message input, PipeLineSession session, Map<String, Object> threadContext, IteratingPipe<String>.ItemCallback callback) throws SenderException, TimeoutException- Overrides:
iterateOverInput
in classIteratingPipe<String>
- Throws:
SenderException
TimeoutException
-
getExtractElementsTp
-
setProcessFile
@Deprecated(forRemoval=true, since="7.7.0") @ConfigurationWarning("Please add a LocalFileSystemPipe with action=read in front of this pipe instead") public void setProcessFile(boolean b) Deprecated, for removal: This API element is subject to removal in a future version.When settrue
, the input is assumed to be the name of a file to be processed. Otherwise, the input itself is transformed. The character encoding will be read from the XML declaration- Default value
- false
-
setContainerElement
Element name (not an XPath-expression), qualified via attributenamespaceDefs
, used to determine the 'root' of elements to be iterated over, i.e. the root of the set of child elements. When empty, the pipe will iterate over each direct child element of the root -
setTargetElement
Element name (not an XPath-expression), qualified via attributenamespaceDefs
, used to determine the type of elements to be iterated over, i.e. the element name of each of the child elements. When empty, the pipe will iterate over any direct child element of the root or specified containerElement -
setElementXPathExpression
XPath-expression used to determine the set of elements to be iterated over, i.e. the set of child elements. When empty, the effective value is \/*\/*, i.e. the pipe will iterate over each direct child element of the root. Be aware that memory consumption appears to increase with file size when this attribute is used. When possible, use containerElement and/or targetElement instead. -
setXsltVersion
public void setXsltVersion(int xsltVersion) If set to2
or3
a Saxon (net.sf.saxon) XSLT processor 2.0 or 3.0 will be used, supporting XPath 2.0 or 3.0 respectively, otherwise an XSLT processor 1.0 (org.apache.xalan), supporting XPath 1.0. N.B. Be aware that setting this other than 1 might cause the input file being read as a whole in to memory, as XSLT Streaming is currently only supported by the XSLT Processor that is used for xsltVersion=1- Default value
- 1
-
setRemoveNamespaces
public void setRemoveNamespaces(boolean b) If settrue
namespaces (and prefixes) are removed from the items just before forwarding them to the sender. N.B. This takes place after the transformation forelementXPathExpression
if that is specified -
isProcessFile
public boolean isProcessFile() -
getContainerElement
-
getTargetElement
-
getElementXPathExpression
-
getXsltVersion
public int getXsltVersion() -
isRemoveNamespaces
public boolean isRemoveNamespaces() -
setThreadLifeCycleEventListener
public void setThreadLifeCycleEventListener(ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener) - Specified by:
setThreadLifeCycleEventListener
in interfaceIThreadCreator
-
setTxManager
-
getXmlDebugger
-
setXmlDebugger
-