Class FixedResultPipe

  • All Implemented Interfaces:
    HasTransactionAttribute, IConfigurable, IConfigurationAware, IExtendedPipe, IForwardTarget, INamedObject, IPipe, IScopeProvider, EventThrowing, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
    Direct Known Subclasses:
    FixedResult

    @Category("Basic")
    @ElementType(TRANSLATOR)
    public class FixedResultPipe
    extends FixedForwardPipe
    Produces a fixed result that does not depend on the input message. It may return the contents of a file when filename or filenameSessionKey is specified. Otherwise the value of attribute returnString is returned.

    Using parameters and the attributes of this pipe, it is possible to substitute values. This pipe performs the following steps:
    1. During execution, this pipe first obtains a string based on attributes returnString, filename or filenameSessionKey.
    2. The resulting string is transformed according to attributes replaceFrom and replaceTo if set. Please note that the plain value of attribute replaceFrom is matched, no ${...} here.
    3. The resulting string is substituted based on the parameters of this pipe. This step depends on attribute replaceFixedParams. Assume that there is a parameter with name xyz. If replaceFixedParams is false, then each occurrence of ${xyz} is replaced by the parameter's value. Otherwise, the text xyz is substituted. See Parameter to see how parameter values are determined.
    4. If attribute substituteVars is true, then expressions ${...} are substituted using system properties, pipelinesession variables and application properties. Please note that no ${...} patterns are left if the initial string came from attribute returnString, because any ${...} pattern in attribute returnString is substituted when the configuration is loaded.
    5. If attribute styleSheetName is set, then the referenced XSLT stylesheet is applied to the resulting string.

    Many attributes of this pipe reference file names. If a file is referenced by a relative path, the path is relative to the configuration's root directory.
    Author:
    Johan Verrips
    Parameters
    Used for substitution. For a parameter named xyz, the string ${xyz} or xyz (if replaceFixedParams is true) is substituted by the parameter's value.
    • Constructor Detail

      • FixedResultPipe

        public FixedResultPipe()
    • Method Detail

      • 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
      • setSubstituteVars

        public void setSubstituteVars​(boolean substitute)
        Should values between ${ and } be resolved. If true, the search order of replacement values is: system properties (1), pipelinesession variables (2), application properties (3).
        Default value
        false
      • setFilename

        public void setFilename​(String filename)
        Name of the file containing the result message.
      • setFilenameSessionKey

        public void setFilenameSessionKey​(String filenameSessionKey)
        Name of the session key containing the file name of the file containing the result message.
      • setReturnString

        public void setReturnString​(String returnString)
        Returned message.
      • setReplaceFrom

        public void setReplaceFrom​(String replaceFrom)
        If set, every occurrence of this attribute's value is replaced by the value of replaceTo.
      • setReplaceTo

        public void setReplaceTo​(String replaceTo)
        See replaceFrom.
      • setStyleSheetName

        public void setStyleSheetName​(String styleSheetName)
        File name of XSLT stylesheet to apply.
      • setReplaceFixedParams

        public void setReplaceFixedParams​(boolean b)
        When set true, parameter replacement matches name-of-parameter, not ${name-of-parameter}
        Default value
        false
      • getFilename

        public String getFilename()
      • getFilenameSessionKey

        public String getFilenameSessionKey()
      • getReturnString

        public String getReturnString()
      • isSubstituteVars

        public boolean isSubstituteVars()
      • getReplaceFrom

        public String getReplaceFrom()
      • getReplaceTo

        public String getReplaceTo()
      • getStyleSheetName

        public String getStyleSheetName()
      • isReplaceFixedParams

        public boolean isReplaceFixedParams()