Package org.frankframework.pipes
Class XmlSwitch
java.lang.Object
org.frankframework.core.TransactionAttributes
org.frankframework.pipes.AbstractPipe
org.frankframework.pipes.XmlSwitch
- All Implemented Interfaces:
HasTransactionAttribute
,IConfigurable
,IConfigurationAware
,IForwardTarget
,INamedObject
,IPipe
,IScopeProvider
,IWithParameters
,EventThrowing
,HasStatistics
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
@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 XmlSwitch
extends AbstractPipe
Selects an exitState, based on either the content of the input message, by means
of a XSLT-stylesheet, the content of a session variable or, by default, by returning the name of the root-element.
- Author:
- Johan Verrips
-
Field Summary
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
If nostyleSheetName
is specified, the switch uses the root node.boolean
consumesSessionVariable
(String sessionKey) returnstrue
if the pipe or one of its children use the named session variable.doPipe
(Message message, PipeLineSession session) This is where the action takes place, the switching is done.int
boolean
void
setEmptyForwardName
(String empty) Forward returned when the content, on which the switch is performed, is empty. ifemptyforwardname
is not specified,notfoundforwardname
is used.void
setForwardNameSessionKey
(String forwardNameSessionKey) Session key that will be used to get the forward name from.void
setNamespaceAware
(boolean b) controls namespace-awareness of XSLT transformationvoid
setNamespaceDefs
(String namespaceDefs) Namespace defintions for xpathExpression.void
setNotFoundForwardName
(String notFound) Forward returned when the pipename derived from the stylesheet could not be found.void
setServiceSelectionStylesheetFilename
(String newServiceSelectionStylesheetFilename) Deprecated, for removal: This API element is subject to removal in a future version.void
setSessionKey
(String sessionKey) Deprecated, for removal: This API element is subject to removal in a future version.void
setStoreForwardInSessionKey
(String storeForwardInSessionKey) Selected forward name will be stored in the specified session key.void
setStyleSheetName
(String styleSheetName) stylesheet may return a string representing the forward to look upvoid
setXpathExpression
(String xpathExpression) xpath-expression that returns a string representing the forward to look up.void
setXsltVersion
(int xsltVersion) If set to2
or3
a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan).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.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, setHideRegex, setLocker, setLogIntermediaryResults, setMaxThreads, setName, setPipeLine, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, sizeStatisticsEnabled, 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.IPipe
throwEvent
-
Field Details
-
XML_SWITCH_FORWARD_FOUND_MONITOR_EVENT
- See Also:
-
XML_SWITCH_FORWARD_NOT_FOUND_MONITOR_EVENT
- See Also:
-
-
Constructor Details
-
XmlSwitch
public XmlSwitch()
-
-
Method Details
-
configure
If nostyleSheetName
is specified, the switch uses the root node.- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIPipe
- Overrides:
configure
in classAbstractPipe
- 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 classAbstractPipe
-
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 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
-
consumesSessionVariable
Description copied from interface:IPipe
returnstrue
if the pipe or one of its children use the named session variable. Callers can use this to determine if a message needs to be preserved.- Specified by:
consumesSessionVariable
in interfaceIPipe
- Overrides:
consumesSessionVariable
in classAbstractPipe
-
setStyleSheetName
stylesheet may return a string representing the forward to look up- Default value
- a stylesheet that returns the name of the root-element
-
setServiceSelectionStylesheetFilename
@Deprecated(forRemoval=true, since="7.6.0") @ConfigurationWarning("Please use the attribute styleSheetName.") public void setServiceSelectionStylesheetFilename(String newServiceSelectionStylesheetFilename) Deprecated, for removal: This API element is subject to removal in a future version.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 $ -
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. -
setSessionKey
@Deprecated(forRemoval=true, since="7.7.0") @ConfigurationWarning("Please use \'getInputFromSessionKey\' or \'forwardNameSessionKey\' attribute instead.") public void setSessionKey(String sessionKey) Deprecated, for removal: This API element is subject to removal in a future version.Name of the key in thePipeLineSession
to retrieve the input message from, if a styleSheetName or a xpathExpression is specified. If no styleSheetName or xpathExpression is specified, the value of the session variable is used as the name of the forward. If none of sessionKey, styleSheetName or xpathExpression are specified, the element name of the root node of the input message is taken as the name of forward. -
getSessionKey
-
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. ifemptyforwardname
is not specified,notfoundforwardname
is used. -
setXsltVersion
public void setXsltVersion(int xsltVersion) If set to2
or3
a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan).0
will 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
-
getStyleSheetName
-
getXpathExpression
-
getNamespaceDefs
-
getStoreForwardInSessionKey
-
getNotFoundForwardName
-
getEmptyForwardName
-
getXsltVersion
public int getXsltVersion() -
getForwardNameSessionKey
-
isNamespaceAware
public boolean isNamespaceAware()
-