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
Replaces all occurrences of one string with another. Optionally strips or replaces XML non-printable characters.
Since:
4.2
Author:
Gerrit van Brakel
  • 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
    • setFind

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

      public String getFind()
    • 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).
    • getReplace

      public String getReplace()
    • 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.
    • setReplaceNonXmlChars

      public void setReplaceNonXmlChars(boolean b)
      Replace all characters that are non-printable according to the XML specification with the value specified in setReplaceNonXmlChar(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
    • isReplaceNonXmlChars

      public boolean isReplaceNonXmlChars()
    • setReplaceNonXmlChar

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

      public String getReplaceNonXmlChar()
    • setAllowUnicodeSupplementaryCharacters

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

      public boolean isAllowUnicodeSupplementaryCharacters()