Class SequenceGrapher

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Runnable

    public class SequenceGrapher
    extends AbstractLogger
    This class supports the creation of simple sequence diagrams as described in the user manual of UML Graph. This format will be used if the result will be stored in a file with the extension ".pic".

    Since 1.6 the sequence diagram can be also generated in a simple text format which can be used as input for websequence diagrams. This format will be used as default.

    Since:
    1.3.1 (06.09.2013)
    Author:
    oliver
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      SequenceGrapher()
      Instantiates a new SequenceGrapher.
      SequenceGrapher​(java.io.File logFile)
      Instantiates a new sequence grapher.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the stream with the logged objects.
      void createMessage​(java.lang.Object creator, java.lang.Object createdObject, org.aspectj.lang.JoinPoint.StaticPart jpInfo)
      Logs the creation of an object in the created sequence diagram.
      void createMessage​(org.aspectj.lang.JoinPoint call, java.lang.Object result)
      Logs the creation of an object in the created sequence diagram.
      void execute​(org.aspectj.lang.JoinPoint execution)
      Trys to log the call of the given excecution joinpoint.
      void message​(java.lang.Object sender, java.lang.Object target, org.aspectj.lang.JoinPoint.StaticPart jpInfo, java.lang.Object[] args)
      Logs the call of a method to the generated sequence diagram.
      void message​(java.lang.Object caller, org.aspectj.lang.JoinPoint call)
      Logs the call of a method to the generated sequence diagram.
      void message​(org.aspectj.lang.JoinPoint call)
      Logs the call of a method to the generated sequence diagram.
      void returnFromExecute​(org.aspectj.lang.JoinPoint execution)
      This is the closing method of execute(JoinPoint).
      void returnFromExecute​(org.aspectj.lang.JoinPoint execution, java.lang.Object returnValue)
      This is the closing method of execute(JoinPoint).
      void returnMessage​(java.lang.Object returnee, java.lang.Object returnValue, org.aspectj.lang.JoinPoint.StaticPart jpInfo)
      Return message.
      void returnMessage​(org.aspectj.lang.JoinPoint call)
      Logs the return arrow from the last call to the generated sequence diagram.
      void returnMessage​(org.aspectj.lang.JoinPoint call, java.lang.Object returnValue)
      Logs the return arrow from the last call to the generated sequence diagram.
      void setExcludeFilter​(java.lang.String[] pattern)
      Sets the exclude filter.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SequenceGrapher

        public SequenceGrapher()
        Instantiates a new SequenceGrapher. The generated sequence diagram is stored in a temporary file.
      • SequenceGrapher

        public SequenceGrapher​(java.io.File logFile)
        Instantiates a new sequence grapher.
        Parameters:
        logFile - the log file
    • Method Detail

      • setExcludeFilter

        public void setExcludeFilter​(java.lang.String[] pattern)
        Sets the exclude filter. Classes which matches the filter will not appear in the generated sequence diagram.
        Parameters:
        pattern - the new exclude filter
        Since:
        1.4.1
      • close

        public void close()
        Closes the stream with the logged objects.
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class AbstractLogger
      • createMessage

        public void createMessage​(org.aspectj.lang.JoinPoint call,
                                  java.lang.Object result)
        Logs the creation of an object in the created sequence diagram.
        Parameters:
        call - the call
        result - the created object
      • createMessage

        public void createMessage​(java.lang.Object creator,
                                  java.lang.Object createdObject,
                                  org.aspectj.lang.JoinPoint.StaticPart jpInfo)
        Logs the creation of an object in the created sequence diagram.
        Parameters:
        creator - the creator
        createdObject - the created object
        jpInfo - the jp info
      • execute

        public void execute​(org.aspectj.lang.JoinPoint execution)
        Trys to log the call of the given excecution joinpoint. For this reason we must find the caller which is a little bit tricky. We use the classname of the mapped variable names to guess which could be the caller.
        Parameters:
        execution - the execution joinpoint
      • returnFromExecute

        public void returnFromExecute​(org.aspectj.lang.JoinPoint execution)
        This is the closing method of execute(JoinPoint). After an execution joinpoint has ended we must complete the diagram with the return message.
        Parameters:
        execution - the execution joinpoint
        Since:
        1.6 (03.06.2015)
      • returnFromExecute

        public void returnFromExecute​(org.aspectj.lang.JoinPoint execution,
                                      java.lang.Object returnValue)
        This is the closing method of execute(JoinPoint). After an execution joinpoint has ended we must complete the diagram with the return message.
        Parameters:
        execution - the execution joinpoint
        returnValue - the return value
        Since:
        1.6 (03.06.2015)
      • message

        public void message​(org.aspectj.lang.JoinPoint call)
        Logs the call of a method to the generated sequence diagram.
        Parameters:
        call - the call
      • message

        public void message​(java.lang.Object caller,
                            org.aspectj.lang.JoinPoint call)
        Logs the call of a method to the generated sequence diagram.
        Parameters:
        caller - the caller
        call - the call
      • message

        @NullArgsAllowed
        public void message​(java.lang.Object sender,
                            java.lang.Object target,
                            org.aspectj.lang.JoinPoint.StaticPart jpInfo,
                            java.lang.Object[] args)
        Logs the call of a method to the generated sequence diagram.
        Parameters:
        sender - the sender
        target - the target
        jpInfo - the static joinpoint info with the method name
        args - the args
      • returnMessage

        public void returnMessage​(org.aspectj.lang.JoinPoint call)
        Logs the return arrow from the last call to the generated sequence diagram.
        Parameters:
        call - the call
      • returnMessage

        public void returnMessage​(org.aspectj.lang.JoinPoint call,
                                  java.lang.Object returnValue)
        Logs the return arrow from the last call to the generated sequence diagram. Because it could be that the return message is already logged by an execution joinpoint we check that first.
        Parameters:
        call - the call
        returnValue - the return value
      • returnMessage

        public void returnMessage​(java.lang.Object returnee,
                                  java.lang.Object returnValue,
                                  org.aspectj.lang.JoinPoint.StaticPart jpInfo)
        Return message.
        Parameters:
        returnee - the returnee
        returnValue - the return value
        jpInfo - the jp info