1 / 48

INF 123: Software Architectures, Distributed Systems, and Interoperability

INF 123: Software Architectures, Distributed Systems, and Interoperability. Discussion Session Week 5 - Spring 2008 Instructor: Prof. Richard N. Taylor TA: Rosalva Gallardo. Overview. Assignment 2 Update ArchStudio 4 Create Branch in SVN Demo using ArchStudio 4 and Myx.fw

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 5 - Spring 2008 Instructor: Prof. Richard N. Taylor TA: Rosalva Gallardo

  2. Overview • Assignment 2 • Update ArchStudio 4 • Create Branch in SVN • Demo using ArchStudio 4 and Myx.fw • Hello World with 2 components and 1 connector

  3. Assignment 2 • It is published in the class website

  4. Update ArchStudio 4 • Help -> Software Updates -> Find and Install • Select Search for new features to install. Next • New Remote Site… • Name: ArchStudio 4 (Dev) • URL: http://www.isr.uci.edu/projects/archstudio-update-dev • Select to install all the options => After you are done with this update, you will not need to run ArchStudio from the source code. Close the ArchStudio projects (see next slide) and Instantiate the LL architecture using the AIM Launcher. You will see that we do not require a new instance of Eclipse now :)

  5. Close ArchStudio Projects Source Code • In the Package Explorer, select all the projects that start with edu.uci.*, except for edu.uci.isr.myx.fw • Go to Project -> Close Project

  6. Create Branch in SVN • Go to the SVN Repository Exploring • Select LunarLander in trunk. Right click and select Branch/Tag

  7. Create Branch in SVN • Modify the To URL. Make sure it refers to <your_repository>/tags/LunarLanderAssignment1 • Refresh your repository to see the new folder in tags

  8. Demo using ArchStudio 4 and Myx.fw • Hello World with 2 components and 1 connector

  9. Hello World Demo • 1. Create Architecture • 1.1 Create Structure • 1.2 Create Types Set • 2. Add Types and Signatures • 2.1 For Components • 2.2 For Connector • 2.3 For Interface • 3. Add Components and Connector • 4. Assign Types and Map Signature and Interfaces • 4.1 For Components • 4.2 For Connector

  10. Hello World Demo • 5. Create Links • 6. Map Architecture to Implementation • 6.1 For Components • 6.1.1 For Component Signatures • 6.2 For Connector • 6.2.1 For Connector Signatures • 6.4 For Interface • 7. Write Java classes and interfaces • 7.1 For Components • 7.2 For Interface • 8. Run Hello World • Important considerations: • Each time you add or modify something in the xml file, SAVE IT • When you switch between Archipelago and ArchEdit, or vice versa, make sure that you close the one you are not using.

  11. 1. Create Architecture • Create Java Project. File->New->Java Project. • Project Name: HelloWorld2. Next. • Click on Projects, Add.. Check edu.uci.isr.myx.fw. OK and Finish.

  12. 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.

  13. 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: HelloWorld2

  14. 1.2 Create Type Set • On the Outline View, select the root element. Right click on it. Select Create Type Set.

  15. 2. Add Types and Signatures2.1 For Components • 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: Message Sender Type

  16. 2. Add Types and Signatures2.1 For Components Create Signature • Double click on “Message Sender Type.” • Right click on the component and select New Signature. • Similarly, create the Component Type: Message Receiver Type and add a signature

  17. 2. Add Types and Signatures2.2 For Connector • Expand Types. Right click on Connector Types and select New Connector Type. • Select the new Type. Right click on it and select Edit Description. • New Description: Proxy Type

  18. 2. Add Types and Signatures2.2 For Connector Create Signature • Double click on “Proxy Type.” • Right click on the connector and select New Signature. Repeat this step to create another Signature.

  19. 2. Add Types and Signatures2.3 For Interface • Expand Types. Right click on Interface Types and select New Interface Type. • Select the new Type. Right click on it and select Edit Description. • New Description: Message Type

  20. 3. Add Components and Connector Add Components • In the Outline View, double click on the HelloWorld2 structure • Right click on the Archipelago View and Select New Component

  21. 3. Add Components and Connector • Right click on the new component. Select Edit Description… • New Description: Message Sender • Similarly, create another Component with the description: Message Receiver

  22. 3. Add Components and Connector Add Connector • Right click on the Archipelago View and Select New Connector • Right click on the new connector. Select Edit Description… • New Description: Proxy

  23. 4. Assign Types and Map Sig4.1 For Components • Right click on Architecture.xml. Open with… Type Wrangler • In the Outline, expand HelloWorld2 • Double click on Message Sender. Click on Assign Type button. Select Message Sender Type. OK.

  24. 4. Assign Types and Map Sig4.1 For Components • In the Unmapped Signatures box: • Rename the signature [New Signature] to “messages” • Set its direction to “out” • Set its type to “Message Type”

  25. 4. Assign Types and Map Sig4.1 For Components • Select the “messages” signature and create a corresponding interface for the component by using the “< Create” button • You will see “messages” in the Mapped Interfaces and Signatures

  26. 4. Assign Types and Map Sig4.1 For Components • Similarly, assign the Type Message Receiver Type to Message Receiver, rename the signature to “messages” with direction “in” and type Message Type, and create the interface. • You should have the following Mapped Interfaces and Signatures for Message Receiver

  27. 4. Assign Types and Map Sig4.2 For Connector • Double click on Proxy. Click on Assign Type button. Select Proxy Type. OK. • Rename the Unmapped Signatures as shown: • Signature: in, Direction: in, Type: Message Type • Signature: out, Direction: out, Type: Message Type

  28. 4. Assign Types and Map Sig4.2 For Connector • Select the “in” signature and create a corresponding interface for the connector by using the “< Create” button. Do the same for the “out” signature • You will see “in” and “out” in the Mapped Interfaces and Signatures

  29. 5. Create Links • Open Architecture.xml with Archipelago • Right click and select New Link. • Move the link to connect Message Sender to Proxy. • Create another Link to connect Proxy to Message Receiver • Make sure that the link is green in the interfaces

  30. 6. Map Architecture to Impl6.1 For Components • In the Package Explorer View, right click on the xml file. Open With->ArchEdit • In the Outline View, Expand Xarch, Arch Types, Component Type [Message Sender Type]. Right click on it. Select Promote to VariantComponentTypeImpl

  31. 6. Map Architecture to Impl6.1 For Components • Similarly, right click on Component Type [Message Sender Type]. Select Add Implementation. • Right click on Implementation and select Promote to JavaImplementation • Right click on Implementation and select Add Main Class

  32. 6. Map Architecture to Impl6.1 For Components • Right click on Main Class and select Add JavaClassName • Expand MainClass and double click on Java ClassName and enter “helloworld2.MessageSender” as a value =>Similarly, map “helloworld2.MessageReceiver” to the “Message Receiver Type”

  33. 6. Map Architecture to Impl6.1.1 For Component Signature • In the Outline View, Expand Xarch, Arch Types, Component Type [Message Sender Type], Signature [messages]. Right click on it. Select Promote to SignatureImpl

  34. 6. Map Architecture to Impl6.1.1 For Component Signature • Similarly, right click on Signature [messages]. Select Add Implementation. • Right click on Implementation and select Promote to LookupImplementation • Right click on Implementation and select Add Name

  35. 6. Map Architecture to Impl6.1.1 For Component Signature • Expand Implementation and double click on Name and enter “messages” as a value =>Similarly, map “messages” to the Signature in “Message Receiver Type”

  36. 6. Map Architecture to Impl6.2 For Connector • In the Outline View, Expand Xarch, Arch Types, Connector Type [Proxy Type]. Right click on it. Select Promote to VariantConnectorTypeImpl • Similarly, right click on Connector Type [Proxy Type]. Select Add Implementation. • Right click on Implementation and select Promote to JavaImplementation

  37. 6. Map Architecture to Impl6.2 For Connector • Right click on Implementation and select Add Main Class • Right click on Main Class and select Add JavaClassName • Expand MainClass and double click on Java ClassName and enter “edu.uci.isr.myx.conn.SynchronousProxyConnector” as a value

  38. 6. Map Architecture to Impl6.2.1 For Connector Signature • In the Outline View, Expand Xarch, Arch Types, Component Type [Proxy Type], Signature [in]. Right click on it. Select Promote to SignatureImpl

  39. 6. Map Architecture to Impl6.2.1 For Connector Signature • Similarly, right click on Signature [in]. Select Add Implementation. • Right click on Implementation and select Promote to LookupImplementation • Right click on Implementation and select Add Name • Expand Implementation and double click on Name and enter “in” as a value =>Similarly, map “out” to the Signature [out]I in the Connector Type [Proxy Type]”

  40. 6. Map Architecture to Impl6.3 For Interface • In the Outline View, Expand Xarch, Arch Types, Interface Type [Message Type]. Right click on it. Select Promote to InterfaceTypeImpl • Right click on Interface Type [Message Type]. Select Add Implementation. • Right click on Implementation and select Promote to JavaImplementation

  41. 6. Map Architecture to Impl6.3 For Interface • Right click on Implementation and select Add Main Class • Right click on Main Class and select Add JavaClassName • Expand MainClass and double click on Java ClassName and enter “helloworld2.MessageIntf” as a value

  42. 7. Write Java classes and interfaces • Create the package helloworld2 in the HelloWorld2 project (New -> Package) • Right click on helloworld2 package and select New-> Class • Class Name: MessageSender. Finish. =>Similarly, create the class MessageReceiver

  43. 7. Write Java classes and interfaces • Right click on helloworld2 package and select New-> Interface • Interface Name: MessageIntf. Finish.

  44. 7. Write Java classes and interfaces • Copy the following content in MessageIntf.java and Save the file package helloworld2; publicinterface MessageIntf { publicvoid processMessage(String message); }

  45. 7. Write Java classes and interfaces • Copy the following content in MessageSender.java and Save the file package helloworld2; import edu.uci.isr.myx.fw.AbstractMyxSimpleBrick; import edu.uci.isr.myx.fw.IMyxName; import edu.uci.isr.myx.fw.MyxUtils; publicclass MessageSender extends AbstractMyxSimpleBrick { publicstaticfinal IMyxName MESSAGES_NAME = MyxUtils.createName("messages"); @Override publicvoid begin() { super.begin(); // get the service object MessageIntf messages = (MessageIntf)MyxUtils.getFirstRequiredServiceObject(this, MESSAGES_NAME); // do something with it messages.processMessage("Hello World!"); } public Object getServiceObject(IMyxName interfaceName) { // TODO Auto-generated method stub returnnull; } }

  46. 7. Write Java classes and interfaces • Copy the following content in MessageReceiver.java and Save the file package helloworld2; import edu.uci.isr.myx.fw.AbstractMyxSimpleBrick; import edu.uci.isr.myx.fw.IMyxName; import edu.uci.isr.myx.fw.MyxUtils; publicclass MessageReceiver extends AbstractMyxSimpleBrick implements MessageIntf { publicstaticfinal IMyxName MESSAGES_NAME = MyxUtils.createName("messages"); publicvoid processMessage(String message) { System.err.println("Received: "+message); } public Object getServiceObject(IMyxName interfaceName) { // TODO Auto-generated method stub if(interfaceName.equals(MESSAGES_NAME)){ returnthis; } returnnull; } }

  47. 8. Run Hello World • In the Package Explorer View, right click on Architecture.xml, select Open With AIM Launcher • In the Outline View, double click on HelloWorld2 • Click on Instantiate

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

More Related