Class StreamTracer

  • All Implemented Interfaces:
    ITracer
    Direct Known Subclasses:
    StreamTracer

    public abstract class StreamTracer
    extends AbstractWriter
    implements ITracer
    Implements a simple stream-based execution tracer. Produces normalized sequences of collections in order to facilitate easy comparison.
    Author:
    Holger Eichelberger
    • Field Detail

      • locale

        private java.util.Locale locale
      • baseFolder

        private java.lang.String[] baseFolder
      • callStack

        private java.util.Stack<java.lang.String> callStack
    • Constructor Detail

      • StreamTracer

        public StreamTracer​(java.io.Writer out,
                            java.lang.String... baseFolder)
        Creates a new stream tracer.
        Parameters:
        out - the output writer
        baseFolder - optional base folders used to make matching (string) values relative
    • Method Detail

      • makeRelative

        protected java.lang.String makeRelative​(java.lang.Object object)
        Makes a string value obtained from the StringValueHelper relative.
        Parameters:
        object - the object to be made relative
        Returns:
        the relative string (where applicable)
      • makeRelative

        protected java.lang.String makeRelative​(java.lang.String string)
        Aims at making the given string relative to the base folders stored in this instance.
        Parameters:
        string - the string to be made relative (may be null)
        Returns:
        the relative string
      • makeRelative

        protected java.lang.String makeRelative​(java.net.URI uri)
        Aims at making the given URI relative to the base folders stored in this instance.
        Parameters:
        uri - the URI to be made relative
        Returns:
        the relative string
      • visitingCallExpression

        public void visitingCallExpression​(OperationDescriptor descriptor,
                                           CallExpression.CallType callType,
                                           java.lang.Object[] args)
        Description copied from interface: ITracer
        Is called before a resolved call expression is actually executed. Do not modify the parameters!
        Specified by:
        visitingCallExpression in interface ITracer
        Parameters:
        descriptor - the descriptor to be called
        callType - the type of the call
        args - the actual arguments
      • visitedCallExpression

        public void visitedCallExpression​(OperationDescriptor descriptor,
                                          CallExpression.CallType callType,
                                          java.lang.Object[] args,
                                          java.lang.Object result)
        Description copied from interface: ITracer
        Is called after a resolved call expression is actually executed. Do not modify the parameters!
        Specified by:
        visitedCallExpression in interface ITracer
        Parameters:
        descriptor - the descriptor to be called
        callType - the type of the call
        args - the actual arguments
        result - the result of the call
      • skipImplicitArguments

        private java.util.Map<?,​?> skipImplicitArguments​(java.util.Map<?,​?> inMap)
        Skips the implicit named arguments from inMap.
        Parameters:
        inMap - the map to be processed
        Returns:
        a copy of inMap without implicit arguments
      • failedAt

        public void failedAt​(Expression expression)
        Description copied from interface: ITracer
        Is called when the evaluation of an expression caused an execution failure.
        Specified by:
        failedAt in interface ITracer
        Parameters:
        expression - the failing expression
      • getWriter

        protected abstract ExpressionWriter getWriter​(java.io.Writer out)
        Returns the writer for emitting expressions.
        Parameters:
        out - the output target
        Returns:
        the writer
      • getLocale

        public java.util.Locale getLocale()
        Description copied from interface: ITracer
        Returns the current locale for evaluation.
        Specified by:
        getLocale in interface ITracer
        Returns:
        the current locale
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Description copied from interface: ITracer
        Changes the current locale.
        Specified by:
        setLocale in interface ITracer
        Parameters:
        locale - the new locale (ignored if null)
      • setRuntimeEnvironment

        public void setRuntimeEnvironment​(RuntimeEnvironment<?,​?> environment)
        Description copied from interface: ITracer
        Defines the actual runtime environment.
        Specified by:
        setRuntimeEnvironment in interface ITracer
        Parameters:
        environment - the environment
      • getRuntimeEnvironment

        public RuntimeEnvironment<?,​?> getRuntimeEnvironment()
        Description copied from interface: ITracer
        Returns the actual runtime environment.
        Specified by:
        getRuntimeEnvironment in interface ITracer
        Returns:
        registry the runtime environment (may be null if not currently executing)