brue
DESCRIPTION
BRUE. Presentation 2 Sri Raguraman CIS 895 Kansas State University. Overview of Presentation. Overall flow. Critical use-cases. Core functionalities. Each Core functionality is implemented as an Eclipse plug-in. Interface between plug-ins is through extension-points. - PowerPoint PPT PresentationTRANSCRIPT
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
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
Overall flow
• Launch application
• Collect execution trace• XML format
Collect trace
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
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.
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
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
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.
Plug-in CollectorPackage Diagram
cd collector
collector
(from brue)
«plugin»launcher
«plugin»instrumenter
«plugin»core
(from brue)
«realize»
«realize»
extension-pointinstrumenter
extension-pointtraceDataController
Plug-in CollectorLaunch configuration
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)
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»
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
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.
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»
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
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).
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
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)
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»
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
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).
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)
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
Sequence DiagramsEditparts
One Edit part per Model
cd editparts
AbstractConnectionEditPart
AbstractUMLConnectionEditPart
AbstractGraphicalEditPartAdapter
AbstractUMLEditPart
AbstractUMLNodeEditPart
NodeEditPart
Activ ationEditPart
AnchorEditPart
InstanceEditPartInteractionEditPart LifelineEditPart
MessageEditPart
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
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()
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.
Demo