![Page 1: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/1.jpg)
BRUE
PRESENTATION 2
S r i R a g u r a m a nC I S 8 9 5
K a n s a s S t a t e U n i v e r s i t y
![Page 2: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/2.jpg)
Overview of Presentation
•Overall flow•Critical use-casesOverview
•Structural view•Implemented as Eclipse plug-ins
Architecture
•Formal specification•Project plan and Test Plan•Demo
ArtifactsDemo
![Page 3: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/3.jpg)
Overall flow
• Launch application
• Collect execution trace• XML format
Collect trace
![Page 4: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/4.jpg)
Critical use-casesud Use Case Model
User
Collect trace information for a
scenario
Visualize scenario
View package model
View interaction model
Launch Target Application
View class model
User launches a Java application after defining a launch configuration for it.
The launch configuration allows user to specify which packages/classes/methods will be recorded in an execution trace of the launched application
The user instructs the launched application to start collecting trace of its execution. System starts recording method entry/exit events.
User instructs launched application to stop collecting trace. System generates UML model fi les from the collected trace.
The part of the launched application for which trace data is collected is referred to as a scenario.
View package diagram
View class diagram
View sequence diagram
![Page 5: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/5.jpg)
Core functionalities
Collector
Collect execution trace from
running application
Analyzer
Generate UML model
files
Ui
Visualizer
Render model files as
UML diagrams
Each Core functionality is implemented as an Eclipse plug-in.
Interface between plug-ins is through extension-points.
![Page 6: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/6.jpg)
Plug-ins and their dependenciesid brue plug-ins
brue
«plug-in»
core
«plug-in»
collector
«plug-in»
analyzer
«plug-in»
visualizer
«plug-in»
ui
instrumenter
traceDataController
traceDataController
visualizer
![Page 7: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/7.jpg)
Use-Case 1
cd Use Case - 1
User
Launch Target Application
User launches a Java application after defining a launch configuration for it.
The launch configuration allows user to specify which packages/classes/methods will be recorded in an execution trace of the launched application
![Page 8: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/8.jpg)
Plug-in CollectorResponsibilities
Defining BRUE Launch configuration Can specify which packages/classes/methods to
instrument
Instrumenting application Uses Eclipse Probekit to instrument class files
Launching application Uses Eclipse launch configuration delegates to launch
Java applications.
![Page 9: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/9.jpg)
Plug-in CollectorPackage Diagram
cd collector
collector
(from brue)
«plugin»launcher
«plugin»instrumenter
«plugin»core
(from brue)
«realize»
«realize»
extension-pointinstrumenter
extension-pointtraceDataController
![Page 10: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/10.jpg)
Plug-in CollectorLaunch configuration
![Page 11: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/11.jpg)
Plug-in CollectorInstrumentation
Instruments class files Uses Eclipse Probekit
for instrumentation.Records Method
Entry and Method Exit events Method exit event
includes actual return type, and any exception thrown.
Attaches Probekit.jar to running application.
cd collector dependency
collector
(from brue)
Eclipse Probekit
(from brue)
![Page 12: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/12.jpg)
Plug-in CollectorLaunching Java application
cd launching jav a application
Classes provided by Eclipse to help launch a Java application
«plugin»launcher
(from collector)
BRUELaunchDelegate org.eclipse.jdt.launching.Jav aLaunchDelegate
Takes care of launching a Java application
BRUETabGroup org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup
BRUELauncherTab org.eclipse.jdt.debug.ui.
launchConfigurations.Jav aLaunchTab
Common function for launch configuration tab groups
Provides common functionality for Java launch operations
«extension point»core::brue.core.
instrumenter
«instantiate»
«call»
![Page 13: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/13.jpg)
Plug-in CollectorInteraction between launcher and instrumenter
sd Instrumenting and launching a Jav a Application
Plugin:brue.collector.instrumenter
Eclipse PDEPlugin: brue.collector.launcher
User
BRUELauncherTab
User specifies which classes, packages, and methods need to beincluded or excluded from tracedata collection and hits Apply
IPluginRegistry InstrumenterImplBRUELaunchDelegate
Users hits OKto launch Javaapplication
Validate user input. Onerrors, show approprirate messages in the launch dialog.
performApply
validate
save
launch
launch
getExtension( "brue.core.instrumenter")
Return brue.collector.instrumenter plug-in
instrumentUse EclipseProbekit toinstrumentspecified classes
super.launch
![Page 14: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/14.jpg)
Use-case 2
Need to control when to start or stop trace data collection.
ud Use Case - 2
User
Collect trace information for a
scenario
The user instructs the launched application to start collecting trace of its execution. System starts recording method entry/exit events.
User instructs launched application to stop collecting trace. System generates UML model fi les from the collected trace.
The part of the launched application for which trace data is collected is referred to as a scenario.
![Page 15: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/15.jpg)
Plug-in CollectorControlling when to collect trace data
Agent class On a thread, from within the launched application,
listen for requests from BRUE plug-in. Maintain flags for enabling or disabling trace data
collection.cd Controlling trace data collection
Thread
Agent
+ getInstance() : Agent+ isTraceDataCollectionEnabled() : boolean+ setTraceDataCollectionEnabled(boolean) : void- setUp() : void- Agent()+ run() : void
AgentCommunicationHandler
+ start() : void+ addMessageListener(BRUEMessageProcessor) : void- l istenOnSocket(ServerSocket) : void- notifyMessageReceived(String) : void- createServerSocket(int) : ServerSocket- getBrueCommunicationPort() : int- printDiagnosticsError(String, Exception) : void
StartScenarioCommandHandler
+ handle(String, Agent) : void
StopScenarioCommandHandler
+ handle(String, Agent) : void
BRUEMessageProcessor
+ messageReceived(String) : void
-AGENT
«use»«use»
![Page 16: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/16.jpg)
Controlling trace data collection
sd Controlling trace data collection
collector package
User
«plugin»
ui
«plugin»
instrumenter
Launched application is notified tostart collect trace information. Collected trace information is written to a fi le in XML format. Thefile is referred to as trace XML fi le.
Instrumenter plugin notifies the launched application to stop collecting trace information. The trace XML fi le is saved and closed.
plugin
Generates UML model from Trace XML
context menu action ("Start senario")
startTraceDataCollection(context)
context menu action ("Stop Scenario")
stopTraceDataCollection(context)
analyzeTraceData
![Page 17: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/17.jpg)
Trace XML Structure
A “Scenario” contains a trace of method entry and method exit events.
The events references an id that describes the method details (method name, signature, return type, its class name, package name).
![Page 18: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/18.jpg)
Trace XML Structure
cd Scenario data model
Scenario
+ title: string
MethodTableTraceMethodTableItem
+ className: string+ methodName: string+ signature: string+ id: string
MethodEntry
+ id: string
MethodExit
+ id: string+ returnType: string+ exceptionType: string
1
1
1
1
0..*1
0..*
1
0..*
1
![Page 19: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/19.jpg)
Generating UML2 Model files
Parse trace xml file.Extract packages and classes from trace xml
fileBuild UML2 based package modelBuild UML2 based class modelBuild UML2 based interaction model
cd analyzer dependencies
«plugin»analyzer
(from brue)
UML2
(from brue)
![Page 20: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/20.jpg)
Building UML2 Models
Use of Builder patterncd builders for UML2 model
ModelBuilder
+ ModelBuilder()+ build(Scenario) : void+ getModel() : Model+ printAttributeValues(PrintStream, EObject) : void+ initializeResource() : void+ importPrimitiveTypes() : void
ModelBuilderType
+ CLASS_BUILDER: int = 0+ PACKAGE_BUILDER: int = 1+ INTERACTION_BUILDER: int = 2
ModelBuilderFactory
+ getInstance() : ModelBuilderFactory+ getBuilder(int) : ModelBuilder
structural::ClassModelBuilder
+ build(Scenario) : void
structural::StructuralModelBuilder
+ StructuralModelBuilder()+ buildPackage(MethodTableItem) : Package
structural::PackageModelBuilder
+ build(Scenario) : void
behav ioral::InteractionModelBuilder
+ build(Scenario) : void
-MODEL_BUILDER_FACTORY
«use»
![Page 21: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/21.jpg)
Use-case 3
cd Use Case - 3
User
Visualize scenario
View package model
View interaction model
View class model
View package diagram
View class diagram
View sequence diagram
![Page 22: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/22.jpg)
Package diagram and class diagram
Eclipse GMF used to draw packages and classes
Model – UML2 model generated from analyzer
Graphical definition file Contains properties for graphical notations (rectangle,
polyline)Graphical mapping definition
Maps UML2 model elements with graphical notations.Eclipse GMF builds a editor based on the
mapping. (Pending).
![Page 23: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/23.jpg)
Viewing Interaction Diagrams
Use of Eclipse GEFSequence diagrams is not freeform and
should conform to UML2 specifications.GEF applications follow MVC paradigm
Model EditPart (Controller) Figure (View)
![Page 24: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/24.jpg)
Sequence diagram Models
cd model for sequence diagram
EObject
«interface»
AbstractUMLModel
+ getBackgroundColor() : Color+ getForegroundColor() : Color+ isIconShown() : boolean
«interface»
AbstractUMLConnectionModel
+ getSource() : AbstractUMLNodeModel+ getTarget() : AbstractUMLNodeModel+ attachSource() : void+ detachSource() : void+ attachTarget() : void+ detachTarget() : void
«interface»
AbstractUMLNodeModel
+ getConstraint() : Rectangle+ getSourceConnections() : EList+ getTargetConnections() : EList+ isHidden() : boolean
«interface»
ActivationModel
+ getChildActivations() : EList+ getOwner() : ActivationModel+ getOwnerLine() : LifelineModel+ isMovable() : boolean
«interface»
LifelineModel
+ getActivations() : EList+ getOwner() : InstanceModel
RootModel
«interface»
InteractionModel
+ getInstances() : EList+ getActivations() : EList+ getLifelines() : EList+ getNotes() : EList+ getMessages() : EList
«interface»
MessageModel
+ getName() : String+ isDirectionLeftToRight() : boolean+ calculateDirection() : void+ areSourceAndTargetSame() : boolean
«interface»
InstanceModel
+ getLifeline() : LifelineModel+ getRoot() : InteractionModel+ getCreator() : MessageModel+ getName() : String+ getActive() : ActivationModel
![Page 25: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/25.jpg)
Sequence DiagramsEditparts
One Edit part per Model
cd editparts
AbstractConnectionEditPart
AbstractUMLConnectionEditPart
AbstractGraphicalEditPartAdapter
AbstractUMLEditPart
AbstractUMLNodeEditPart
NodeEditPart
Activ ationEditPart
AnchorEditPart
InstanceEditPartInteractionEditPart LifelineEditPart
MessageEditPart
![Page 26: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/26.jpg)
Sequence DiagramFigures
cd figures for sequence diagram
RectangleFigure
Activ ationFigure
ActorFigure
Figure
InstanceFigureFigure
LifelineFigure
PolylineConnection
MessageFigure
AbstractRouter
Recursiv eRouter
ReturnMessageFigure
«interface»
NodeFigure
«interface»
PresentationFigure
For self calls
Lifelines are just dashed lines
Enforces subclasses to implement labels representing their names
Enforces subclasses to refresh themselves with element display properties (background/foreground color, etc).
Figure classes for Sequence diagram
![Page 27: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/27.jpg)
Drawing a sequence diagramSequenceDiagramEditor
sd Drawing sequence diagram
User
editors::SequenceDiagramEditor editparts::SequenceDiagramEditPartFactory
«interface»
model::InteractionModel
editparts::InteractionEditPart
figures::LifelineFigure
Opens a sequence diagram fi le
create
EditPart:= createEditPart(editPart,model)
IFigure:= createFigure()
paint(graphics)
List:= getModelChildren()
![Page 28: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/28.jpg)
Artifacts
Test Plan Use of Junit Planned to use Eclipse TPTP for measuring test
coverageFormal specification
Positioning of sequence diagram model elementsProject Plan
Planning for Presentation 3 in September third week.
![Page 29: PRESENTATION 2 Sri Raguraman CIS 895 Kansas State University](https://reader030.vdocuments.us/reader030/viewer/2022032803/56649e3b5503460f94b2d0ab/html5/thumbnails/29.jpg)
Demo