Class ReplacerPipe

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

@ElementType(TRANSLATOR) public class ReplacerPipe extends FixedForwardPipe
This Pipe is used to replace values in a few ways. The following steps are performed:
  1. If find is provided, it will be replaced by replace
  2. The resulting string is substituted based on the parameters of this pipe. It will replace values in the input enclosed with ?{}, for instance: ?{parameterOne}, with parameters of this pipe. If a parameter for the given value is not found, it will not be replaced and the '?{parameterOne}' value will remain in the output.

    See Parameter to see how parameter values are determined.

  3. If attribute substituteVars is true, then expressions ${...} are substituted using system properties, session variables and application properties. Please note that no ${...} patterns are left in the input.
Since:
4.2
Author:
Gerrit van Brakel
Parameters
Used for substitution. For a parameter named xyz, the string ?{xyz} is substituted by the parameter's value.
  • Constructor Details

    • ReplacerPipe

      public ReplacerPipe()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from class: FixedForwardPipe
      checks for correct configuration of forward
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface IPipe
      Overrides:
      configure in class FixedForwardPipe
      Throws:
      ConfigurationException
    • doPipe

      public PipeRunResult doPipe(Message message, PipeLineSession session) throws PipeRunException
      Description copied from interface: IPipe
      This is where the action takes place. Pipes may only throw a PipeRunException, to be handled by the caller of this object. Implementations must either consume the message, or pass it on to the next Pipe in the PipeRunResult. If the result of the Pipe does not depend on the input, like for the FixedResultPipe, the Pipe can schedule the input to be closed at session exit, by calling Message.closeOnCloseOf(PipeLineSession, String) This allows the previous Pipe to release any resources (e.g. connections) that it might have kept open until the message was consumed. Doing so avoids connections leaking from pools, while it enables efficient streaming processing of data while it is being read from a stream.
      Throws:
      PipeRunException
    • getFind

      public String getFind()
    • setFind

      public void setFind(String find)
      Sets the string that is searched for. Newlines can be represented by the setLineSeparatorSymbol(String).
    • getReplace

      public String getReplace()
    • setReplace

      public void setReplace(String replace)
      Sets the string that will replace each of the occurrences of the find-string. Newlines can be represented * by the setLineSeparatorSymbol(String).
    • getLineSeparatorSymbol

      public String getLineSeparatorSymbol()
      Sets the string the representation in find and replace of the line separator.
    • setLineSeparatorSymbol

      public void setLineSeparatorSymbol(String string)
      sets the string that will represent the line-separator in the setFind(String) and setReplace(String) strings.
    • isReplaceNonXmlChars

      public boolean isReplaceNonXmlChars()
    • setReplaceNonXmlChars

      public void setReplaceNonXmlChars(boolean b)
      Replace all characters that are non-printable according to the XML specification with the value specified in setNonXmlReplacementCharacter(String).

      NB: This will only replace or remove characters considered non-printable. This will not check if a given character is valid in the particular way it is used. Thus it will not remove or replace, for instance, a single '&' character.

      See also:

      Default value
      false
    • getNonXmlReplacementCharacter

      public String getNonXmlReplacementCharacter()
    • setNonXmlReplacementCharacter

      public void setNonXmlReplacementCharacter(String nonXmlReplacementCharacter)
      character that will replace each non-valid xml character (empty string is also possible) (use ¿ for inverted question mark)
      Default value
      empty string
    • setReplaceNonXmlChar

      @Deprecated(since="8.2", forRemoval=true) @ConfigurationWarning("The attribute \'replaceNonXmlChar\' has been renamed to \'nonXmlReplacementCharacter\' for readability") public void setReplaceNonXmlChar(String replaceNonXmlChar)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isAllowUnicodeSupplementaryCharacters

      public boolean isAllowUnicodeSupplementaryCharacters()
    • setAllowUnicodeSupplementaryCharacters

      public void setAllowUnicodeSupplementaryCharacters(boolean allowUnicodeSupplementaryCharacters)
      Whether to allow Unicode supplementary characters (like a smiley) during replaceNonValidXmlCharacters
      Default value
      false
    • setSubstituteVars

      public void setSubstituteVars(boolean substitute)
      Should properties (values between ${ and }) be resolved.
      Default value
      false
    • isSubstituteVars

      public boolean isSubstituteVars()