Interface ConfigurableCodec


  • public interface ConfigurableCodec
    This interface defines functions that Codecs which have upstream events passed to them via their associated transport must perform. Codecs which are used with the FileAdapter, which receives events via the Null codec upstream are such codecs.
    • Method Detail

      • addConfiguration

        void addConfiguration​(int sessionId,
                              NormalisedEvent configuration)
                       throws java.io.IOException
        A codec may wish to support multiple configurations depending on data being read. The codec does not have to do anything in this function if it has no need for specific information relating to a particular data sink being used. The motivation for this functionality was the Apama File adapter. Multiple configurations may be needed if there are multiple files being read using (for instance) different separators delimiting fields.
        Parameters:
        sessionId - the sessionID this data relates to. Important as the codec may have configuration information based on the sessionID
        configuration - The normalised event containing the additional information required
        Throws:
        java.io.IOException - if the configuration could not be added to the codec
      • removeConfiguration

        void removeConfiguration​(int sessionId)
                          throws java.io.IOException
        Remove configuration associated with the given id
        Parameters:
        sessionId - the sessionId to remove the configuration for
        Throws:
        java.io.IOException
      • performsEscapingDownstream

        boolean performsEscapingDownstream()
        Whether or not the codec performs escaping downstream. Dependant on what encoding the codec needs to perform, it may prefer to do add escape characters where necessary to strings itself. If this returns true, the transport won't escape the line before it sends it to the codec.
        Returns:
        whether or not the codec performs it's own escaping when sending downstream messages