AWG Blogs

  • Getting ADB Working for SPH-M840 - Had a SPH-M840 Galaxy Ring Virgin Mobile 3G Android version 4.1.2, attempting to install apps from Android Studio failed to detect device. Installed SAMSUN...
    7 months ago
  • How to check if I have write permissions to an Oracle table - SELECT CASE WHEN COUNT(*) > 0 THEN 'YES' ELSE 'NO' END AS PERMISSIONS FROM ( SELECT privilege FROM ( select * from dba_tab_privs where (grantee = 'MY_USE...
    7 months ago
  • JSF vs Struts 2 - JSF was designed in part by the authors of Struts to create a "Struts" that did a more accurate implementation of MVC (Struts is technically "Model 2") a...
    8 months ago
  • XML Beans vs JAXB - Seems XML Beans is superior: JAXB provides support for the XML schema specification, but handles only a subset of it; XMLBeans supports all of it. Also, by...
    1 year ago
  • Algorithms and OOP - In addition to DCI, "generic programming" as well as the move to functional programming appears to add nuance to the OOP notion of joining behavior with da...
    1 year ago
  • Flyweight vs Singleton - Implementations seems to be virtually identical, differing only in style, where the flyweight object is created and held by associated objects (containers:...
    1 year ago
  • init-param vs context-param - see for background. Gist: context-param variables are global and accessible thro...
    1 year ago
  • rbenv vs RVM - RVM is responsible not only for changing Ruby versions, but for installing rubies and managing gemsets, as well. ...Along with rbenv [to manage ruby versi...
    2 years ago

Friday, February 13, 2015

Creating a sequence diagram from a stack trace

Install AmaterasUML:
- download AmaterasUML from
- unzip
- copy the three jars to eclipse plugin folder, e.g. D:\App\eclipse-jee-luna-R-win32-x86_64\eclipse\plugins
- install Graphical Editing Framework eclipse plugin. It was already installed in mine, maybe through a dependency on BPMN2 Modeler or something else.
- restart eclipse
Get the stack trace
- in Eclipse put a breakpoint in some method you want to analyze via sequence diagram
- start debug 
- in the debug view right-click the Daemon Thread and click Copy Stack
- paste into text editor
Fix up stack trace
- remove unwanted lines including lines that end with "line: 1" or start with "Daemon Thread" or "owns:" leaving only the lines that start with entities to be added to the sequence diagram
- save the file e.g. D:\work\AmaterasPrepWork\MyStackTrace.txt
- create a second text file and paste into it the following awk script:
str = $0;\
sub(/^\t/, "", str);\
match(str, /(.*)\./, arr);\
sub(/^/, "at ", str);\
#print str;\
sub(/\([^\)]*\)/, "(", str);\
sub(/ line: /, arr[1]".java:", str);\
sub(/$/, ")", str);\
sub(/\t\)$/, ")", str);\
print str}
- save the file as e.g. D:\work\AmaterasPrepWork\AmaterasPrepProg.txt
- download gawk and run file e.g. gawk-3.1.6-1-setup.exe
- open a command prompt and cd to e.g. D:\work\AmaterasPrepWork
- execute the following commands:
D:\AmaterasPrepWork>set path=%path%;D:\Program Files (x86)\GnuWin32\bin
D:\AmaterasPrepWork>echo awk -f AmaterasPrepProg.txt MyStackTrace.txt ^> out.txt > run.bat
Make sequence diagram in eclipse
- Do Window, Show View, AmaterasUML, Stack Trace Sample, OK
- paste the contents of D:\AmaterasPrepWork\out.txt into the window
- click the 'i' (image of lower case 'i') button in upper right-hand corner of the Stack Trace Sample view
- select a folder in your project as the destination of new sequence
- refresh the folder in eclipse
- open sequence.sqd
- do finishing touches. It appears e.g. that some entities weren't added and need to be added?? will check on this...
- save the file as MySequence.sqd or save sequence.sqd and refactor to another name because AmaterasUML uses sequence.sqd as the target file name evidently.