Class TraceController


  • public class TraceController
    extends java.lang.Object
    A controller object for the tracing mechanism.
    Version:
    $Revision: 1.4 $
    • Constructor Summary

      Constructors 
      Constructor Description
      TraceController()
      Instantiate one
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void assertNotNull​(java.lang.String fieldName, java.lang.Object fieldValue)
      Verify that the specified value is not null.
      void close()
      Close down the debugging facilities in preparation for application shutdown.
      TraceChannel getDefaultChannel()
      Return the default channel
      java.io.PrintStream getRealSystemErr()
      Return the real stream that corresponds to the console for System.err.
      java.io.PrintStream getRealSystemOut()
      Return the real stream that corresponds to the console for System.out.
      boolean isBufferingEnabled()
      Return true if buffering is enabled.
      boolean isErrRedirected()
      Return true if System.err has been redirected to print through Trace.println
      boolean isOutRedirected()
      Return true if System.out has been redirected to print through Trace.println
      void setBufferingEnabled​(boolean enabled)
      Shutdown the tracing thread and flush the buffers.
      void setDefaultChannel​(TraceChannel channel)
      Set the default channel.
      void setErrRedirected​(boolean redirected)
      Specify whether or not System.err should be redirected to print through Trace.println
      void setOutRedirected​(boolean redirected)
      Specify whether or not System.out should be redirected to print through Trace.println
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • systemOut_

        private java.io.PrintStream systemOut_
      • systemErr_

        private java.io.PrintStream systemErr_
    • Constructor Detail

      • TraceController

        TraceController()
        Instantiate one
    • Method Detail

      • setBufferingEnabled

        public void setBufferingEnabled​(boolean enabled)
        Shutdown the tracing thread and flush the buffers. Any print calls after this method has been called will be written immediately on the thread that made the call.
        Parameters:
        enabled - true if buffering is to be enabled.
      • isBufferingEnabled

        public boolean isBufferingEnabled()
        Return true if buffering is enabled.
        Returns:
        true if buffering is enabled.
      • setOutRedirected

        public void setOutRedirected​(boolean redirected)
        Specify whether or not System.out should be redirected to print through Trace.println
        Parameters:
        redirected - true if System.out should be redirected.
      • isOutRedirected

        public boolean isOutRedirected()
        Return true if System.out has been redirected to print through Trace.println
        Returns:
        true if System.out has been redirected.
      • getRealSystemOut

        public java.io.PrintStream getRealSystemOut()
        Return the real stream that corresponds to the console for System.out. If System.out has been redirected then this method will return the original value.
        Returns:
        the real System.out
      • setErrRedirected

        public void setErrRedirected​(boolean redirected)
        Specify whether or not System.err should be redirected to print through Trace.println
        Parameters:
        redirected - true if System.err should be redirected.
      • isErrRedirected

        public boolean isErrRedirected()
        Return true if System.err has been redirected to print through Trace.println
        Returns:
        true if System.err has been redirected.
      • getRealSystemErr

        public java.io.PrintStream getRealSystemErr()
        Return the real stream that corresponds to the console for System.err. If System.err has been redirected then this method will return the original value.
        Returns:
        the real System.err
      • close

        public void close()
        Close down the debugging facilities in preparation for application shutdown. This will disable the buffering and turn off redirections for System.out and System.err.
      • setDefaultChannel

        public void setDefaultChannel​(TraceChannel channel)
        Set the default channel. The default is used when a channel is not specified in a call to Trace.print(), Trace.println() or Trace.printStackTrace()
        Parameters:
        channel - the new channel.
      • getDefaultChannel

        public TraceChannel getDefaultChannel()
        Return the default channel
        Returns:
        the default channel.
      • assertNotNull

        protected final void assertNotNull​(java.lang.String fieldName,
                                           java.lang.Object fieldValue)
                                    throws DetailedNullPointerException
        Verify that the specified value is not null. If it is then throw an exception
        Parameters:
        fieldName - The name of the field to check
        fieldValue - The value of the field to check
        Throws:
        DetailedNullPointerException - If fieldValue is null