Package org.frankframework.pipes
Class SwitchPipe
java.lang.Object
org.frankframework.core.TransactionAttributes
org.frankframework.pipes.AbstractPipe
org.frankframework.pipes.SwitchPipe
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasTransactionAttribute,IConfigurable,IForwardTarget,IPipe,IScopeProvider,IWithParameters,NameAware,EventThrowing,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle
- Direct Known Subclasses:
XmlSwitch
@Forward(name="*",description="name of the root-element") @Forward(name="*",description="result of transformation, when <code>styleSheetName</code> or <code>xpathExpression</code> is specified")
@Category(BASIC)
@EnterpriseIntegrationPattern(ROUTER)
public class SwitchPipe
extends AbstractPipe
Selects an exitState, based on either the content of the input message, by means
of an XSLT-stylesheet, the content of a session variable, a JSON Path expression, or, by default, by returning the name of the root-element.
- Since:
- 9.2
- Author:
- Johan Verrips
-
Field Summary
FieldsFields inherited from class org.frankframework.pipes.AbstractPipe
parameterNamesMustBeUniqueFields inherited from class org.frankframework.core.TransactionAttributes
logFields inherited from interface org.frankframework.core.IPipe
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidIf nostyleSheetNameis specified, the switch uses the root node.doPipe(Message message, PipeLineSession session) This is where the action takes place, the switching is done.voidsetEmptyForwardName(String empty) Forward returned when the content, on which the switch is performed, is empty. ifemptyforwardnameis not specified,notfoundforwardnameis used.voidsetForwardNameSessionKey(String forwardNameSessionKey) Session key that will be used to get the forward name from.voidsetJsonPathExpression(String jsonPathExpression) jsonPath expression to be applied to the input-message. if not set, no transformation is done when the input message is mediatype JSONvoidsetNamespaceAware(boolean b) controls namespace-awareness of XSLT transformationvoidsetNamespaceDefs(String namespaceDefs) Namespace defintions for xpathExpression.voidsetNotFoundForwardName(String notFound) Forward returned when the pipename derived from the stylesheet could not be found.voidsetStoreForwardInSessionKey(String storeForwardInSessionKey) Selected forward name will be stored in the specified session key.voidsetStyleSheetName(String styleSheetName) stylesheet may return a string representing the forward to look upvoidsetXpathExpression(String xpathExpression) xpath-expression that returns a string representing the forward to look up.voidsetXsltVersion(int xsltVersion) If set to2or3a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan).voidstart()Perform necessary action to start the pipe.voidstop()Perform necessary actions to stop thePipe.
For instance, closing JMS connections, DBMS connections etc.Methods inherited from class org.frankframework.pipes.AbstractPipe
addForward, addParameter, consumesSessionVariable, createBean, findForward, getAdapter, getEventSourceName, getForwards, getParameterList, hasRegisteredForward, isRunning, registerEvent, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setGetInputFromFixedValue, setGetInputFromSessionKey, setHideRegex, setLocker, setLogIntermediaryResults, setMaxThreads, setName, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, sizeStatisticsEnabled, throwEventMethods inherited from class org.frankframework.core.TransactionAttributes
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.core.HasTransactionAttribute
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttributeMethods inherited from interface org.frankframework.core.IForwardTarget
getNameMethods inherited from interface org.frankframework.core.IPipe
getChompCharSize, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getGetInputFromFixedValue, getGetInputFromSessionKey, getHideRegex, getLocker, getLogIntermediaryResults, getMaxThreads, getSecLogSessionKeys, getStoreResultInSessionKey, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, setPipeLine, throwEvent
-
Field Details
-
SWITCH_FORWARD_FOUND_MONITOR_EVENT
- See Also:
-
SWITCH_FORWARD_NOT_FOUND_MONITOR_EVENT
- See Also:
-
-
Constructor Details
-
SwitchPipe
public SwitchPipe()
-
-
Method Details
-
configure
If nostyleSheetNameis specified, the switch uses the root node.- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classAbstractPipe- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()Description copied from interface:IPipePerform necessary action to start the pipe. This method is executed after theIConfigurable.configure()method, for each start and stop command of the adapter.- Specified by:
startin interfaceIPipe- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Overrides:
startin classAbstractPipe
-
stop
public void stop()Description copied from interface:IPipePerform necessary actions to stop thePipe.
For instance, closing JMS connections, DBMS connections etc.- Specified by:
stopin interfaceIPipe- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Overrides:
stopin classAbstractPipe
-
doPipe
This is where the action takes place, the switching is done. Pipes may only throw a PipeRunException, to be handled by the caller of this object.
As WebLogic has the problem that when a not well-formed XML stream is given to `weblogic.xerces` the transformer gets corrupt, on an exception the configuration is done again, so that the transformer is re-initialized.- Throws:
PipeRunException
-
setStyleSheetName
stylesheet may return a string representing the forward to look up- Default value
- a stylesheet that returns the name of the root-element
-
setXpathExpression
xpath-expression that returns a string representing the forward to look up. It's possible to refer to a parameter (which e.g. contains a value from a sessionkey) by using the parameter name prefixed with $ -
setJsonPathExpression
jsonPath expression to be applied to the input-message. if not set, no transformation is done when the input message is mediatype JSON -
setNamespaceDefs
Namespace defintions for xpathExpression. Must be in the form of a comma or space separated list ofprefix=namespaceuri-definitions. For some use other cases (NOT xpathExpression), one entry can be without a prefix, that will define the default namespace. -
setNotFoundForwardName
Forward returned when the pipename derived from the stylesheet could not be found. -
setEmptyForwardName
Forward returned when the content, on which the switch is performed, is empty. ifemptyforwardnameis not specified,notfoundforwardnameis used. -
setXsltVersion
public void setXsltVersion(int xsltVersion) If set to2or3a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan).0will auto-detect- Default value
- 0
-
setStoreForwardInSessionKey
Selected forward name will be stored in the specified session key. -
setForwardNameSessionKey
Session key that will be used to get the forward name from. -
setNamespaceAware
public void setNamespaceAware(boolean b) controls namespace-awareness of XSLT transformation- Default value
- true
-