Title: INF 123: Software Architectures, Distributed Systems, and Interoperability
1INF 123 Software Architectures, Distributed
Systems, and Interoperability
- Discussion Session
- Week 4 - Spring 2008
- Instructor Prof. Richard N. Taylor
- TA Rosalva Gallardo
2Overview
- Questions about Assignment 1
- ArchStudio 4
- Hello World Demo using ArchStudio 4 and Myx.fw
3Questions about Assignment 1
- How our answer for 2.2 should look like? Should I
include code details? - How many types of connector do we have for 2.3?
- Any other questions?
- gt Post your questions in the Noteboard and
check it often
4ArchStudio 4An Introductory Tutorial
- Slides adapted from Hazel Asuncion
5Roadmap
- What is ArchStudio 4
- Concepts
- xADL 2.0
- Data Bindings
- Myx Architectural Style
- Toolset integrated with Eclipse
- Eclipse plug-in
- AIM Launcher
- ArchEdit
- Archipelago
- ArchLight
- Selector
- Type Wrangler
- Using ArchStudio
- Hello World Demo
6What is ArchStudio 4?
- Architecture-centric IDE
- Open-source
- Eclipse plug-in
- Integrated tools for software architecture
- Modeling
- Visualization
- Analysis
- Implementation
Ref http//www.isr.uci.edu/projects/archstudio/
7Just Another IDE?
- No, it complements existing IDEs like Eclipse
- Minimize architectural drift
- Architectural drift is the introduction of
principal design decisions into a systems
descriptive architecture that are not included
in, encompassed by, or implied by the
prescriptive architecture, but which do not
violate any of the prescriptive architectures
design decisions - If not properly addressed, architectural drift
will eventually result in architectural erosion.
Taylor et al, 2009 - Built on its own architecture style
8Concepts
- xADL 2.0
- Data Bindings
- Myx Architectural Style
9xADL 2.0
- Architectural Description Language in XML
developed by ISR at UCI - This ADL is defined in a set of XML Schemas
- Modeling language behind ArchStudio
- Modular and highly extensible
- Core models
- Components (computation)
- Connectors (communication)
- Interfaces (the exposed entry and exit points for
components and connectors) - Configurations (topology)
Ref http//www.isr.uci.edu/projects/archstudio/xa
dl2.html http//www.ics.uci.edu/edashofy/papers
/icse2002-presentation.ppt http//www.isr.uci.edu
/projects/xarchuci/
10xADL 2.0
- Tools can access the architecture description in
xADL 2.0 via a common interface, the component
xArchADT. - Base xArch Instances Core
- Extensions
- Architecture structures and types
- Product Families versions, options, variants
- Implementation mappings architecture types to
implementations
Ref http//www.ics.uci.edu/edashofy/papers/icse2
002-presentation.ppt
11xADL 2.0 CM/Product Family Arch
Ref http//www.ics.uci.edu/edashofy/papers/icse2
002-presentation.ppt
12xADL 2.0 Implementation Mapping
ArchStudio 4 currently supports mapping to Java
files
Ref http//www.ics.uci.edu/edashofy/papers/icse2
002-presentation.ppt
13XML
- eXtensible Markup Language
- Means of representing structured data
- Looks like HTML but the tags are user-defined
- Schema
- Describe data in the XML doc
- The rules for the XML doc
Ref http//www.w3schools.com/xml/default.asp
14xADL 2.0 Core Model
ltarchStructure id"archStructure90164"
type"typesArchStructure"gt ltdescriptiongtmainlt/d
escriptiongt ltcomponent id"componentffa805157"
type"typesComponent"gt ltdescriptiongtServerlt/d
escriptiongt ltinterface id"interfaceffa80123"
type"typesInterface"gt ltdescriptiongtgetRes
ourcelt/descriptiongt ltdirectiongtinlt/directio
ngt lt/interfacegt lt/componentgt ltcomponent
id"componentffa12852" type"typesComponent"gt
ltdescriptiongtClientlt/descriptiongt
ltinterface id"interfaceffa57518"
type"typesInterface"gt ltdescriptiongtgetReso
urcelt/descriptiongt ltdirectiongtoutlt/directio
ngt lt/interfacegt lt/componentgt ltconnector
id"connectorffa12435" type"typesConnector"gt
ltdescriptiongtHTTPlt/descriptiongt ltinterface
id"interfaceffa54685" type"typesInterface"gt
ltdescriptiongtgetResourcelt/descriptiongt
ltdirectiongtinlt/directiongt lt/interfacegt
ltinterface id"interfaceffa54686"
type"typesInterface"gt ltdescriptiongtgetReso
urcelt/descriptiongt ltdirectiongtoutlt/directio
ngt lt/interfacegt lt/connectorgt lt/archStructur
egt
Server
HTTP
Client
15xADL 2.0 Components
Server
ltcomponent id"componentffa805157"
type"typesComponent"gt ltdescriptiongtServerlt/d
escriptiongt ltinterface id"interfaceffa80123"
type"typesInterface"gt ltdescriptiongtgetRes
ourcelt/descriptiongt ltdirectiongtinlt/directio
ngt lt/interfacegt lt/componentgt ltcomponent
id"componentffa12852" type"typesComponent"gt
ltdescriptiongtClientlt/descriptiongt
ltinterface id"interfaceffa57518"
type"typesInterface"gt ltdescriptiongtgetReso
urcelt/descriptiongt ltdirectiongtoutlt/directio
ngt lt/interfacegt lt/componentgt
HTTP
Client
16xADL 2.0 Connector
Server
ltconnector id"connectorffa12435"
type"typesConnector"gt ltdescriptiongtHTTPlt/des
criptiongt ltinterface id"interfaceffa54685"
type"typesInterface"gt ltdescriptiongtgetReso
urcelt/descriptiongt ltdirectiongtinlt/direction
gt lt/interfacegt ltinterface
id"interfaceffa54686" type"typesInterface"gt
ltdescriptiongtgetResourcelt/descriptiongt
ltdirectiongtoutlt/directiongt lt/interfacegt
lt/connectorgt
HTTP
Client
17xADL 2.0 Interfaces
ltcomponent id"componentffa805157"
type"typesComponent"gt ltdescriptiongtServerlt/d
escriptiongt ltinterface id"interfaceffa80123"
type"typesInterface"gt ltdescriptiongtgetRes
ourcelt/descriptiongt ltdirectiongtinlt/directio
ngt lt/interfacegt lt/componentgt ltcomponent
id"componentffa12852" type"typesComponent"gt
ltdescriptiongtClientlt/descriptiongt
ltinterface id"interfaceffa57518"
type"typesInterface"gt ltdescriptiongtgetReso
urcelt/descriptiongt ltdirectiongtoutlt/directio
ngt lt/interfacegt lt/componentgt ltconnector
id"connectorffa12435" type"typesConnector"gt
ltdescriptiongtHTTPlt/descriptiongt ltinterface
id"interfaceffa54685" type"typesInterface"gt
ltdescriptiongtgetResourcelt/descriptiongt
ltdirectiongtinlt/directiongt lt/interfacegt
ltinterface id"interfaceffa54686"
type"typesInterface"gt ltdescriptiongtgetReso
urcelt/descriptiongt ltdirectiongtoutlt/directio
ngt lt/interfacegt lt/connectorgt
Server
HTTP
Client
18Data Bindings
- A set of Java classes that can be used to create
and manipulate architecture descriptions - Generated by Apigen tool, based on XML schemas
- Reduces the complexity of editing architecture
descriptions by hiding the XML and providing
constructs more familiar to architects - Parses from and serializes to XML
- Data Binding API
- Components
- Connectors
- Interfaces
- Links
- Configurations
- etc.
- XML API (DOM, SAX)
- Elements
- Attributes
- Documents
- Namespaces
vs.
Ref http//www.ics.uci.edu/edashofy/papers/icse2
002-presentation.ppt
19Data Binding Library
Ref Dashofy, E., Asuncion, H., et al.
ArchStudio 4 An Architecture-Based Meta-modeling
Environment. ICSE 2007 Demo Paper.
20Myx Architecture Style
- Purpose
- Support building flexible, high performance
tool-integrating environments - Serve as a foundation for building environments
in Eclipse - Heritage
- Borrows most of key properties from C2 style
- System implementation currently supported in
ArchStudio 4
Ref http//www.isr.uci.edu/projects/archstudio/my
x.html
21Myx Architectural Style
- Rules
- Components are the loci of computation
- Connectors are the loci of communication
- Components communicate only through well-defined
provided and required interfaces - Components and connectors have two faces top
and bottom - Components interact through three distinct
patterns - Synchronous bottom-to-top procedure call
- Asynchronous top-to-bottom (notification)
messaging - Asynchronous bottom-to-top (request) messaging
- Components may only make assumptions about the
services provided above them, and may make no
assumptions about the services provided below
them. - Applications have at least one main thread of
control. Additional threads may be created by
components as necessary. Asynchronous connectors
also have their own threads. - Shared Memory
Ref http//www.isr.uci.edu/projects/archstudio/re
sources/myx-whitepaper.pdf
22Myx Architectural Style
- Benefits
- Easy to reuse - components are relatively
independent of each other - Easy to reconfigure communication only via
explicit interfaces - Enables runtime modification through dynamic
proxies and event pumps
23Myx.fw Framework
- Difficult to adhere to the constraints of a style
using an existing programming language - Bridge the gap between Myx and Java myx.fw
- Component and Connectors implement IMyxBrick
interface
Ref http//www.ics.uci.edu/edashofy/classes/211/
myx-assignment.ppt
24Implementing a myx.fw component
- Components have main classes that implement
IMyxBrick - They may have as many auxiliary classes as you
want - The main class may just be a wrapper for services
provided internally
AbstractMyxSimpleBrick
IMyxBrick
implements
extends
LunarLanderComponents
Ref http//www.ics.uci.edu/edashofy/classes/211/
myx-assignment.ppt
25Implementing a myx.fw component
- Components have three main jobs
- Store data from the framework (IMyxBrickItems)
- Implement lifecycle methods (init, begin, end,
destroy) - Provide true objects for all provided interfaces
Ref http//www.ics.uci.edu/edashofy/classes/211/
myx-assignment.ppt
26Component Jobs
- Store IMyxBrickItems from the framework
- The framework needs to store some data about the
component along with the component - Abstract base classes take care of this for you
- Implement lifecycle methods
- Called by the framework when the architecture is
in particular states - init() Brick is created
- begin() Brick is wired into the architecture and
ready to start - end() Brick is about to be unwired and shut down
- destroy() Brick is about to be dismissed
Ref http//www.ics.uci.edu/edashofy/classes/211/
myx-assignment.ppt
27Component Jobs
- Provide true objects for each provided interface
- Each provided/required interface has a name
- The framework will occasionally ask a component
give me the object that corresponds to this
provided interface - Likewise, a component may request, from the
framework, the true object corresponding to one
of its required interfaces
Ref http//www.ics.uci.edu/edashofy/classes/211/
myx-assignment.ppt
28Toolset Integrated with Eclipse
- Eclipse plug-in
- ArchStudio Perspective
- AIM Launcher launch the system in development
within ArchStudio - ArchEdit
- Visualization
- Tree-view schema driven
- Indicate implementation mappings
- Archipelago
- Visualization and modeling
- Boxes and arrows
- ArchLight - analysis
- Selector product Families
- Type Wrangler consistency checks between types
and instances
29ArchStudio 4.0
- Built on its own tools and technologies
- Architecture specified in xADL 2.0
- Upon invocation
- Bootstrapper parses the ArchStudio xADL file
using the Data Binding Library - Bootstrapper steps through xADL file and
instantiates the various components
30ArchStudio Tools
- xArchADT Data Store
- Live integration between tools
Ref
31Using ArchStudio
32Hello World Demo
- 1. Create Architecture
- 1.1 Create Structure
- 1.2 Create Types Set and Component Type
- 2. Add component
- 2.1 Edit description
- 2.2 Assign type to component
- 3. Map Architecture to Implementation
- 4. Write HelloWorld Java class
- 5. Move xml file to Java Project
- 6. Run Hello World
331. Create Architecture
- In Eclipse, go to ArchStudio Perspective
- Create a new project. File-gtNew-gtProject.
General-gtProject. Next. - Project Name HelloWorldProject. Finish
341. Create Architecture
- Right-click on the Project and select
New-gtOtherArchStudio 4 -gt ArchStudio
architecture Description - File Name Architecture.xml. Finish.
- Open the xml file with Archipelago.
351.1 Create Structure
- On the Outline View, expand the root element.
Right click on Structures. Select New Structure. - Expand Structures. Right click on the new
Structure and select Edit Description. - New Description HelloWorld
361.2 Create Type Set and Component Type
- On the Outline View, select the root element.
Right click on it. Select Create Type Set. - Expand Types. Right click on Component Types and
select New Component Type. - Select the new Type. Right click on it and select
Edit Description. - New Description HelloWorldType
372. Add Component
- In the Outline View, double click on the
HelloWorld structure - Right click on the Archipelago View and Select
New Component
382.1 Edit description
- Right click on the new component. Select Edit
Description - New Description HelloWorld
392.2 Assign type to component
- Select HelloWorldType in the Outline View. Drag
it and drop it on the HelloWorld component.
403. Map Architecture to Implementation
- In the Navigator View, right click on the xml
file. Open With-gtArchEdit - In the Outline View, Expand Xarch, Arch Types,
Component Type HelloWorldType. Right click on
it. Select Promote to VariantComponentTypeImpl
413. Map Architecture to Implementation
- Similarly, right click on Component Type
HelloWorld Type. Select Add Implementation. - Right click on Implementation and select Promote
to JavaImplementation - Right click on Implementation and select Add Main
Class
423. Map Architecture to Implementation
- Right click on Main Class and select Add
JavaClassName - Expand MainClass and double click on Java
ClassName and enter HelloWorld as a value
434. Write Java Class
- Create Java Project. File-gtNew-gtJava Project.
- Project Name HelloWorld. Next.
- Click on Projects, Add.. Check edu.uci.isr.myx.fw.
OK and Finish.
444. Write Java Class
- Right click on HelloWorld project and select
New-gt Class - Class Name Hello World. Finish.
454. Write Java Class
- Copy the following content in HelloWorld.java and
Save the file - import edu.uci.isr.myx.fw.AbstractMyxSimpleBrick
- import edu.uci.isr.myx.fw.IMyxName
- import edu.uci.isr.myx.fw.MyxUtils
- public class HelloWorld extends
AbstractMyxSimpleBrick - // category constructor
- public HelloWorld( )
- // category startup and cleanup
- public void init()
- public void begin()
-
- System.out.println("Hello world!")
-
- public void end()
- public void destroy()
- // override a required method
- public Object getServiceObject(IMyxName name)
- //Since we are not implementing an interface in
this class
465. Move XML file to Java Project
- Create arch folder in HelloWorld/src
- Move (drag and drop)Architecture.xml from
HelloWorldProject to HelloWorld/src/arch
476. Run Hello World
- In the Navigator View, right click on
Architecture.xml, select Open With AIM Launcher - In the Outline View, double click on HelloWorld
- Click on Instantiate
486. Run Hello World
- You should see the following output in the Console