Class XmlSwitch

All Implemented Interfaces:
HasTransactionAttribute, IConfigurable, IConfigurationAware, IForwardTarget, INamedObject, IPipe, IScopeProvider, IWithParameters, EventThrowing, HasStatistics, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Category("Basic") @ElementType(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.
Johan Verrips
  • Field Details


      public static final String XML_SWITCH_FORWARD_FOUND_MONITOR_EVENT
      See Also:

      public static final String XML_SWITCH_FORWARD_NOT_FOUND_MONITOR_EVENT
      See Also:
  • Constructor Details

    • XmlSwitch

      public XmlSwitch()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      If no styleSheetName is specified, the switch uses the root node.
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IPipe
      configure in class AbstractPipe
    • start

      public void start() throws PipeStartException
      Description copied from interface: IPipe
      Perform necessary action to start the pipe. This method is executed after the IPipe.configure() method, for each start and stop command of the adapter.
      Specified by:
      start in interface IPipe
      start in class AbstractPipe
    • stop

      public void stop()
      Description copied from interface: IPipe
      Perform necessary actions to stop the Pipe.
      For instance, closing JMS connections, DBMS connections etc.
      Specified by:
      stop in interface IPipe
      stop in class AbstractPipe
    • doPipe

      public PipeRunResult doPipe(Message message, PipeLineSession session) throws PipeRunException
      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 an non-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.
    • consumesSessionVariable

      public boolean consumesSessionVariable(String sessionKey)
      Description copied from interface: IPipe
      returns true 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 interface IPipe
      consumesSessionVariable in class AbstractPipe
    • setStyleSheetName

      public void setStyleSheetName(String styleSheetName)
      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 @ConfigurationWarning("Please use the attribute styleSheetName.") public void setServiceSelectionStylesheetFilename(String newServiceSelectionStylesheetFilename)
      stylesheet may return a string representing the forward to look up
      Default value
      a stylesheet that returns the name of the root-element
    • setXpathExpression

      public void setXpathExpression(String xpathExpression)
      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

      public void setNamespaceDefs(String namespaceDefs)
      Namespace defintions for xpathExpression. Must be in the form of a comma or space separated list of prefix=namespaceuri-definitions. For some use other cases (NOT xpathExpression), one entry can be without a prefix, that will define the default namespace.
    • setSessionKey

      @Deprecated @ConfigurationWarning("Please use \'getInputFromSessionKey\' or \'forwardNameSessionKey\' attribute instead.") public void setSessionKey(String sessionKey)
      Name of the key in the PipeLineSession 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

      @Deprecated public String getSessionKey()
    • setNotFoundForwardName

      public void setNotFoundForwardName(String notFound)
      Forward returned when the pipename derived from the stylesheet could not be found.
    • setEmptyForwardName

      public void setEmptyForwardName(String empty)
      Forward returned when the content, on which the switch is performed, is empty. if emptyforwardname is not specified, notfoundforwardname is used.
    • setXsltVersion

      public void setXsltVersion(int xsltVersion)
      If set to 2 or 3 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
    • setStoreForwardInSessionKey

      public void setStoreForwardInSessionKey(String storeForwardInSessionKey)
      Selected forward name will be stored in the specified session key.
    • setForwardNameSessionKey

      public void setForwardNameSessionKey(String forwardNameSessionKey)
      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
    • getStyleSheetName

      public String getStyleSheetName()
    • getXpathExpression

      public String getXpathExpression()
    • getNamespaceDefs

      public String getNamespaceDefs()
    • getStoreForwardInSessionKey

      public String getStoreForwardInSessionKey()
    • getNotFoundForwardName

      public String getNotFoundForwardName()
    • getEmptyForwardName

      public String getEmptyForwardName()
    • getXsltVersion

      public int getXsltVersion()
    • getForwardNameSessionKey

      public String getForwardNameSessionKey()
    • isNamespaceAware

      public boolean isNamespaceAware()