1 / 48

INF 123: Software Architectures, Distributed Systems, and Interoperability

INF 123: Software Architectures, Distributed Systems, and Interoperability. Discussion Session Week 4 - Spring 2008 Instructor: Prof. Richard N. Taylor TA: Rosalva Gallardo. Overview. Questions about Assignment 1 ArchStudio 4 Hello World Demo using ArchStudio 4 and Myx.fw.

jules
Download Presentation

INF 123: Software Architectures, Distributed Systems, and Interoperability

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 4 - Spring 2008 Instructor: Prof. Richard N. Taylor TA: Rosalva Gallardo

  2. Overview • Questions about Assignment 1 • ArchStudio 4 • Hello World Demo using ArchStudio 4 and Myx.fw

  3. Questions 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? ==> Post your questions in the Noteboard and check it often

  4. ArchStudio 4An Introductory Tutorial Slides adapted from Hazel Asuncion

  5. Roadmap • 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

  6. What 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/

  7. Just Another IDE? • No, it complements existing IDEs like Eclipse • Minimize architectural drift “Architectural drift: is the introduction of principal design decisions into a system’s descriptive architecture that are not included in, encompassed by, or implied by the prescriptive architecture, but which do not violate any of the prescriptive architecture’s design decisions… If not properly addressed, architectural drift will eventually result in architectural erosion.” [Taylor et al, 2009] • Built on its own architecture style

  8. Concepts • xADL 2.0 • Data Bindings • Myx Architectural Style

  9. xADL 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/xadl2.htmlhttp://www.ics.uci.edu/~edashofy/papers/icse2002-presentation.ppt http://www.isr.uci.edu/projects/xarchuci/

  10. xADL 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/icse2002-presentation.ppt

  11. xADL 2.0: CM/Product Family Arch Ref: http://www.ics.uci.edu/~edashofy/papers/icse2002-presentation.ppt

  12. xADL 2.0: Implementation Mapping ArchStudio 4 currently supports mapping to Java files Ref: http://www.ics.uci.edu/~edashofy/papers/icse2002-presentation.ppt

  13. XML • 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

  14. xADL 2.0 Core Model <archStructure id="archStructure90164" type="types:ArchStructure"> <description>main</description> <component id="componentffa805157" type="types:Component"> <description>Server</description> <interface id="interfaceffa80123" type="types:Interface"> <description>getResource</description> <direction>in</direction> </interface> </component> <component id="componentffa12852" type="types:Component"> <description>Client</description> <interface id="interfaceffa57518" type="types:Interface"> <description>getResource</description> <direction>out</direction> </interface> </component> <connector id="connectorffa12435" type="types:Connector"> <description>HTTP</description> <interface id="interfaceffa54685" type="types:Interface"> <description>getResource</description> <direction>in</direction> </interface> <interface id="interfaceffa54686" type="types:Interface"> <description>getResource</description> <direction>out</direction> </interface> </connector> </archStructure> Server HTTP Client

  15. xADL 2.0 Components Server <component id="componentffa805157" type="types:Component"> <description>Server</description> <interface id="interfaceffa80123" type="types:Interface"> <description>getResource</description> <direction>in</direction> </interface> </component> <component id="componentffa12852" type="types:Component"> <description>Client</description> <interface id="interfaceffa57518" type="types:Interface"> <description>getResource</description> <direction>out</direction> </interface> </component> HTTP Client

  16. xADL 2.0 Connector Server <connector id="connectorffa12435" type="types:Connector"> <description>HTTP</description> <interface id="interfaceffa54685" type="types:Interface"> <description>getResource</description> <direction>in</direction> </interface> <interface id="interfaceffa54686" type="types:Interface"> <description>getResource</description> <direction>out</direction> </interface> </connector> HTTP Client

  17. xADL 2.0 Interfaces <component id="componentffa805157" type="types:Component"> <description>Server</description> <interface id="interfaceffa80123" type="types:Interface"> <description>getResource</description> <direction>in</direction> </interface> </component> <component id="componentffa12852" type="types:Component"> <description>Client</description> <interface id="interfaceffa57518" type="types:Interface"> <description>getResource</description> <direction>out</direction> </interface> </component> <connector id="connectorffa12435" type="types:Connector"> <description>HTTP</description> <interface id="interfaceffa54685" type="types:Interface"> <description>getResource</description> <direction>in</direction> </interface> <interface id="interfaceffa54686" type="types:Interface"> <description>getResource</description> <direction>out</direction> </interface> </connector> Server HTTP Client

  18. Data 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/icse2002-presentation.ppt

  19. Data Binding Library Ref: Dashofy, E., Asuncion, H., et al. ArchStudio 4: An Architecture-Based Meta-modeling Environment. ICSE 2007 Demo Paper.

  20. Myx 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/myx.html

  21. Myx 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/resources/myx-whitepaper.pdf

  22. Myx 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

  23. Myx.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

  24. Implementing 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

  25. Implementing 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

  26. Component 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

  27. Component 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

  28. Toolset 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

  29. ArchStudio 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

  30. xArchADT – Data Store Live integration between tools ArchStudio Tools Ref:

  31. Using ArchStudio • Hello World Demo

  32. Hello 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

  33. 1. Create Architecture • In Eclipse, go to ArchStudio Perspective • Create a new project. File->New->Project. General->Project. Next. • Project Name: HelloWorldProject. Finish

  34. 1. Create Architecture • Right-click on the Project and select New->Other…ArchStudio 4 -> ArchStudio architecture Description • File Name: Architecture.xml. Finish. • Open the xml file with Archipelago.

  35. 1.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

  36. 1.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

  37. 2. Add Component • In the Outline View, double click on the HelloWorld structure • Right click on the Archipelago View and Select New Component

  38. 2.1 Edit description • Right click on the new component. Select Edit Description… • New Description: HelloWorld

  39. 2.2 Assign type to component • Select HelloWorldType in the Outline View. Drag it and drop it on the HelloWorld component.

  40. 3. Map Architecture to Implementation • In the Navigator View, right click on the xml file. Open With->ArchEdit • In the Outline View, Expand Xarch, Arch Types, Component Type [HelloWorldType]. Right click on it. Select Promote to VariantComponentTypeImpl

  41. 3. 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

  42. 3. 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

  43. 4. Write Java Class • Create Java Project. File->New->Java Project. • Project Name: HelloWorld. Next. • Click on Projects, Add.. Check edu.uci.isr.myx.fw. OK and Finish.

  44. 4. Write Java Class • Right click on HelloWorld project and select New-> Class • Class Name: Hello World. Finish.

  45. 4. 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 //we will return null. //if(name.equals(INTERFACE_NAME_IN_NAME)){ // return this; //} return null; } }

  46. 5. Move XML file to Java Project • Create “arch” folder in HelloWorld/src • Move (drag and drop)Architecture.xml from HelloWorldProject to HelloWorld/src/arch

  47. 6. 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

  48. 6. Run Hello World • You should see the following output in the Console

More Related