Class XMLLoggingInInterceptor

  • All Implemented Interfaces:
    adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, org.apache.cxf.interceptor.Interceptor<org.apache.cxf.message.Message>, org.apache.cxf.phase.PhaseInterceptor<org.apache.cxf.message.Message>

    public class XMLLoggingInInterceptor
    extends AbstractInInterceptor
    Default XML Logging interceptor.
    Author:
    greenbird Integration Technology, FracPete (fracpete at waikato dot ac dot nz) - simplified, pretty printing
    • Field Detail

      • logger

        protected adams.core.logging.Logger logger
      • prettyPrint

        protected boolean prettyPrint
        whether to use pretty printing.
      • outputFile

        protected File outputFile
        the file to output the XML messages to - disabled if null.
      • convert

        protected adams.data.conversion.PrettyPrintXML convert
        the conversion for pretty printing the XML.
      • formatter

        protected transient adams.core.DateFormat formatter
        for outputting timestamps in the output file.
    • Constructor Detail

      • XMLLoggingInInterceptor

        public XMLLoggingInInterceptor()
      • XMLLoggingInInterceptor

        public XMLLoggingInInterceptor​(adams.core.logging.Logger logger,
                                       boolean prettyPrint,
                                       File outputFile)
    • Method Detail

      • splitMessage

        protected StringBuilder[] splitMessage​(StringBuilder msg)
        Splits the message into (if possible): header, actual message and footer.
        Parameters:
        msg - the message to split
        Returns:
        the split message
      • prettyPrint

        protected StringBuilder prettyPrint​(StringBuilder buffer)
        Pretty prints the buffer, if enabled.
        Parameters:
        buffer - the buffer to turn into "pretty" XML
        Returns:
        the (potentially) new buffer
      • handleMessage

        public void handleMessage​(org.apache.cxf.message.Message message)
                           throws org.apache.cxf.interceptor.Fault
        Throws:
        org.apache.cxf.interceptor.Fault
      • getIdHeader

        protected String getIdHeader​(org.apache.cxf.message.Message message)
        Gets theMessageID header in the list of headers.
      • getHeader

        protected String getHeader​(org.apache.cxf.message.Message message,
                                   String name)
      • logProperties

        protected void logProperties​(StringBuilder buffer,
                                     org.apache.cxf.message.Message message)
        Method intended for use within subclasses. Log custom field here.
        Parameters:
        message - message