tool integration: model-based tool adapter...

87
IT 12 005 Examensarbete 30 hp Februari 2012 Tool Integration: Model-based Tool Adapter Construction and Discovery Conforming to OSLC Wenqing Gu Institutionen för informationsteknologi Department of Information Technology

Upload: others

Post on 27-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

IT 12 005

Examensarbete 30 hpFebruari 2012

Tool Integration: Model-based Tool Adapter Construction and Discovery Conforming to OSLC

Wenqing Gu

Institutionen för informationsteknologiDepartment of Information Technology

Page 2: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple
Page 3: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Teknisk- naturvetenskaplig fakultet UTH-enheten Besöksadress: Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0 Postadress: Box 536 751 21 Uppsala Telefon: 018 – 471 30 03 Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student

Abstract

Tool Integration: Model-based Tool AdapterConstruction and Discovery Conforming to OSLC

Wenqing Gu

Tool Integration is a vital part in the modern IT industry. With the ever increasingcomplexity in reality, more tools in different domains are needed in research anddevelopment process. However, currently no vendor has a complete solution for thewhole process, and no mature solution to integrate different tools together, thustools are still used separately in the industry. Due to this separation, the sameinformation is created more than once for different tools, which is both time wastingand error prone.

This thesis is part of the research to deliver a model-based tool integrationframework that helps the end user design their own scenario of tool integration andimplement it with less effort by generating most common parts automatically. Thisthesis itself is mainly focused on tool adapters, including the model-based tool adapterconstruction and discovery. In the first part, a model-based tool adapter constructionplatform conforming to OSLC is designed and implemented, based on which, theconstruction process of a tool adapter is presented with an example. With thisplatform, most of the codes and configuration files can be generated, with theexemption of the tool specific functionalities. The tool adapter is constructed as aseparate SCA component, and can be included in the SCA based tool chain withminor configuration. With SCA, the deployment of the tool adapter and futuremanagement can be largely eased. In the second part, the model-based discoveryprocess of an unknown tool adapter conforming to OSLC and our assumptions ispresented in detail. With the discovery tool, the sharing of the tool adapter is madepossible, and the integration of the different tools are largely eased. An example ofdiscover an unknown tool adapter is also included for a more clear explanation.Finally, in the meanwhile of the design and implementation of the constructionplatform and the discovery process, the existing Matlab/Simulink tool adapter isextended and refined to make it full compatible to the standard and our tool chain.

Tryckt av: Reprocentralen ITCIT 12 005Examinator: Anders BerglundÄmnesgranskare: Frédéric LoiretHandledare: Matthias Biehl

Page 4: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple
Page 5: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Acknowledgements

First of all, I would like to show my greatest gratitude to my supervisor MatthiasBiehl and reviewer Frederic Loiret for always giving me nice suggestions and greatideas during the six months thesis time in KTH. Without them, I can’t finish this thesisalone.

Secondly, I would like to thank Dr. Qin Liu in Tongji University for her kind helpin the thesis and great support in participating this Sino-Swedish Master Programmein Computer Science and Software Engineering.

Finally, I would like to thank my girl friend, and all my friends that helped in thethesis.

Page 6: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple
Page 7: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.1 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 The Context of this Thesis Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.3 Major Work and Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.4 Thesis Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 State of the Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 Modern Practices on Tool Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2.1 OSLC and The Jazz Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2.2 MOFLON and Related Tool Integration Efforts . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2.3 Other Integration Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.3 Related Work on Tool Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3.1 Current Status on Tool Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3.2 Service Discovery and Tool Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Technical Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.2 Eclipse Modeling Framework, EMF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.2.1 EMF and the Ecore Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.2.2 Acceleo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3 Open Services for Lifecycle Collaboration, OSLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.3.1 OSLC and REST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.3.2 OSLC and RDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.3 Implementation Details: JAX-RS, Jersey, Apache CXF andFreeMarker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.4 Service Component Architecture, SCA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.4.1 SOA and SCA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Page 8: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

3.4.2 Frascati and Maven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.2 User Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.2.1 Needs in Tool Adapter Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.2.2 Needs in Automated Tool Adapter Discovery . . . . . . . . . . . . . . . . . . . . . . . . . 20

4.3 Iterative Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

4.3.1 From the Existing Matlab/Simulink Tool Adapter . . . . . . . . . . . . . . . . . . . 20

4.3.1.1 Improvement: Servlet based Solution . . . . . . . . . . . . . . . . . . . . . 21

4.3.1.2 Improvement: RDF Converter Library . . . . . . . . . . . . . . . . . . . . 21

4.3.1.3 Extension: Add Control Services . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4.3.1.4 Extension: Add OSLC Directory Services . . . . . . . . . . . . . . 21

4.3.2 Migration to Frascati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

5 Construction of OSLC-conform Tool Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.2 The Tool Adapter Construction Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

5.2.1 Guidelines of the Tool Adapter Model Design . . . . . . . . . . . . . . . . . . . . . . . . 24

5.2.2 Architecture of the Tool Adapter to be Generated . . . . . . . . . . . . . . . . . . . 25

5.2.2.1 Tool Adapter Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

5.2.2.2 System Level Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

5.2.3 Generation of the Tool Adapter from a Model . . . . . . . . . . . . . . . . . . . . . . . . . 30

5.3 Construction of Tool Adapters on the Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.3.1 Model the Data and Control Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.3.2 Generate the Tool Adapter Stubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.3.3 Implementation of the Tool Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.3.4 Testing and the Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.4 Limitations and Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6 Automated Discovery of Unknown Tool Adapters Conforming to OSLC . . . . . . . . 46

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6.2 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Page 9: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

6.2.1 Model Design of the Discovered Tool Adapter . . . . . . . . . . . . . . . . . . . . . . . . 47

6.2.2 The Discovery Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

6.2.3 Saving the Discovered Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

6.2.4 Model-based Generation of Code Stubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

6.3 Summary of Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.2 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.3 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Appendix A: Generated Code Stubs for Matlab/Simulink Adapter Based on theTool Adapter Construction Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

Page 10: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

List of Tables

Table 2.1: Compatibility between Discovery and Orchestration Methods . . . . . . . . . . . . . . . . 9

Table 5.1: Parameters predefined in the construction platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Table 5.2: Different output styles of XMI-based and RDF-based output services . . 30

Table 5.3: Data Services to be provided in Matlab/Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Table 5.4: Control Services to be provided in Matlab/Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Table 5.5: Limitations and assumptions of the tool adapter construction platform . 44

Table 5.6: Limitations and assumptions of the current Matlab/Simulinkimplementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Table 6.1: Assumptions made in the automated discovery algorithm of unknowntool adapter conforming to OSLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

Page 11: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

List of Figures

Figure 1.1:General idea of the model-based tool integration framework . . . . . . . . . . . . . . . . . . 2

Figure 3.1:Simplified structure of Ecore meta model [32] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Figure 3.2:OSLC core specification concepts and relationships [34] . . . . . . . . . . . . . . . . . . . . . 13

Figure 3.3:SCA example with multiple composites and components running onmultiple machines [7] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Figure 3.4:SCA component structure [7] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Figure 3.5:SCA component interaction example [7] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Figure 3.6:A simple Helloworld SCA application running in FraSCAti explorer . . . 18

Figure 3.7:Architecture of the simple Helloworld SCA application . . . . . . . . . . . . . . . . . . . . . . . 18

Figure 5.1:Control flow for OSLC-conform tool adapter design based on theconstruction platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Figure 5.2:Design of the ifest-common model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Figure 5.3:Composite Diagram of the Matlab/Simulink Tool Adapter . . . . . . . . . . . . . . . . . . . 26

Figure 5.4:Design of the data model of Matlab/Simulink Tool Adapter . . . . . . . . . . . . . . . . . 34

Figure 5.5:Design of the core model of Matlab/Simulink Tool Adapter . . . . . . . . . . . . . . . . . 34

Figure 5.6:Java implementation generated of the data and core model ofMatlab/Simulink tool adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Figure 5.7:Tool adapter stubs generated based on the data and core model ofMatlab/Simulink tool adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Figure 5.8:Architecture of Matlab/Simulink Tool Adapter (Manual Part) . . . . . . . . . . . . . . 36

Figure 5.9:Screen shot of Matlab/Simulink model york . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

Figure 6.1:General process of automated discovery of unknown tool adaptersconforming to OSLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Figure 6.2:Detail algorithm of the automated discovery process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Figure 6.3:Discovered data model of Matlab/Simulink Tool Adapter . . . . . . . . . . . . . . . . . . . . 59

Figure 6.4:Discovered core model of Matlab/Simulink Tool Adapter . . . . . . . . . . . . . . . . . . . . 60

Page 12: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple
Page 13: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

1. Introduction

1.1 The Problem

With the ever increasing complexity of the modern products, a growing number offactors should be considered during the development process. In the embedded indus-try, experts from different domains usually work together to design different aspectsof the products. These activities, including the hardware design, the software design,the requirement engineering, coding and verification, all rely heavily on software de-velopment tools.

However, the tools supporting different parts of the work are usually not integrated,despite the needs to be used as a tool chain to exchange the information and providetraceability in different parts. Whenever information exchange between two toolsis needed, the engineers have to manually create duplicate information in anotherdifferent format for the other tool. This redundant work is not only a wasting of time,but also one of the important factors that lead to the defects in the final products. Also,without the support of the treatabilities of the work products in different parts of thewhole process, the validation will be difficult.

The tool integration is vital to the industry. However, the tools in the developmentprocess are targeted to totally different areas, therefore it will be difficult for one com-pany to provide a complete solution for the whole process. Also, many of the toolsare quite famous in its own area, and have been used for quite a long time, thus, itis unlikely that the vendors agree on a new standard and change to it in a very shorttime. Therefore, to conclude, the only reasonable solution to create a usable integratedsolution is to integrate the tools externally.

In recent years, various efforts have been made to study the integration of differenttools. One of the styles is to expose the internal data and other functionalities asweb services, and orchestrate them as a whole tool chain. The integration is done inan external way with tool adapters created as a bridge between the services and thetools, where tool adapters are only used to provide a unite service interface and realoperations are done by calling APIs of the tools as a black box.

With this simple idea, our research team is trying to propose a RESTful [11] ser-vice oriented integration solution following the becoming industry standard for toollife-cycle integration OSLC (Open Services for Lifecycle Collaboration)[34]. In theaspect of tool adapters, studies to further ease the work to develop a new tool adapterand create an ecosystem of sharing of tool adapters from different vendors should beconducted.

1

Page 14: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

1.2 The Context of this Thesis Work

In the big picture, the idea is to create a model-based tool integration framework.More specifically, TIL model is introduced [5] as the glue of the different kinds oftool adapters with different service models in the tool chain and a model-based gener-ation engine is developed to generate the code stubs for the whole tool chain. In themeanwhile, the guidelines to construct the new tool adapters are designed, which thedeveloper of the tool adapter must follow. With the same guideline, the developmentof tool adapters can be largely eased, and the sharing of tool adapters from differentvendors is made possible. An unknown tool adapter discovery tool is also designedand implemented to facilitate the integration of the tool adapters from others. Thisidea in the big picture is presented in Figure 1.1.

Figure 1.1. General idea of the model-based tool integration framework

1.3 Major Work and Contributions

In the research, this thesis is mainly focused on tool adapters, including the tooladapter construction and discovery conforming to OSLC. More specifically, the workincludes:

• Extend an existing tool adapter generator: One aspect of the work is to de-velop a tool adapter construction platform based on the existing tool adaptergenerator. Firstly the guidelines of OSLC-conform tool adapter model are cre-ated, and based on the model following the guidelines, model-to-tool-adaptergeneration engine is also developed to generate the stubs of the tool adapter.Besides, supporting components like the ID Resolving Service to provide uni-form IDs for different tools and the Converter Service to output the responsesin the standard way according to OSLC are also developed.

• Newly developed tool adapter discovery tool: In the second part of the work,automated discovery of an unknown tool adapter conforming to OSLC and ourassumptions is studied. As in OSLC core specification [34], with the URI ofServiceProviderCatalog as the start point of the discovery process, data and

2

Page 15: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

control services of the tool adapter can be discovered and stored in the discov-ered tool adapter model. Based on this model, similar model-to-tool-adaptergeneration engine is developed to generate the code stubs needed to consumethe services provided.

• Improve the existing Matlab/Simulink tool adapter: In the meanwhile of de-veloping the tool adapter construction platform and discovery tool, the existingMatlab/Simulink tool adapter is extended and refined to be fully compatible tothe standard and our tool chain.

The contributions of the thesis are mainly in the standardization of tool adaptermodeling, the development of the tool adapter construction platform, as well as thestudy of the automated discovery process of an unknown tool adapter conforming toOSLC and our assumptions.

1.4 Thesis Structure

The rest of this thesis report is structured as follows:

In Chapter 2, we present the state of the art in tool integration and tool discov-ery. In the first part, modern integration solutions are discussed. In the second part,research efforts concerning tool adapter discovery as well as service discovery in gen-eral are analyzed and compared.

In Chapter 3, we introduce all the technologies that have been used in the thesiswork in general. In this section, the technologies related with each other are introducedtogether as the same group.

In Chapter 4, we first present the user scenarios of the tool adapter constructionand discovery. And then, the iterative development process of the thesis is introducedin general.

In Chapter 5, we present the construction process of the tool adapter. First, inthe aspect of building the tool adapter construction platform, we introduce the de-sign guidelines of the tool adapter model, the architecture of the tool adapter to begenerated and the model-to-tool-adapter generation engine. Then, in the aspect oftool adapter construction with this platform, with the example of creating a Mat-lab/Simulink tool adapter, we present the whole process including the model design,the generation of code stubs, the implementation of the tool adapter and the final test-ing.

In Chapter 6, we present the discovery process of the unknown tool adapter con-forming to OSLC and our assumptions, including the model design of the discoveredtool adapter, the discovery algorithm, the generation of the discovered model and themodel-to-tool-adapter generation. The introduction is done step by step with an ex-ample to discover the unknown Matlab/Simulink tool adapter.

In Chapter 7, we conclude with a summary of the thesis work as well as thediscussion of the major limitations and possible future work.

3

Page 16: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

2. State of the Art

2.1 Introduction

Tool integration is defined as the process to produce an effective and integrated auto-mated environment that supports the complete software development life cycle [6][35][36].

As summarized in [39][38][6], since 1980s, there’re various research efforts con-cerning this topic including concepts, models, approaches, techniques and mecha-nisms in support of integration, etc. Also, to facilitate the tool integration, a num-ber of technologies have been used including old technologies like CORBA [24] andnew technologies like web services in SOAP (Simple Object Access Protocol) [13] orREST.

In early approaches, the integration solutions are mostly ad-hoc which require alot of redundant work in dealing with different integration problems. Therefore, tosave the manual efforts, in the modern solutions, tool integration platforms are createdand applied with which the reuse of the common integration functionalities is madepossible.

In the following part, we first introduce some of the modern practices on tool inte-gration, including OSLC and the Jazz platform, MOFLON and related solutions, andsome other frameworks or platforms. After that, efforts on tool adapter discovery aswell as service discovery in general are introduced.

2.2 Modern Practices on Tool Integration

2.2.1 OSLC and The Jazz Platform

OSLC is one of the major efforts in the domain of tool integration, and it is the be-coming industry standard in this area. It is not a technical framework or platform, buta standard on the way that software lifecycle tools can share data with one another, asintroduced on it’s website1.

In one part, OSLC adopts RESTful web service standard, and defines services thatare shared with other tools as resources and publishes them as RESTful web services.Also because of the lack of available directory services in the RESTful web servicestandard, OSLC defines directory services to make the discovery of the services pro-vided possible.

1http://open-services.net/

4

Page 17: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

In the other part, in OSLC, industry experts from different domains are workingtogether to design and agree on the scenarios and resources needed to support thecommon tasks and interactions in software tools. OSLC has created a set of open andpublic descriptions of resources and service interfaces in different common scenariosthat can be and have already been adopted by tool vendors including change manage-ment, quality management, requirements management, software project management,product lifecycle management, etc.

Jazz [12] is one of the modern tool integration platforms with the whole architec-ture built on OSLC. Similar to the team’s research work, different tools share datarelated functionalities through OSLC resources, and the Jazz platform is the core partto coordinate the service sharing.

Different to the team’s research work, the Jazz platform begins with the needs ofteam collaboration and project management in software development, and it is itselfa team collaboration tool. By attaching different tools that share functionalities inOSLC, more information can be accessed and tracked in the tool. In the context of thisthesis project, tool integration is the key problem which is more general compared toJazz, and this thesis project is mainly concentrating on the development and discoveryof the tool adapters that help the work of tool integration.

Also, unlike the heavy concentration we have paid in the team’s research work andthis thesis project on how to help the construction of tool adapter in an easy way, Jazzis more like a tool that support IBM’s Rational Unified Process2 and to unify otherRational products made by IBM.

In the integration part, Jazz is more concentrating on the data sharing between thetools, as in one part the OSLC currently only supports data resources smoothly andin the other part only data from different tools are interesting to a team collaborationtool. In the scenario of development with a set of tools, certainly the integration ofcontrol functionalities are needed.

Jazz is an excellent team collaboration tool with full integration support of IBM’sRational products. However, as an open community3, Jazz is still underway. Becauseof the lack of support in developing own products that could be integrated to Jazz,right now only a few IBM’s products can be integrated to Jazz. In the future, withthe development of the community, similar to Eclipse, probably Jazz will become theindustrial standard platform for team collaborations with the capability to integratetools developed by different vendors.

2.2.2 MOFLON and Related Tool Integration Efforts

MOFLON4 is another framework for metamodeling and model transformation similarto EMF (Eclipse Modeling Framework)[32] we adopted in this thesis. It is a pioneerin the modeling world, as introduced in [37]. The development of MOFLON began

2http://www-01.ibm.com/software/awdtools/rup/3http://jazz.net4http://www.moflon.org/

5

Page 18: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

in 2002, and four years later the first version was released. In 2007 and 2008, morecomponents including a model-to-model transformation editor and generator, a com-piler for the Object Constraint Language (OCL) [21], and modularization concepts formodel-to-model transformations are included in later versions.

The main idea of MOFLON is to adopt MOF 2.0 standard [21] as the metameta-model to represent the tool metamodel. Existing modeling environment for UMLmodels is refined with a plugin provided by MOFLON to provide the metamodel mod-eling environment. The code generated from metamodels complies to the JMI stan-dard [33] through MOFLON’s own extension on the basis of an existing JMI mappingfor MOF 1.4 defined by the Object Management Group (OMG).

Based on MOFLON, there’re a few tool integration efforts, however due to thelimitations of MOFLON, those efforts are only on the basis of data integration, ormore specifically on the basis of the transformation of the data from different tools.

As presented in [2] and [37], with the help of MOFLON and tool adapters, re-quirements engineering tool DOORS and the system modeling environment MAT-LAB/Simulink can be integrated. Similar to this thesis work, the tool adapters canpartly be generated by MOFLON on the basis of metamodeling of the tool to providea standardize JMI compliant interface to be used in the model analysis and transfor-mation.

However, because of the use of JMI, only data resources can be extracted and op-erated on the JMI interfaces, which will only work on data integration of the tools.Besides, without the support of directory services of the resources provided, intelli-gent algorithm for the resource discovery and transformation can be difficult to design,and more manual work required to specify those constraints and rules to analyze ortransform the model. Finally, the most important, the standards MOFLON adoptedare becoming obsolete, that’s also the reason that MOFLON is under re-engineeringas reported in [3] to support new de facto standard like EMF (Eclipse Modeling Frame-work).

2.2.3 Other Integration Solutions

There are a few other integration solutions like ModelBus5, Atego Workbench6 orEclipse7. However, they all have some kinds of drawbacks or major limitations to beused to integrate existing tools.

ModelBus is a tool integration technology which is built on Web Services andfollows a SOA approach [16]. The architecture is deployed on SOAP web services.Clients are divided into service providers and consumers in a model bus, both of whichshould create an adapter to integrate into Apache CXF DOSGi8 used in ModelBus.

5http://www.modelbus.org/modelbus/6http://www.atego.com/products/atego-workbench/7http://www.eclipse.org/8http://cxf.apache.org/dosgi-releases.html

6

Page 19: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

ModelBus pays heavy attention to the models created by tools. There’s also acentral repository included as an infrastructure service in ModelBus to be used as themedia to share the models between tools to provide the traceability of different modelsbetween tools.

Despite the functionalities provided by ModelBus, we can find the following draw-backs:

• ModelBus pays too much attention on its central repository and the traceabilityfunctionality of the models from different tools. For other integration tasks likethe control integration, it lacks basic support.

• ModelBus does not provide any support to ease the development of tool adapter.Tool adapter should be created manually, which is quite time consuming.

• ModelBus does not have a reliable SOA platform as the running container ofthe servers, instead, the services are deployed directly on application serverslike Tomcat9. In this case, the services of the tool adapters will be difficult tomanage.

Atego Workbench, on the other hand, is based on thin client architecture and theserver technology. In Atego, the servers are the ones that are really running the ap-plications, whereas, the clients are only presenting the UI and results from the server.Because of the adoption of the special architecture, the user can reduce cost of eitherthe deployment or the software licenses. However, in the aspect of tool integration,this solution is more to solve the problem of integrating some of the known applica-tions to the clients, rather than to provide a general solution for tool integration.

Finally, Eclipse as a well known Integrated Development Environment (IDE), isa good platform to provide a uniform GUI for different tools. However, it is moresuitable to develop a new tool by following it’s standard and reusing it’s commonGUI, not for extending the existing tool to be integrated as a whole solution. Also,it is more of a tool to integrate different tools on one machine, and to improve singleengineer’s capability, rather than to provide a good integration solution in the teamcollaboration scenario.

2.3 Related Work on Tool Discovery

2.3.1 Current Status on Tool Discovery

Tool adapter discovery is the automated discovery and configuration of the tool adaptersin the whole tool chain through minor information given from the user. With tooladapter discovery, the architecture design and deployment of the tool chain can belargely eased. More over, it becomes the reality to reuse the tool adapters from othervendors as part of the tool chain.

However, as we presented before, because the other modern efforts on tool inte-gration are paying more attention to solve a more detail problem, there’re not much

9http://tomcat.apache.org/

7

Page 20: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

efforts on tool discovery in general. In the following part, we will present the generalweb service discovery approaches and conclude the different approaches by summa-rizing the compatibility with different orchestration methods. The limitations on thegeneral web service discoveries are the major reason to develop this specific discoveryrouting for tool adapters based on OSLC.

2.3.2 Service Discovery and Tool Discovery

Before we present the discovery details, we would clarify the meaning of the webservice discovery here. It means the discover of the service, and consume the serviceby automatical configuration of the running environment. It does nothing with theintelligent discovery of the web services in the research of semantic web, and even theglobal directory service or search engine service of the web services.

The most well known web service is the one in SOAP, and usually a WSDL (WebServices Description Language) [9] [8] document will be included along with the webservices. In whatever version, WSDL v1.1 or WSDL v2.0, WSDL is a readme file todocument the detail information of the web services provided by the service provider.The consumer, on the other hand, then can consume the web services accordingly.

As a standard in W3C, WSDL is quite mature and is generally accepted. In devel-opment with SOAP web services, common programming platforms including .NETand Java that support the consumption of web services all provide facilities to gener-ate stubs to ease the work of interacting with the services provided. Usually, a systemlibrary is developed to implement the network interaction details of consuming theweb services, and proxy classes that make calls to the library are generated to pro-vide an easy access of the web services for the programmers. In the orchestration ofSOAP web services, WSDL is commonly supported in platforms like BPEL (Busi-ness Process Execution Language) [1] and SCA (Service Component Architecture)[25]. The discovery of the SOAP web services can be done by providing the addressof the WSDL file.

In the other web service world, RESTful web service, things are different. In REST,there’re counterpart as WSDL in SOAP, like WADL [15][14] or WSDL v2.0 [8] pre-sented later to add more support of REST. However, neither way is general accepted.Therefore, in development with RESTful web services, a lot of manual work is re-quired to consume the services provided, not much work can be generated by the toolsprovided by programming platform. Java has some support of WADL-to-Java gener-ation10, however, most of the service providers nowadays will not provide a WADLdescription file along with the RESTful web services. In the orchestration with REST-ful web services, the current version of BPEL (version 2.0) doesn’t support REST,and the only solutions are to develop adapter services in SOAP or adopt the extensionBPEL for REST [27]. However, the former one requires the manual implementationof the adapter services, and the latter one requires manual configuration and doesn’tuse WADL either. In SCA, the binding of RESTful web services is possible, howevera common Java interface is used to invoke the web services, and no facilities existed

10http://wadl.java.net/

8

Page 21: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Compatibility OSL

CD

isco

very

[34]

WSD

L1.

1D

isco

very

[9]

WSD

L2.

0D

isco

very

[8]

WA

DL

Dis

cove

ry[1

5]

TIL

Dis

cove

ry

BPEL v2.0 [1] - X - - -BPEL for REST [27] - - - - -Manual Coding (Java) X X X X XTIL Orchestration X - - - X

Table 2.1. Compatibility between Discovery and Orchestration Methods

to discover and generate the interface automatically. That’s the major reason that inthis thesis, we build our own discovery approach only based on the directory servicesprovided by OSLC.

To conclude, we summarize the compatibility between discovery and orchestrationmethods in Table 2.1.

9

Page 22: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

3. Technical Background

3.1 IntroductionIn this chapter, we review the technical background that is related to the thesis work.To better understand the technical background, the technologies are introduced in thegroup as they are related with each other.

The most important high level concept in the thesis is model-driven architecture(MDA) [29]. With this idea, meta model (or structure definition of the model) of thetool adapter is created and generation rules on the basis of the tool adapter model arecompiled. With the standard tool adapter model and the generation tool to generatethe skeleton of the tool adapter, the standardization of the tool adapters can be guaran-teed. Also, the automated discovery of the tool adapters from other vendors is madepossible.

To further ease the work of developing the integration framework, and the work ofthe final user to develop the integration solution, we take EMF as our modeling basisas its maturity in the modeling and tool support. To better standardize our framework,we follow the becoming industry standard, OSLC. To ease the way of encapsulatingthe tool adapter, and orchestrating them, we follow SCA as the main architecture ofthe generated tool chain.

In the following sections, technologies concerning EMF, OSLC, and SCA as men-tioned are introduced in detail.

3.2 Eclipse Modeling Framework, EMF

3.2.1 EMF and the Ecore Model

Generally speaking, EMF or Eclipse Modeling Framework, is a guideline of the mod-eling and a set of code generation facilities that gives the user the power to define amodel and operate different transformations on the model through GUI or program-ming. EMF is also the cornerstone of the Eclipse modeling tool Papyrus1, wherethe created UML models are based on EMF model and the model-to-code generationengine of the tool is also based on the facilities provided by EMF.

Ecore model, or sometimes Ecore meta model is acted as the meta model of themodels in EMF. Ecore model itself is a EMF model as well, and can be described withitself as its meta model. Figure 3.1 is the simplified structure of Ecore meta model.

1http://www.eclipse.org/modeling/mdt/?project=papyrus

10

Page 23: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 3.1. Simplified structure of Ecore meta model [32]

In this thesis, and also in the team’s research work, all the models are defined basedon EMF and its Ecore meta model, including the model of the tool adapter and the TILmodel mentioned before. With EMF and the generation facilities provided by and ontop of EMF, it becomes possible for us to generate the tool adapter stubs with the rulespredefined.

EMF has provided a simple modeling environment, based on which, EMF modelscan be created and corresponding Java codes can be generated through a few opera-tions in the GUI. The Java classes and interfaces generated then can be used as the datastructures, and behave exactly as defined in the model. We can compare EMF modelto the UML class diagram despite the much larger description capability in EMF. Themodels defined in EMF are similar to the models created in the UML Class diagramand the generation process of EMF is equivalent to the generation process of UMLClass diagram.

EMF has also provided a lot of facilities to operate on the model pragmatically.When creating the tool adapters, through Ecore code generation, tool adapter modelespecially the data part is used as data structures in the interactions with the toolsand system components. Also, in the automated discovery of OSLC-conform tooladapters, EMF models are created dynamically as the data structure to hold the struc-tural information of the discovered tool model with libraries provided by EMF.

3.2.2 Acceleo

Acceleo [20] is one of the code generation tool provided on top of EMF. More specif-ically, Acceleo is a pragmatic implementation of the MTL (MOF Model to Text Lan-guage) standard [22] by the Object Management Group (OMG). The concept of Modelto Text is quite simple, which means the rules are defined on the basis of the under-standing of the model structure, and different texts can be generated accordingly.

Acceleo provides a full development environment integrated in Eclipse, where thedevelopers can create model-to-text rules, based on which, codes or other configura-tion files can be created dynamically by parsing the different content of the model.The Acceleo engine can understand the model structures based on Ecore meta model

11

Page 24: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

or other meta models based on Ecore, therefore it is very simple to develop the rulesfrom the model to the target texts, as no codes needed to parse the structure of themodel.

In the thesis, Acceleo is the development platform of the model-to-tool-adaptercode generation engine. Rules are predefined, and different codes of the tool adaptercan be generated according to the different services defined in the model.

3.3 Open Services for Lifecycle Collaboration, OSLC

3.3.1 OSLC and REST

As introduced in the previous chapter, we follow OSLC to keep abreast of the becom-ing industry standard and reduce the cost to develop tool adapters for the future toolsthat support OSLC. Also, by following OSLC, the research team can adopt the de-signed resources and service interfaces in common scenarios directory, and therefore,the work of designing the integration framework as well as designing tool adaptersfor the integration solution will be largely eased by reusing the standardized resourcesthat should be provided by the tools.

OSLC core specification defines some general principle of OSLC-conform ser-vices. As discussed in Chapter 1, the integration framework concerned in this thesisis web service based, with which data and functionality resources are encapsulatedas services. More over, because of the resource based nature of the tool adapters,we choose to adopt the RESTful kind of web services which is also the choice ofOSLC. For the tool adapters, to publish the provided service information, a directoryservice or similar is needed. However, unlike web services in SOAP which usuallyhave a WSDL as the directory service, there’s no common accepted directory servicefor RESTful web services besides WADL and WSDL 2.0, which is not widely usedin practice. Therefore, to facilitate the information exchange between different tools,OSLC defined its own directory service in its core specification. That’s another reasonthat we adopt OSLC in our integration solution.

As depicted in Figure 3.2, information of services provided by OSLC-conformtools are retrieved through the following steps:

1. ServiceProviderCatalog, the catalog of ServiceProviders as indicated from itsname, is the starting point of the query. URIs of ServiceProvider are retrievedby querying the ServiceProviderCatalog resource through its URI and analyz-ing it.

2. ServiceProvider is the description of the services (or part of the services) pro-vided. Details of the services provided by OSLC are included as the queryCa-pability and creationFactory in the Service resource inline. ResourceShape orResourceType may be included as a property of the resource provided, and canbe used to understand the structure of the provided resource.

As in RESTful web services, one can get, create, update and delete a resourceby executing the HTTP commands GET, POST, PUT, and DELETE. In OSLC,

12

Page 25: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 3.2. OSLC core specification concepts and relationships [34]

creationFactory provides the URI to create the new resources by executing the POSTcommand and queryCapability provides the URI to get a list of resource informationby executing the GET command. In the listed resources, URLs of a single resourcecan be obtained, through which the resource can be queried, updated or deleted byexecuting the GET, PUT and DELETE commands.

3.3.2 OSLC and RDF

Besides the features of OSLC discussed before, OSLC has also indicated one shouldat least provide a representation in RDF (Resource Description Framework) [17] forthe resources provided. In the thesis, we provide RDF and XMI [23] representationsfor the resources represented in EMF model through a system component called theConverter Service introduced in 5.2.2.2.

As introduced in [17], RDF is a framework for representing information in the Web.Generally speaking, it specifies the way to persist an instance of a special object in aspecific XML format.

In RDF, resources are identified with URIs. The RDF consists of expressions asa triple which includes a subject, an object and a predicate. A simple example ofthis relationship is "Someone (Subject) has a name (predicate) whose value is John(Object)", where the subject or object may be identified with a URI. Also, because ofthe context of using it in internet environment, the structure of the RDF resources isnot strict, which implies that everyone can make any changes to any resources. That’sthe reason that OSLC must provide a special resource ResourceShape to describe theexact structure of a specific resource.

13

Page 26: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

3.3.3 Implementation Details: JAX-RS, Jersey, Apache CXF andFreeMarker

In the implementation level, we follow JAX-RS or Java API for RESTful Web Ser-vices [28], to create RESTful web services in Java. RESTful services are defined byadding special annotations to the ordinary Java methods, and service bindings are doneautomatically by the running container according to the deployment configurations.Different libraries including Jersey [26] and Apache CXF [4] are used sequentially indifferent stages as introduced in Section 4.3.2.

The directory service is implemented in a template-based way where responses aregenerated by FreeMarker [10] based on the templates of the ServiceProviderCatalog,ServiceProvider and ResourceShapes predefined or pre-generated combined with thespecialized information retrieved from the tool adapter model.

In the discovery of OSLC-conform tool adapters, Jersey API (Client) is also usedto fetch the responses of a specific URI with a specific HTTP command.

When dealing with RDF models, Jena RDF API [19] is used either to create RDFresponse from EMF model or to analyze the RDF resource to convert it back to EMFmodel.

3.4 Service Component Architecture, SCA

3.4.1 SOA and SCA

Service-Oriented Architecture (SOA) defines a set of principles to design the softwareproducts as a set of services interacting with each other. SCA, or Service Compo-nent Architecture, extends the SOA requirements, and provides an extensive set offeatures to standardize the way to create software components and the mechanism fordescribing how those components are working together as an application [7].

As specified in [25] and introduced in [7], SCA components can be built with multi-ple technologies, it could be Java or other languages using SCA-defined programmingmodels, it could also be other technologies like BPEL. One application could havemultiple components that have different technologies, and those components couldalso run in a single process, in multiple processes or even on multiple machines. Inwhatever way, the integration of components are described with a common assemblymodel.

In SCA, a component is defined as the minimum unit of the architecture to providea set of services, whereas, a composite is defined as several components combinedinto a larger structure. Composite is only a logic unit, thus different components inone composite can run on different machines. Technically, each composite is describedin a separate XML-based configuration file following the Service Component Defini-tion Language (SCDL) and ending in ".composite". Figure 3.3 from [7] depicts thescenario that multiple composites and components are running on multiple machines.

14

Page 27: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 3.3. SCA example with multiple composites and components running on mul-tiple machines [7]

No matter what technologies used, the created component always has the samestructure as depicted in Figure 3.4. Typically, one component will implement somelogics as one or several services, which are exposed to be invoked by other compo-nents. In the other hand, the component may want to interact with other services fromalien components. It is done by the invocation of the references of the objects thatimplements the services provided by other components. The invocation could be theinvocation of member function of real objects in Java, or it could be the invocation ofweb services. Even non-SCA application could interact with SCA components. Theinteraction scenario between different SCA components and non-SCA applications isdepicted in Figure 3.5. The component may also have some properties, which can beread or changed at runtime.

In the thesis, we follow the SCA specification to build the tool chain architecture.The tool adapters as well as the system level components are encapsulated as separatecomposites, and the interactions between the components are specified in the ".com-posite" configuration files. In SCA, the relationship between components are specifiedin loose-coupled configuration file other than hard coding and with Frascati which will

15

Page 28: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 3.4. SCA component structure [7]

Figure 3.5. SCA component interaction example [7]

16

Page 29: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

be introduced later, the interactions between the components can even be managed atruntime.

3.4.2 Frascati and Maven

Frascati [30] is one of the several implementations of SCA specification. As summa-rized in [31], in addition to the features specified by the SCA specification, Frascatiprovides more support of manageability and configurability expected as an SCA plat-form. As needed in our research, the whole tool chain can be monitored by Frascati,and the properties of components or component interactions can be managed in run-time.

With the help of Apache Maven [18], a software project management and depen-dency management tool, Frascati application can be configured to run in differentways easily, e.g.: in FraSCAti Explorer with or without FScript plugin, in FScriptConsole, or in standalone execution.

With the tools provided by Frascati, a SCA application can be managed in dif-ferent ways. Figure 3.6 depicts the scenarios to manage an simple helloworld SCAapplication with FraSCAti Explorer. This helloworld SCA application is included inthe examples in Frascati runtime 1.4, and has a very simple architecture depicted inFigure 3.7. The only functionality provided by this SCA application is to print somecharacters. With FraSCAti Explorer, we can do the following:

• View the information of "Helloworld - pojo" composite (picture 1), "client" and"server" components (picture 2-3), etc.

• Execute the "r" service (picture 4-5).• Change the value of the "header" property of the "server" component (picture

6).

At runtime, Frascati will connect components as configured in ".composite" con-figuration files. Proxies will be created according to the different wire type, i.e.: wirevia Java objects or via web services. In runtime, similar as the simple example pre-sented before, the administrator can monitor the running state of the service, and canchange the connections or configurations (value of the properties) dynamically.

17

Page 30: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 3.6. A simple Helloworld SCA application running in FraSCAti explorer

Figure 3.7. Architecture of the simple Helloworld SCA application

18

Page 31: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

4. Approach

4.1 Introduction

The work of this thesis starts from an existing Matlab/Simulink Tool Adapter whichcan provide essential data services in an "OSLC-conform" way. Compared to theexpected user scenarios, the development is done iteratively to extend the existingtool adapter to match the expected scenarios. The details of the user scenarios and theiterative development process are introduced later in this chapter.

On the basis of the developed tool adapter, the model and code skeleton of a generaltool adapter are generalized, and the generation engine from the tool adapter modelto the tool adapter code stubs is developed. The work of the construction platform istested by creating the second Matlab/Simulink tool adapter from the generated tooladapter code stubs. The new Matlab/Simulink tool adapter is also used as the discov-ery target in developing the automated discovery tool for unknown OSLC-conformtool adapters. Details of the construction platform as well as the construction processof tool adapters based on it, and the discovery process of the unknown tool adaptersconforming to OSLC are presented in the later chapters.

4.2 User Scenarios

4.2.1 Needs in Tool Adapter Construction

In the optimal cases, we would like to create a "template" for all tool adapters. Thedeveloper of the tool adapter should be able to provide sufficient information for usthrough modeling, and our generator should be able to generate as much codes aspossible based on the model. The duplicate codes to fulfill the different kinds ofstandards or specifications should be fully generated, and the developer should onlypay attention to the tool specific codes [5].

With EMF, OSLC and SCA, we would like the final developer of the tool adapterfirst create an EMF model of the tool adapter based on our guidelines, and then ourgeneration engine mainly developed in Acceleo should generate codes and configura-tion files that deliver the OSLC-based services and encapsulate the tool adapter as aseparate composite in SCA. Finally, the developer should add implementations to thetool specific services and test it.

19

Page 32: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

4.2.2 Needs in Automated Tool Adapter Discovery

Because of the standardization of the tool adapters through template-like generationbased on the same structure of the tool adapter model, discovery of OSLC-conformtool adapters created by other vendors is made possible.

In the discovery of an ordinary web services, the user would only need to provideminor information such as an URI, and corresponding codes, configuration files, etc,are created by the system, and then can be used or integrated as needed. When addinga new tool adapter, no matter it is developed internally or by the other vendor, it is thesame that only one URI is required and the platform then should be able to recognizeand configure the services automatically.

4.3 Iterative Development

The work on this thesis has been performed in several iterative steps from the existingMatlab/Simulink tool adapter.

4.3.1 From the Existing Matlab/Simulink Tool Adapter

From the very beginning, there’s a Matlab/Simulink tool adapter available to providethe data services including "Block", "Line" and "Port". The services are exposed asRESTful services, and the responses are presented in a RDF-like way which is partlyconforming to OSLC.

After the careful investigating of the existing tool adapter, the following parts thatshould be refined or extended are discovered:

• In the existing tool adapter, the server container holding the web services is run-ning inside Matlab. That’s because of the special architecture of Matlab with anembedded JRE and the lack of suitable API to invoke Matlab functions. How-ever, this architecture is so complex and so special that it cannot be generalizedas an ordinary tool adapter. Also, too much complex operations to managethe embedded server inside Matlab are included. This part should be largelymodified to a normal API calling way, as actually a Java RMI based library isavailable to invoke Matlab codes from outside.

• RDF representation is not exactly following OSLC. This part should be fixed inthe future. Also, to fulfill the specification concerning the different HTTP com-mands, and to deal with scenarios like exceptions in the execution, the currentlibrary should be extended.

• Services of control functionalities should be added, like select, startSimulationof Matlab/Simulink.

• Directory services specified in OSLC should be added, including ServiceProvider-Catalog, ServiceProvider and ResourceShape.

20

Page 33: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

4.3.1.1 Improvement: Servlet based Solution

To solve the major problem of the existing tool adapter, a Java API called matlabcon-trol1 is used to interact with Matlab. The library makes use of the Java RMI serverrunning inside Matlab, and can execute the Matlab codes from Java programs outsideMatlab. By adopting this API, we change to a servlet based solution in which web ser-vices are developed in Jersey, and specialized functionalities are delegated to Matlabcodes by invoking the matlabcontrol API. The codes of the tool adapter do not includefunctionalities like web server startup and management, in the contrary, the servicesare deployed directly on the Java application server like Tomcat.

This servlet based solution provides a normal case of the tool adapter:

• Interactions with the tools are done through APIs or similar way from outsidethe tool.

• Only web services are concerned in the tool adapter, no more codes like themanagement of web servers or service containers included.

• The management of application servers or other containers should be done ex-ternal to the tool adapter.

4.3.1.2 Improvement: RDF Converter Library

Problems of RDF presentations for EMF objects are fixed according to OSLC specifi-cation and RDF specification.

4.3.1.3 Extension: Add Control Services

Control services are implemented as RESTful web services in the same way for thedata services, but only invocable through the POST command type. The services aredefined as operations in a special Class in the tool adapter model.

4.3.1.4 Extension: Add OSLC Directory Services

OSLC directory services are firstly implemented in the basis of JSP templates asin the example provided by OSLC 2. More specifically, JSP templates for Service-ProviderCatalog and ServiceProvider are created, and tool adapter related informa-tion is passed as page arguments. For ResourceShape, because of the great differencesof the structures of different resources, it is generated beforehand based on the model.

4.3.2 Migration to Frascati

To integrate the tool adapters in the Frascati platform, after the improvement and ex-tension of the existing tool adapter, the architecture is migrated to Frascati.

1A Java API to interact with MATLAB, http://code.google.com/p/matlabcontrol/2Tutorial: Integrating products with OSLC,http://open-services.net/resources/tutorials/integrating-products-with-oslc/part-2-implementing-an-oslc-provider/providing-service-resources/

21

Page 34: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Generally speaking the following tasks are done during the migration:

• Architecture of the tool adapter is redesigned. Service annotations and serviceimplementations are separated and libraries like RDF converter are extendedand encapsulated as a separate SCA composite included in the system library.

• RESTful services are slightly changed because of the change of implementationlibrary of JAX-RS: from Jersey to Apache CXF.

• Additional components like the ID Resolving Service are introduced.• Dependencies of the projects are changed to be managed by Maven, which is

more convenient and Frascati compatible.• OSLC ServiceProviders, ServiceProviderCatalogs and resource shapes are cre-

ated with FreeMarker as JSP is not naturally supported in Frascati.

22

Page 35: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

5. Construction of OSLC-conform ToolAdapters

5.1 Introduction

As introduced in Section 1.2, in the big picture, the tool chain is constructed as thecomposition of different tool adapters encapsulated as SCA composites. Here, in thischapter, we mainly discuss the way of constructing an OSLC-conform tool adapterthat can be included in the tool chain as a SCA composite.

A tool adapter is used as the bridge between the tool technology space and the toolchain technology space, and an OSLC-conform tool adapter is the tool adapter thathelps the tool to provide OSLC-compatible services in the tool chain. Those OSLC-compatible services include:

• Data services: Different types of objects in the tool model are encapsulated asresources in RESTful web services. Operations on those resources are definedand executed through the GET, POST, PUT, DELETE commands of HTTP.

• Control services: Other operations provided by the tool are encapsulated as spe-cial resources in RESTful web services as well. Operations on those resourcesare defined and can only be executed by POST command of HTTP.

• OSLC services: OSLC directory services and OSLC meta information queryservices are provided according to the OSLC specification in RESTful web ser-vices.

As people did in most of other integration solutions introduced in Chapter 2, a lot ofredundant work is needed to construct different tool adapters for different tools. In thecontext of constructing our OSLC-conform tool adapters encapsulated in SCA, suchwork includes programming of service interfaces and implementations that follow theSCA specification, programming OSLC-compatible interactions and RDF-based out-put, etc. The repeated implementation of those redundant is not only a wasting of time,more over it may be error-prone to the final products. The thesis work here, instead ofpresenting a case to build a new tool adapter directly, we start our work by buildingthe platform to ease the construction process first, and in this basis, only minor workneeded to implement the working tool adapter with tool specific functionalities.

The idea of building the platform to ease the construction process is from themodel-based approach when designing large software products. For our tool adapterconstruction platform, it is followed by the similar way as depicted in Figure 5.1.The user of the platform first needs to design the model of the tool adapter followingOSLC and our guidelines, and after that, the OSLC-conform tool adapter stubs thatcan be included in the SCA-based tool chain will be generated. The user then needs to

23

Page 36: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

implement the tool specific codes to fulfill the functionalities designed in the model.After that, the tool adapter is done, and can be used in the tool chain after testing andvalidation.

Figure 5.1. Control flow for OSLC-conform tool adapter design based on the con-struction platform

Compared to traditional way, a lot of work is done by the tool adapter constructionplatform, and the user can pay more attention to implement the tool specific func-tionalities. Also, by following the model-based approach, and our guidelines whendesigning the model or implementing the functionalities, the standardization of thetool adapters are guaranteed, based on which, automated discovery process in Chapter6 is made possible.

5.2 The Tool Adapter Construction Platform

As introduced before, the general idea of the platform is to provide an environment tothe user to design the tool adapter models on their own, and based on the model, thetool adapter stubs can be generated by the platform. In this section, we will introducethe designing and implementation of the tool adapter platform in detail. First, we willintroduce the guidelines of the tool adapter model design, and then the architecture ofa SCA-based tool adapter to be generated as long as the details of each componentswill be presented. In the last part, the design of the model-to-tool-adapter generationengine will be discussed.

5.2.1 Guidelines of the Tool Adapter Model Design

The model of the tool adapter is used as the generation source in the platform, and isthe encapsulation of all data, control and OSLC services provided by the tool adapterto be constructed. To ease the generation work, and to make sure the user of theplatform will provide the complete information for the generation process, in thissection, we provide a few guidelines for the user to follow:

24

Page 37: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

• The model should be based on EMF and the Ecore model.• To ease the generation and integration of data services only, the data services

and other services are split into two separate models, one called the data modelwhich contains information of the data services only in its root package, and theother called the core model which contains information of the control servicesand OSLC services in separate sub-package control and oslc.

• For the data services, the different data resources are presented as differentclasses in the package. The properties of the resource are either defined asattributes of the class if the data type of this property is a built-in type, or refer-ences if the data type is referenced to a non built-in type (usually a data resourceprovided by the tool adapter). To standardize the data model design, an ifest-common model is predesigned, and ProtoObject class should be identified asthe parent class of the classes in the data model, therefore the uuid property asthe unique ID of the resource and the name property will be always included inthe design.

• For the control services, each of the service is defined as an operation undera special class Control under its package. Parameters of the control servicesare defined as parameters of the operation. However, the parameters alreadyprovided in the platform as summarized in Table 5.1 can be exempted in themodel design.

• For the OSLC services, to ease the generation work of the OSLC directoryservices, OSLC specific meta information should be defined as key - value pairsin annotations of corresponding name.

Figure 5.2. Design of the ifest-common model

Please note, as the limitation of the presentation capability in EMF, the additionalparameters of the data services cannot be represented in the model. The user of theplatform needs to manually process those additional parameters in the implementa-tion codes if applicable. In the future, additional guidelines of modeling additionalparameters for data services can be specified.

5.2.2 Architecture of the Tool Adapter to be Generated

The general idea of the architecture design is to design a SCA-based architecture,where components of the tool adapter as well as the the system components encapsu-lated as SCA composites are connected with wires defined in ".composite" file.

25

Page 38: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

One important consideration of the architecture design is to split the codes fullygenerated or to be implemented manually into different components to ease the im-plementation work by achieving separation of concerns. Thus, the tool adapter itselfis designed to be split into two parts, one fully generated external part, which mainlycontains RESTful annotations and essential implementations to provide the RESTfulservices to the external world as defined in the model, and one internal part that needsto be implemented to connect the third-party tools.

Also, the platform provides some system level components that are used in the tooladapter. Those components are connected with wires in the configuration file.

In Figure 5.3, the architecture of a typical tool adapter to be generated is presentedby the composite diagram of the Matlab/Simulink Tool Adapter. As a typical tooladapter, the adapter itself contains two parts, the external part or SimulinkExternal inthe diagram and the internal part or SimulinkInternal in the diagram. The system levelcomponents ConverterService and IDResolvingService are encapsulated as separatecomposites and are connected to the tool adapter.

Figure 5.3. Composite Diagram of the Matlab/Simulink Tool Adapter

5.2.2.1 Tool Adapter Components

Each tool adapter contains two parts, external and internal. Each part includes a Javainterface as the Service in SCA, and a Java class as the implementation. The twoparts are connected by a wire in SCA. For each tool adapter, a composite file is alsoincluded to define the configurations to integrate the components of the tool adapterand the system level components together.

Please note, as the feature in Frascati, the connections can be modified dynamicallyto other ways. Also, in real deployment, the different components, for example thetwo parts of the tool adapter, can be deployed in different machines if needed.

26

Page 39: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Tool Adapter External

The external part of the tool adapter is fully generated on the basis of the tool adaptermodel designed following our guidelines. The generated component is strictly follow-ing OSLC specification and other guidelines we defined.

More specifically, this component includes the following part:

• RESTful service declarations and implementations of the data and control inte-gration functionalities: all the actual implementations and parameter handlingare delegated to the internal component of the tool adapter.

• Full implementation of OSLC directory services, including ServiceProvider-Catalog, ServiceProvider and ResourceShape services of the data resources.For the implementation details, ServiceProviderCatalog and ServiceProviderservices are on the basis of the templates predefined combined with tool specificinformation extracted from oslc sub-package of the model, and ResourceShapeservices are directly provided on the ResourceShape templates generated fromthe model.

• SCA configurations to bind the service to a specific address and wire the helperinstance to the internal component.

For the OSLC services, the implementations of the ServiceProviderCatalog andServiceProvider are based on the following strategies:

• A ServiceProvider lists a category of the data or control services provided bythe tool adapter, no ServiceProvider contains both data and control services.

• When representing data services, the creation URI of the resource is in theinlined resource oslc:CreationFactory and the listing URI of the resources isin the inlined resource oslc:QueryCapability. One data resource will have oneoslc:CreationFactory and one oslc:QueryCapability.

• When representing control services, the invocation URI of the resource is in theinlined resource oslc:CreationFactory, and no oslc:QueryCapability resourceexisted.

Please note, because of the lack of control resources support in OSLC, here wemake a strong assumption to place the control services properly and distinguish thecontrol services from data services. Also, currently, the OSLC specification does notprovide any support on the directory services of the parameters for both the data andcontrol services. In the future, the standard of the directory service for parametersshould be established by the OSLC community.

Tool Adapter Internal

This part, contrary to the external component, is required for the user of the platformto fill in the tool adapter specific codes.

To ease the work of the developer of tool adapters and to make sure the developerfills in the codes in the right way, a general framework is predefined and includedwith examples in the the generated stubs. The work that the developer needs to doincludes the handling of parameters from the web service calls, the implementation ofinteractions of the tools with the tool API, etc. Those parts are all marked as TODO

27

Page 40: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

in the protected region where custom modification will remain after the re-generation.A wrapper for the parameters from the web service calls and another wrapper forthe response from the tool are provided, which the user must use to interact with thepredefined framework.

This part also links to the system components to provide the converter service andthe ID resolving service, therefore SCA configurations are generated to link the rightinstances to the system level components.

In the current demo, to support the special functionalities of the tool, several pa-rameters as summarized in Table 5.1 are included by the platform which the user ofthe platform is suggested to follow and make use of.

Table 5.1. Parameters predefined in the construction platform

Name Type Description

model_name String To support the ID resolving service, if the tool isproject or model based, this parameter must be in-cluded in the service call or default value predefinedshould be used in the implementation, and the parame-ter must be extracted and then set as the ServiceParamof the ID resolving service.

subtree_levels Integer It is an optional parameter to enable the multiplesubtree-levels access responses. Refer to Section5.2.2.2 for more information.

converter String It is an optional parameter only when the automated-selection output service is selected as the current con-verter service. XMI converter service will be called ifthe value is "xmi", RDF converter service will be calledotherwise. Refer to Section 5.2.2.2 for more informa-tion.

5.2.2.2 System Level Components

Two system level components are included in the current platform: the ID resolvingservice and the converter service. Both the services are encapsulated as SCA compos-ites, and included in the platform libraries.

The ID Resolving Service

The ID resolving service mainly manages all the different kinds of IDs of objectsin different tools. A system ID that looks no difference in different tools is alwaysused outside the tool to hide the implementation details. The service is implementedindependent of the tool adapters, the same codes will be used for all tool adapters,although different instances will be created if running on multiple machines.

This service mainly provides a resolving service (resolving from system ID to toolID) and a backward resolving service (resolving from tool ID to system ID). Usually,

28

Page 41: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

it is the responsibility of user of the platform to call the resolving service to convertthe system IDs in the web service parameters to the tool IDs used inside the tool, whilefor the response from the tool, in normal cases (if those IDs are named as uuid andused as the key of the object), the specific IDs are automatically converted to systemIDs by the converter service.

To use this service, pre-registration of the initialization method is required whichwill be automatically called when the current tool (with tool project/model name ifavailable) is not recorded in the database. This initialization method should returnall the tool IDs in the tool as a list, and the service will bind a generated uuid as thesystem ID for each of the tool ID. When in the creation or deletion of the resources,corresponding calls should be made to the service to create new ID mappings or deleteold mappings.

For the current implementation of this service, an embedded SQLite31 database isincluded to store the ID pairs (tool ID and system ID pair with tool adapter name andproject name if applicable) of each tools. A more sophisticated solution can be madein complex scenarios.

Please note, this service can be disabled by not linking the corresponding referencein the internal component of the tool adapter to the IdManager implemented in thelibrary.

The Converter Service

The converter service is the service to output the resources from the tool in a spe-cific standard way. For the current platform library, a RDF-based output service, aXMI-based output service and an auto-select service based on a specific parameter areprovided. The converter service is also a tool adapter independent component, but dif-ferent tool adapters will use a separate instance of the service. With Frascati injectingtools, the current response type of the web services can be modified by changing thewires of the components on the fly.

In general cases, the output style of the resources is followed by the examples fromOSLC which will usually presents references of the resources as external URIs (or IDswhen in XMI-based output style). However, for RDF-based and XMI-based services,the output styles are of tiny differences when output a list of the resources or outputthe details of a resource. Those differences are summarized in Table 5.2.

For the auto-select service, a special parameter called converter is extracted. XMIconverter service is called if the value of the parameter is "xmi", RDF converter serviceis called otherwise.

This converter service also supports a feature called "multiple subtree-level access"through a parameter subtree_levels. If this parameter is not provided, or the value ofthe parameter is 0, the general way of the output as described before and summarizedin Table 5.2 will be used, otherwise, the external URIs or (IDs) will be replaced asinline resources for whatever output service type is. With the increment of the value,the inlinement of the resources will be to a larger depth.

1http://www.sqlite.org/

29

Page 42: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Table 5.2. Different output styles of XMI-based and RDF-based output services

Service Type Output Type Description

RDF-based List of Resources Resources are listed with external URIsonly

XMI-based List of Resources Resources are listed with IDs and valuesof other attributes, no references included

RDF-based Details of a Resource Values of non-empty attributes are in-cluded, non-empty references are in-cluded as external URIs only

XMI-based Details of a Resource Values of non-empty attributes are in-cluded, non-empty references are in-cluded with IDs and values of other at-tributes, no references of references in-cluded

With the converter service, responses can be automatically converted to the righttype with the considerations of different operation statuses and different categories ofresults. Examples are special response when the resource is not found or executionexception is thrown.

The converter service may be initialized with an ID resolving service. In this case,before the conversion of the response, data in all key fields (named as uuid) will bereplaced by the system ID from the backward resolving service.

Please note, in the implementation of the converter service, we assume that thekey of the resource is named by uuid. To meet this assumption, please follow theguidelines in designing the model.

5.2.3 Generation of the Tool Adapter from a Model

This part will discuss the generation from the model to the tool adapter. The generationhere is a Model-to-text transformation, and is separated as two parts:

For the first part, it is the Java implementation generation of the model we created.This part, the transformation process is already provided by EMF. In EMF, based onthe model, the relevant data types represented as classes can be generated to Javasource codes. The generated classes can be used when interacting with the tools asdata structures and our system level components will only operate on the objects ofthe generated classes.

After the design of the model based on Ecore, a generation model can be createdand then the codes of the model can be generated through a few clicks on the GUI.However, to integrate all the generation work together, a separate utility for this pur-pose is developed to be included in the generation engine.

For the second part, it is the generation of tool adapter stubs based on the modelwe created. Different to the generation of the model, here we need to develop our

30

Page 43: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

own rules for the Model-to-text transformation process. Based on Acceleo, rules aredefined in the following parts:

• Java codes for both the external and internal component of the tool adapter. Ingeneral, the external component is fully generated, however, only partial of thecodes are generated for the internal component, and more needs to be filled bythe user of the platform. For EMF based tools, more codes can be generated asa common implementation of tool specific codes exist.

• SCA composite file for the tool adapter with wires between the correspondingcomponents.

• Freemarker templates to be used in the OSLC directory service implementationsin the external component of the tool adapter. With Freemarker, templates forthe general structures of the OSLC defined resources can be created beforehand,and with the information fetch at runtime, specialized output can be createdeasily.

• POM file of the tool adapter which is used to configure and run SCA middle-ware through an easy way.

• Other setting files including an optional client setting file which can be used inthe deployment or by the user and an optional log4j configuration file.

More specifically, in the internal component, the interaction details in the imple-mentation class should be implemented by the developer. Those details are markedwith TODO in the protected region noted between Start of user code XXX and End ofuser code XXX. The user can also include user specific codes in the protected region.In summary, developer should implement the following parts:

• Register the ID Resolving Service idManager with instance of class that imple-ments IInitIdService (to support the initialization of the ID Resolving Service).

• Register XMI parser and user meta model if needed, e.g.: if the user needs toread or write resources based on those models.

• Implement getNS of different service types (data or control), the result will beincluded in the response.

• Complete processRequest method with the service name and parameters in-cluded: process the event object generated and set the answer as part of theevent. It is suggested that the developer creates user specific classes in otherpackages and calls those classes here.

• Handling of parameters in prepare method and all other help methods declaredfor the services provided. Parameters can be validated and added with/withoutID resolution.

Also, in the generated configuration file of the SCA based tool adapter, deploymentconfigurations like the binding URIs of the services should be modified accordingly.

Please note, the generation engine provided in the platform is actually based onthe TIL model as discussed in Section 1.2 to provide the generation capability forthe whole tool chain. In the big picture, each tool adapter will have its own externaland internal components, SCA composite file for its own configuration and OSLCbased resource shape templates, but there will be only one copy of templates to pro-vide different ServiceProviderCatalog and ServiceProvider services for different tooladapters together with the tool adapter meta information retrieved from the model, and

31

Page 44: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

also there will be only one POM file, one setting file and one log4j configuration filefor the whole tool chain.

5.3 Construction of Tool Adapters on the Platform

In this section, we present the process to construct a tool adapter based on the platformas introduced before. A case study of constructing a Matlab/Simulink tool adapter onthe platform is provided through the process.

5.3.1 Model the Data and Control Integration

The first step of the construction of a tool adapter is to design the tool adapter modelfollowing the guidelines discussed in Section 5.2.1.

Before that, the data and control integration services to be provided are identifiedthrough the analysis of user requirements. For the simplification of the example, weassume we will provide the following services of the Matlab/Simulink tool as summa-rized in Table 5.3 and Table 5.4. Please note, those services are not complete for thetool, and the encapsulation of the services may not be 100% accurate for the tool.

Table 5.3. Data Services to be provided in Matlab/Simulink

Resource Name Properties

Block ID, name, block type, parent block, sub-blocks, containingports, containing lines

Connection ID, name, parent block, source port, destination portPort ID, name, parent block, port type, port number

Table 5.4. Control Services to be provided in Matlab/Simulink

Resource Name Parameters

Load model Model nameSave model Model nameOpen model Model nameClose model Model nameStart simulation Model nameSelect component Model name, ID of the component, Flag to select or de-selectExport Name of the model to be exportedImport Name of the new model to be imported, Content of the model

in XMI

Also, there is some meta information to be included in the model to implement theOSLC directory services.

32

Page 45: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Following the guidelines, and take the consideration of parameters predefined inthe platform, we design the data model and the core model of Matlab/Simulink as inFigure 5.4 and Figure 5.5.

5.3.2 Generate the Tool Adapter Stubs

By executing the Ecore code generation process provided by EMF, a Java implemen-tation of the tool adapter model is generated. Those classes are used as data structureswhen working with the tool adapters. For our example of the Matlab/Simulink tooladapter, the Java source files generated are presented as in Figure 5.6.

By executing the model-to-tool-adapter generation process, we will get the wholetool adapter stubs as introduced before. For our example of the Matlab/Simulink tooladapter, the files generated are presented as in Figure 5.7.

For a complete reference, the most important part of the generated codes are in-cluded in Appendix A.

Please note, here presents the generation result of the TIL model containing themodel of Matlab/Simulink adapter, therefore files for the tool chain will also be gen-erated.

5.3.3 Implementation of the Tool Adapter

In this part, the developer of the tool adapter should fill in the blanks in the generatedresults as summarized in Section 5.2.3. Generally speaking, there are three categoriesof the tasks should be manually involved by the developer, the settings of the initializa-tions parameter of the system components provided by the framework, the parameterhandling of the web service calls because of the limitation in parameter modelings andthe manual implementation of the tool related functionalities.

Compared to other tasks, the manual implementation of tool related functionalitiestakes up most of the efforts. In the following part, the design details of the manualimplementation part of the Matlab/Simulink adapter are presented.

As introduced in Section 4.3, this Matlab/Simulink adapter is built on an existingtool adapter. Architecture of the tool adapter is refined to fit the general developmentprocess in the framework through a third-party Java RMI based library matlabcontrol,and implementations of the control functionalities are added.

More specifically, as suggested in Section 5.2.3, an external class MatlabProxy-Wrapper is created to delegate all the related requests to the Matlab codes throughmatlabcontrol. In Matlab, the requests are analyzed and routed to the right class, andthe final results are returned through data structures from EMF model generation. Themanual part of the architecture of Matlab/Simulink tool adapter is depicted in Figure5.8.

33

Page 46: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 5.4. Design of the data model of Matlab/Simulink Tool Adapter

Figure 5.5. Design of the core model of Matlab/Simulink Tool Adapter

34

Page 47: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 5.6. Java implementation generated of the data and core model of Mat-lab/Simulink tool adapter

Figure 5.7. Tool adapter stubs generated based on the data and core model of Mat-lab/Simulink tool adapter

35

Page 48: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 5.8. Architecture of Matlab/Simulink Tool Adapter (Manual Part)

36

Page 49: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

5.3.4 Testing and the Result

After the implementation of the tool adapter (or tool adapters), the tool chain can betested simply by the Maven command mvn clean install -P run.

Below we present the testing result of the implemented Matlab/Simulink adapterwith the designed model york as displayed in Figure 5.9 (sub-blocks are also presentedin hierarchies).

Because of the limitation of the space in the thesis report, we only include theresponse of GET a list of Block resource and GET the details of one Block resourcewith sub-tree access level 1 in RDF and XMI output type. For the OSLC directoryservices and some other examples, please refer to the step by step analysis of thediscovery algorithm with the example of this tool adapter in Section 6.2.2.

GET a list of Block resource with sub-tree access level 1 in RDF with URIhttp://localhost:8080/Simulink/block?subtree_levels=1&converter=rdf

1 <rdf :RDF2 x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"3 x m l n s : o s l c _ s i m u l i n k _ d a t a ="http://md.kth.se/oslc/simulink/1.0/data←↩

#"4 xmlns :owl ="http://www.w3.org/2002/07/owl#"5 x m l n s : x s d ="http://www.w3.org/2001/XMLSchema#"6 x m l n s : r d f s ="http://www.w3.org/2000/01/rdf-schema#">7 < r d f : D e s c r i p t i o n r d f : a b o u t ="http://localhost:8080/Simulink/block">8 < rd f s :member >9 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/←↩

Simulink/block/1fc429e1-a0e6-4316-b5bb-8a1f2630b87c">10 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/port/04768521-2f0c-466a-80f1-beae7979cb96" / >11 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/port/6fe65962-ca1e-4e43-8c97-92030cad80d5" / >12 < o s l c _ s i m u l i n k _ d a t a : t y p e >Gain< / o s l c _ s i m u l i n k _ d a t a : t y p e >13 < o s l c _ s i m u l i n k _ d a t a : n a m e >F3< / o s l c _ s i m u l i n k _ d a t a : n a m e >14 < o s l c _ s i m u l i n k _ d a t a : u u i d >1fc429e1−a0e6−4316−b5bb−8a1f2630b87c←↩

< / o s l c _ s i m u l i n k _ d a t a : u u i d >15 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >16 < / rd f s :member >17 < rd f s :member >18 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/←↩

Simulink/block/3ce3ebf6-fb28-402d-99f8-c6556bb1504a">19 < o s l c _ s i m u l i n k _ d a t a : t y p e >SubSystem< / o s l c _ s i m u l i n k _ d a t a : t y p e >20 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/port/7b49f7f2 -0163-462f-b664-75b6f39dc32c" / >21 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/connection/80940741-8d6e-46cc-97a3-0d1c7c0c18bf←↩" / >

22 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/6fe4af76-a073-4c77-9f0f-←↩ae76f1755754" / >

23 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/95516e4a-456c-4983-af51-54←↩dfbe09eeda" / >

37

Page 50: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

York Model

York/F1

York/F2

York/F2/F21

York/F2/F22

Figure 5.9. Screen shot of Matlab/Simulink model york

38

Page 51: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

24 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/connection/846c0d90-8c4a-4411-afd4-7754c62bc9ec←↩" / >

25 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/port/bdfd2bac-a8ec-4ef6-90c7-12c2aa40aa23" / >

26 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/connection/6b75d0d6-76ab-4a6a-84c0-69d9f27c5160←↩" / >

27 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/d4dc9138-f964-49b5-b3ec-←↩e082f48aeb2d" / >

28 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/916fe85d-998d-4359-8602-80←↩e766c353fb" / >

29 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/29a3ee39-c577-402c-a418-0←↩bc7c35cbac7" / >

30 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/connection/53242554-f7ae-4b88-8c0c-643c128c2c63←↩" / >

31 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/connection/c38954a3 -7935-4b9b-9025-097ad8fc6c44←↩" / >

32 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/port/d6028fe3 -5963-492c-976f-8214f5b7ecdc" / >

33 < o s l c _ s i m u l i n k _ d a t a : n a m e >F2< / o s l c _ s i m u l i n k _ d a t a : n a m e >34 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩

localhost:8080/Simulink/block/ece3473a -1568-47f5-a8de-498←↩c7a8f8211" / >

35 < o s l c _ s i m u l i n k _ d a t a : u u i d >3ce3ebf6−fb28−402d−99f8−c6556bb1504a←↩< / o s l c _ s i m u l i n k _ d a t a : u u i d >

36 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >37 < / rd f s :member >38 < rd f s :member >39 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/←↩

Simulink/block/272fd601-9b74-4726-a4e3-22a57e451873">40 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/connection/5cedbac9-d627-4071-aa58-250e8a8dce41←↩" / >

41 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/port/41a94277-3a02-4faf-a489-953c4b7fb28b" / >

42 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩/Simulink/port/f525b6b7 -2528-4c66-9d9f-95e44bdcff94" / >

43 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/cae9c004-c635-429f-bde7-709←↩b626c34f9" / >

44 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/1cd858d5-f1ca-4943-852a←↩-3190dd6f72a6" / >

45 < o s l c _ s i m u l i n k _ d a t a : t y p e >SubSystem< / o s l c _ s i m u l i n k _ d a t a : t y p e >46 < o s l c _ s i m u l i n k _ d a t a : n a m e >F1< / o s l c _ s i m u l i n k _ d a t a : n a m e >47 < o s l c _ s i m u l i n k _ d a t a : u u i d >272fd601−9b74−4726−a4e3−22a57e451873←↩

< / o s l c _ s i m u l i n k _ d a t a : u u i d >48 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >49 < / rd f s :member >50 < / r d f : D e s c r i p t i o n >

39

Page 52: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

51 < / rdf :RDF>

GET a list of Block resource with sub-tree access level 1 in XMI with URIhttp://localhost:8080/Simulink/block?subtree_levels=1&converter=xmi

1 <?xml version="1.0" e n c o d i n g ="ASCII"?>2 <xmi:XMI x m i : v e r s i o n ="2.0" xmlns :xmi ="http://www.omg.org/XMI" ←↩

x m l n s : o s l c _ s i m u l i n k _ d a t a ="http://md.kth.se/oslc/simulink/1.0/data←↩#">

3 < o s l c _ s i m u l i n k _ d a t a : B l o c k uu id ="272fd601-9b74-4726-a4e3-22←↩a57e451873" name="F1" t y p e ="SubSystem">

4 < c h i l d r e n uu id ="1cd858d5-f1ca-4943-852a-3190dd6f72a6" name="←↩Inport1" t y p e ="Inport" / >

5 < c h i l d r e n uu id ="cae9c004-c635-429f-bde7-709b626c34f9" name="←↩Outport1" t y p e ="Outport" / >

6 < p o r t s uu id ="f525b6b7 -2528-4c66-9d9f-95e44bdcff94" name="Inport1"←↩t y p e ="Inport" number="1" / >

7 < p o r t s uu id ="41a94277-3a02-4faf-a489-953c4b7fb28b" name="Outport1←↩" t y p e ="Outport" number="1" / >

8 < l i n e s uu id ="5cedbac9-d627-4071-aa58-250e8a8dce41" name="←↩LineF1InOut" / >

9 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >10 < o s l c _ s i m u l i n k _ d a t a : B l o c k uu id ="3ce3ebf6-fb28-402d-99f8-←↩

c6556bb1504a" name="F2" t y p e ="SubSystem">11 < c h i l d r e n uu id ="ece3473a -1568-47f5-a8de-498c7a8f8211" name="←↩

Inport1" t y p e ="Inport" / >12 < c h i l d r e n uu id ="d4dc9138-f964-49b5-b3ec-e082f48aeb2d" name="Demux←↩

" t y p e ="Demux" / >13 < c h i l d r e n uu id ="6fe4af76-a073-4c77-9f0f-ae76f1755754" name="F21" ←↩

t y p e ="SubSystem" / >14 < c h i l d r e n uu id ="29a3ee39-c577-402c-a418-0bc7c35cbac7" name="F22" ←↩

t y p e ="SubSystem" / >15 < c h i l d r e n uu id ="95516e4a-456c-4983-af51-54dfbe09eeda" name="←↩

Outport1" t y p e ="Outport" / >16 < c h i l d r e n uu id ="916fe85d-998d-4359-8602-80e766c353fb" name="←↩

Outport2" t y p e ="Outport" / >17 < p o r t s uu id ="d6028fe3 -5963-492c-976f-8214f5b7ecdc" name="Inport1"←↩

t y p e ="Inport" number="1" / >18 < p o r t s uu id ="7b49f7f2 -0163-462f-b664-75b6f39dc32c" name="Outport1←↩

" t y p e ="Outport" number="1" / >19 < p o r t s uu id ="bdfd2bac-a8ec-4ef6-90c7-12c2aa40aa23" name="Outport2←↩

" t y p e ="Outport" number="2" / >20 < l i n e s uu id ="80940741-8d6e-46cc-97a3-0d1c7c0c18bf" name="←↩

LineF2F22O2" / >21 < l i n e s uu id ="c38954a3 -7935-4b9b-9025-097ad8fc6c44" name="←↩

LineF2F21O1" / >22 < l i n e s uu id ="6b75d0d6-76ab-4a6a-84c0-69d9f27c5160" name="←↩

LineF2SplitF22" / >23 < l i n e s uu id ="53242554-f7ae-4b88-8c0c-643c128c2c63" name="←↩

LineF2SplitF21" / >24 < l i n e s uu id ="846c0d90-8c4a-4411-afd4-7754c62bc9ec" name="←↩

LineF2InSplit" / >25 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >

40

Page 53: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

26 < o s l c _ s i m u l i n k _ d a t a : B l o c k uu id ="1fc429e1-a0e6-4316-b5bb-8←↩a1f2630b87c" name="F3" t y p e ="Gain">

27 < p o r t s uu id ="6fe65962-ca1e-4e43-8c97-92030cad80d5" t y p e ="Inport" ←↩number="1" / >

28 < p o r t s uu id ="04768521-2f0c-466a-80f1-beae7979cb96" t y p e ="Outport"←↩number="1" / >

29 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >30 < / xmi:XMI>

GET the details of one Block resource with sub-tree access level 1 in RDF with URIhttp://localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22a57e451873?subtree_levels=1&converter=rdf

1 <rdf :RDF2 x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"3 x m l n s : o s l c _ s i m u l i n k _ d a t a ="http://md.kth.se/oslc/simulink/1.0/data←↩

#"4 xmlns :owl ="http://www.w3.org/2002/07/owl#"5 x m l n s : x s d ="http://www.w3.org/2001/XMLSchema#"6 x m l n s : r d f s ="http://www.w3.org/2000/01/rdf-schema#">7 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/Simulink←↩

/block/272fd601-9b74-4726-a4e3-22a57e451873">8 < o s l c _ s i m u l i n k _ d a t a : l i n e s >9 < o s l c _ s i m u l i n k _ d a t a : C o n n e c t i o n r d f : a b o u t ="http://localhost:8080←↩

/Simulink/connection/5cedbac9-d627-4071-aa58-250e8a8dce41">10 < o s l c _ s i m u l i n k _ d a t a : d e s t i n a t i o n r d f : r e s o u r c e ="http://←↩

localhost:8080/Simulink/port/9cad4e12-cb43-4b17-b4df-←↩fddf9ae1bba9" / >

11 < o s l c _ s i m u l i n k _ d a t a : s o u r c e r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/port/e45c8579-fecb-4445-beed-←↩d066e1d78bc5" / >

12 < o s l c _ s i m u l i n k _ d a t a : p a r e n t r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22←↩a57e451873" / >

13 < o s l c _ s i m u l i n k _ d a t a : n a m e >LineF1InOut< / o s l c _ s i m u l i n k _ d a t a : n a m e←↩>

14 < o s l c _ s i m u l i n k _ d a t a : u u i d >5cedbac9−d627−4071−aa58−250e8a8dce41←↩< / o s l c _ s i m u l i n k _ d a t a : u u i d >

15 < / o s l c _ s i m u l i n k _ d a t a : C o n n e c t i o n >16 < / o s l c _ s i m u l i n k _ d a t a : l i n e s >17 < o s l c _ s i m u l i n k _ d a t a : p o r t s >18 < o s l c _ s i m u l i n k _ d a t a : P o r t r d f : a b o u t ="http://localhost:8080/←↩

Simulink/port/41a94277-3a02-4faf-a489-953c4b7fb28b">19 < o s l c _ s i m u l i n k _ d a t a : p a r e n t r d f : r e s o u r c e ="http://←↩

localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22←↩a57e451873" / >

20 < o s l c _ s i m u l i n k _ d a t a : n u m b e r >1< / o s l c _ s i m u l i n k _ d a t a : n u m b e r >21 < o s l c _ s i m u l i n k _ d a t a : t y p e >Outport< / o s l c _ s i m u l i n k _ d a t a : t y p e >22 < o s l c _ s i m u l i n k _ d a t a : n a m e >Outport1< / o s l c _ s i m u l i n k _ d a t a : n a m e >23 < o s l c _ s i m u l i n k _ d a t a : u u i d >41a94277−3a02−4faf−a489−953c4b7fb28b←↩

< / o s l c _ s i m u l i n k _ d a t a : u u i d >24 < / o s l c _ s i m u l i n k _ d a t a : P o r t >25 < / o s l c _ s i m u l i n k _ d a t a : p o r t s >26 < o s l c _ s i m u l i n k _ d a t a : p o r t s >

41

Page 54: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

27 < o s l c _ s i m u l i n k _ d a t a : P o r t r d f : a b o u t ="http://localhost:8080/←↩Simulink/port/f525b6b7 -2528-4c66-9d9f-95e44bdcff94">

28 < o s l c _ s i m u l i n k _ d a t a : p a r e n t r d f : r e s o u r c e ="http://←↩localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22←↩a57e451873" / >

29 < o s l c _ s i m u l i n k _ d a t a : n u m b e r >1< / o s l c _ s i m u l i n k _ d a t a : n u m b e r >30 < o s l c _ s i m u l i n k _ d a t a : t y p e >Inport< / o s l c _ s i m u l i n k _ d a t a : t y p e >31 < o s l c _ s i m u l i n k _ d a t a : n a m e >Inport1< / o s l c _ s i m u l i n k _ d a t a : n a m e >32 < o s l c _ s i m u l i n k _ d a t a : u u i d >f525b6b7−2528−4c66−9d9f−95e44bdcff94←↩

< / o s l c _ s i m u l i n k _ d a t a : u u i d >33 < / o s l c _ s i m u l i n k _ d a t a : P o r t >34 < / o s l c _ s i m u l i n k _ d a t a : p o r t s >35 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n >36 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/←↩

Simulink/block/cae9c004-c635-429f-bde7-709b626c34f9">37 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/port/9cad4e12-cb43-4b17-b4df-fddf9ae1bba9" / >38 < o s l c _ s i m u l i n k _ d a t a : p a r e n t r d f : r e s o u r c e ="http://←↩

localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22←↩a57e451873" / >

39 < o s l c _ s i m u l i n k _ d a t a : t y p e >Outport< / o s l c _ s i m u l i n k _ d a t a : t y p e >40 < o s l c _ s i m u l i n k _ d a t a : n a m e >Outport1< / o s l c _ s i m u l i n k _ d a t a : n a m e >41 < o s l c _ s i m u l i n k _ d a t a : u u i d >cae9c004−c635−429f−bde7−709b626c34f9←↩

< / o s l c _ s i m u l i n k _ d a t a : u u i d >42 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >43 < / o s l c _ s i m u l i n k _ d a t a : c h i l d r e n >44 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n >45 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/←↩

Simulink/block/1cd858d5-f1ca-4943-852a-3190dd6f72a6">46 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080←↩

/Simulink/port/e45c8579-fecb-4445-beed-d066e1d78bc5" / >47 < o s l c _ s i m u l i n k _ d a t a : p a r e n t r d f : r e s o u r c e ="http://←↩

localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22←↩a57e451873" / >

48 < o s l c _ s i m u l i n k _ d a t a : t y p e >Inport< / o s l c _ s i m u l i n k _ d a t a : t y p e >49 < o s l c _ s i m u l i n k _ d a t a : n a m e >Inport1< / o s l c _ s i m u l i n k _ d a t a : n a m e >50 < o s l c _ s i m u l i n k _ d a t a : u u i d >1cd858d5−f1ca−4943−852a−3190dd6f72a6←↩

< / o s l c _ s i m u l i n k _ d a t a : u u i d >51 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >52 < / o s l c _ s i m u l i n k _ d a t a : c h i l d r e n >53 < o s l c _ s i m u l i n k _ d a t a : t y p e >SubSystem< / o s l c _ s i m u l i n k _ d a t a : t y p e >54 < o s l c _ s i m u l i n k _ d a t a : n a m e >F1< / o s l c _ s i m u l i n k _ d a t a : n a m e >55 < o s l c _ s i m u l i n k _ d a t a : u u i d >272fd601−9b74−4726−a4e3−22a57e451873< /←↩

o s l c _ s i m u l i n k _ d a t a : u u i d >56 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >57 < / rdf :RDF>

GET the details of one Block resource with sub-tree access level 1 in XMI with URIhttp://localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22a57e451873?subtree_levels=1&converter=xmi

1 <?xml version="1.0" e n c o d i n g ="ASCII"?>2 < o s l c _ s i m u l i n k _ d a t a : B l o c k x m i : v e r s i o n ="2.0" xmlns :xmi ="http://www.omg←↩

.org/XMI" x m l n s : o s l c _ s i m u l i n k _ d a t a ="http://md.kth.se/oslc/←↩

42

Page 55: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

simulink/1.0/data#" uu id ="272fd601-9b74-4726-a4e3-22a57e451873" ←↩name="F1" t y p e ="SubSystem">

3 < c h i l d r e n uu id ="1cd858d5-f1ca-4943-852a-3190dd6f72a6" name="Inport1←↩" p a r e n t ="272fd601-9b74-4726-a4e3-22a57e451873" t y p e ="Inport">

4 < p o r t s uu id ="e45c8579-fecb-4445-beed-d066e1d78bc5" t y p e ="Outport"←↩number="1" / >

5 < / c h i l d r e n >6 < c h i l d r e n uu id ="cae9c004-c635-429f-bde7-709b626c34f9" name="←↩

Outport1" p a r e n t ="272fd601-9b74-4726-a4e3-22a57e451873" t y p e ="←↩Outport">

7 < p o r t s uu id ="9cad4e12-cb43-4b17-b4df-fddf9ae1bba9" t y p e ="Inport" ←↩number="1" / >

8 < / c h i l d r e n >9 < p o r t s uu id ="f525b6b7 -2528-4c66-9d9f-95e44bdcff94" name="Inport1" ←↩

p a r e n t ="272fd601-9b74-4726-a4e3-22a57e451873" t y p e ="Inport" ←↩number="1" / >

10 < p o r t s uu id ="41a94277-3a02-4faf-a489-953c4b7fb28b" name="Outport1" ←↩p a r e n t ="272fd601-9b74-4726-a4e3-22a57e451873" t y p e ="Outport" ←↩number="1" / >

11 < l i n e s uu id ="5cedbac9-d627-4071-aa58-250e8a8dce41" name="←↩LineF1InOut" p a r e n t ="272fd601-9b74-4726-a4e3-22a57e451873" ←↩s o u r c e ="e45c8579-fecb-4445-beed-d066e1d78bc5" d e s t i n a t i o n ="9←↩cad4e12-cb43-4b17-b4df-fddf9ae1bba9" / >

12 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >

5.4 Limitations and Assumptions

Here, we summarize the limitations and assumptions made of the current tool adapterconstruction platform and/or the current Matlab/Simulink adapter.

43

Page 56: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Table 5.5. Limitations and assumptions of the tool adapter construction platform

Relevant Part Description

Model related Additional parameters of the data services cannot be represented in the model, thus cannot be generated in the tooladapter stubs.

OSLC related No directory services available in OSLC for parameters in data and control services.OSLC related A ServiceProvider lists a category of the data or control services provided by the tool adapter, no ServiceProvider

contains both data and control services. When representing data services, the creation URI of the resourceis in the inlined resource oslc:CreationFactory and the listing URI of the resources is in the inlined resourceoslc:QueryCapability. One data resource will have one oslc:CreationFactory and one oslc:QueryCapability. Whenrepresenting control services, the invocation URI of the resource is in the inlined resource oslc:CreationFactory,and no oslc:QueryCapability resource existed.

SCA configurations Components are linked with wires directly in the default generated configurations.SCA configurations 0.0.0.0 can’t be used in the binding address of the RESTful web services in the SCA configuration, otherwise the

OSLC directory services may not work properly.ID Resolving Service Only one instance of ID resolving service in one execution unit, ID pairs are stored in the local database. Service is

not suggested to serve globally.Converter Service The uuid is assumed as the only key of the object.Converter Service Tiny differences in RDF or XMI representations exist as summarized in Table 5.2.Converter Service We use State 500 for exception with exception message as the response, State 201 for created object with a link in

the location and created object content as response (according to REST), State 200 for normal response and State404 for resources not found.

44

Page 57: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Table 5.6. Limitations and assumptions of the current Matlab/Simulink implementa-tion

Relevant Part Description

Generated tool adapter stubs Serializable interface is added to the generatedmodels manually, as the objects are transmittedthrough Java RMI.

Third-party library A third-party library is used to invoke Matlabcodes from Java, this library however is not sta-ble as it is created by hacking the Java RMI serverrunning inside Matlab.

Matlab codes The ID (through TAG) of a connection without thename is not persistent, however the adapter makessure the name should be provided when creating anew connection.

45

Page 58: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

6. Automated Discovery of Unknown ToolAdapters Conforming to OSLC

6.1 Introduction

To construct a tool chain, it is not possible to build tool adapters for all the tools usedin the solution on one’s own. More practically, adapters are constructed by differentvendors, shared in creating tool integration solutions. To accomplish this aim, the tooladapters must be following the same standard.

In this chapter, we explain how an unknown tool adapter conforming to OSLC andbuilt on the platform we describe in Section 5.2 can be discovered and then configuredautomatically to be included in the tool chain.

In the OSLC standard [34], the start point of the services provided is the URIof ServiceProviderCatalog, which gives the same start point for the automatic dis-covery process. With this URI, we aim to understand the services provided by theunknown adapter, and try to generate the stubs needed to consume the RESTful ser-vices. Therefore, the automated discovery of unknown tool adapters is quite similar tothe discovery process of a SOAP web service through WSDL. The only difference isthat to discover an unknown tool adapter is a more concrete problem compared to thediscovery of a general web service. Also, because of the simplified grammar that theRESTful web service is based on, we are unable to get useful information through di-rectory services similar to WSDL, the only possible way to get needed information isto follow the OSLC specification and query the information through OSLC directoryservices.

The general idea is, by parsing the content of ServiceProviderCatalog, and thenfollowing the content of ServiceProvider, ResourceShapes of the resources, etc, wecan create a model for the discovered tool. With this model, in the similar way as wedo to generate tool adapter stubs to construct a tool adapter based on the constructionplatform in Section 5.3.2, we can generate discovered tool adapter stubs which can beused to bind to address of the RESTful services. This discovered tool adapter stubswill be encapsulated in SCA component and can be included into the SCA based toolchain easily. In this way, the unknown tool adapter can be automatically discoveredand configured, and no more manual configurations needed in the integration process.

As described in the user scenario in Section 4.2.2, in the future, the user who wantsto include an unknown tool adapter to the tool chain will only need to provide anaddress of the start point (the URI of the ServiceProviderCatalog), thereafter, thediscovered tool adapter stubs are generated and configured to be included in the tooladapter automatically.

46

Page 59: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 6.1. General process of automated discovery of unknown tool adapters con-forming to OSLC

In this chapter, just like the previous chapter, details of the discovery and con-figuration processes are presented with an example of discovering an unknown tooladapter. To simplify the thesis project, and also because of the unavailability of othertool adapters conforming to OSLC and built on our platform, we use the previousconstructed Matlab/Simulink Adapter as the discovery target.

6.2 Approach

6.2.1 Model Design of the Discovered Tool Adapter

Similar to the tool adapter model in the construction process, a discovered tool adaptermodel is used to encapsulate the data, control and OSLC services provided by thetool adapter. The difference is that the information is obtained through the discoveryprocess, and is only used to generate the stubs we need for consuming the services.

In other words, the model must obey the following rules:

• It only includes information that can be obtained through OSLC services, noothers.

• It includes at least the information needed to generate the stubs to consume theservices.

With the previous experience of designing EMF based tool adapter models, andrules from the special context of the model here, we use the following strategies todesign the model:

• To facilitate the integration steps, we follow the same separate model guidelinein the construction process discussed in Section 5.2.1, which is to separate outthe data part as a data model, and all the other parts as a core model.

• We also follow the same guidelines as discussed in Section 5.2.1 to separatedifferent types of services in different packages or sub-packages. However, theinformation in the model is directly from the discovery process, and we don’tguarantee the generated model will be designed in the same way as we do in theconstruction process, e.g.: classes in data part are not inherited from Prototypein the ifest-common model as before.

• In addition to the information to be provided when designing the model for theconstruction process as discussed in Section 5.2.1, here the OSLC related infor-mation is obtained and recorded as annotations to the items (could be classes or

47

Page 60: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

operations for data and control services discovered), those information includ-ing the URI of the resource and some other meta information.

6.2.2 The Discovery Algorithm

In this section, we present the "discovery" in narrow sense, which is the algorithm todiscover the unknown tool adapter, and save the information needed as an EMF toolmeta model. The general process of this discovery algorithm includes:

• The start point of the service ServiceProviderCatalog defined in OSLC spec-ification provides all the service providers of this tool adapter. Following thelinks of each ServiceProvider, we will see a list of provided service which maybe control or data service provided by the tool.

• For the control service, we can easily find a list of services including the URIwe need to invoke the service, and other information needed like service titleand label as defined in OSLC specification.

• For the data service, we can easily find a list of data resources of the tool adapterwith their creation URI and query URI. However for the details of the resources,like the attributes included and references to others, we may either obtain fromthe ResourceShape or response details of a set of objects in the same type

In Figure 6.2, we present the detailed algorithm of the discovery process.

Figure 6.2. Detail algorithm of the automated discovery process

For a more clear understanding of the discovery algorithm, we summarize the de-tails of each operation with an example. In the demo for the service discovery, JerseyClient API is used to fetch the response of the RESTful web services, and Jena is usedto analyze the RDF-based response as introduced in 3.3.3.

48

Page 61: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Step 1: Find ServiceProviders: Parse ServiceProviderCatalog

By parsing the response of GET ServiceProviderCatalog with corresponding URI, wecan identify a set of oslc:ServiceProvider resources, each of which represents a cate-gory of the services provided by this tool adapter. Besides, OSLC related informationconcerning of the ServiceProviderCatalog is extracted and saved.

For each oslc:ServiceProvider resource, goto Step 2 for further processing.

In our example, by GET ServiceProviderCatalog with the URIhttp://localhost:8080/Simulink/oslc/service_provider_catalog, we canobtain the following response:

12 <rdf :RDF x m l n s : o s l c ="http://open-services.net/ns/core#"3 x m l n s : d c t e r m s ="http://purl.org/dc/terms/"4 x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#">56 < o s l c : S e r v i c e P r o v i d e r C a t a l o g7 r d f : a b o u t ="http://localhost:8080/Simulink/oslc/←↩

service_provider_catalog">8 < d c t e r m s : t i t l e >9 Matlab / Simulink OSLC Service Provider Catalog

10 < / d c t e r m s : t i t l e >11 < d c t e r m s : d e s c r i p t i o n >12 Enables navigation to Service Provider for each Data / ←↩

Control integration functionalities of Tool Matlab /←↩Simulink .

13 < / d c t e r m s : d e s c r i p t i o n >14 < o s l c : s e r v i c e P r o v i d e r >15 < o s l c : S e r v i c e P r o v i d e r r d f : a b o u t ="http://localhost:8080/←↩

Simulink/oslc/service_provider/data">16 < d c t e r m s : t i t l e >OSLC Simulink OSLC Service Provider − ←↩

Data< / d c t e r m s : t i t l e >17 < / o s l c : S e r v i c e P r o v i d e r >18 < / o s l c : s e r v i c e P r o v i d e r >19 < o s l c : s e r v i c e P r o v i d e r >20 < o s l c : S e r v i c e P r o v i d e r r d f : a b o u t ="http://localhost:8080/←↩

Simulink/oslc/service_provider/control">21 < d c t e r m s : t i t l e >OSLC Simulink OSLC Service Provider − ←↩

Control< / d c t e r m s : t i t l e >22 < / o s l c : S e r v i c e P r o v i d e r >23 < / o s l c : s e r v i c e P r o v i d e r >24 < / o s l c : S e r v i c e P r o v i d e r C a t a l o g >2526 < / rdf :RDF>

By parsing the content we can identify two oslc:ServiceProvider resources withURI http://localhost:8080/Simulink/oslc/service_provider/data andhttp://localhost:8080/Simulink/oslc/service_provider/control (line 15and 20) which will be further processed in Step 2. Also, we get the dcterms:title anddcterms:description properties of the current ServiceProviderCatalog resource whichcan be used in the future.

49

Page 62: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Step 2: Data or Control Service?

Before this step, we need to obtain the response of oslc:ServiceProvider by GET thecorresponding URI provided.

In our example, by GET oslc:ServiceProvider with the URI http://localhost:8080/Simulink/oslc/service_provider/data, we can obtain the following re-sponse:

1 <rdf :RDF x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"2 x m l n s : d c t e r m s ="http://purl.org/dc/terms/"3 x m l n s : o s l c ="http://open-services.net/ns/core#">45 < o s l c : S e r v i c e P r o v i d e r r d f : a b o u t ="http://localhost:8080/Simulink/←↩

oslc/service_provider/data">6 < d c t e r m s : t i t l e >7 OSLC Simulink OSLC Service Provider − Data8 < / d c t e r m s : t i t l e >9 < d c t e r m s : d e s c r i p t i o n >

10 Provide Data integration functionalities of Tool Matlab /←↩Simulink , e . g . List , Create , Get , Update ,

11 Delete a Model , Connection or Port .12 < / d c t e r m s : d e s c r i p t i o n >13 < o s l c : s e r v i c e >14 < o s l c : S e r v i c e >15 < o s l c : d o m a i n r d f : r e s o u r c e ="http://md.kth.se/oslc/simulink←↩

/1.0/data#" / >16 < o s l c : c r e a t i o n F a c t o r y >17 < o s l c : C r e a t i o n F a c t o r y >18 < d c t e r m s : t i t l e >Location for creation of Block Entries< /←↩

d c t e r m s : t i t l e >19 < o s l c : l a b e l >Block< / o s l c : l a b e l >20 < o s l c : c r e a t i o n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/block" / >21 < o s l c : r e s o u r c e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/shapes/Block" / >22 < o s l c : r e s o u r c e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩

simulink/1.0/data#Block" / >23 < / o s l c : C r e a t i o n F a c t o r y >24 < / o s l c : c r e a t i o n F a c t o r y >25 < o s l c : c r e a t i o n F a c t o r y >26 < o s l c : C r e a t i o n F a c t o r y >27 < d c t e r m s : t i t l e >Location for creation of Connection ←↩

Entries< / d c t e r m s : t i t l e >28 < o s l c : l a b e l >Connection< / o s l c : l a b e l >29 < o s l c : c r e a t i o n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/connection" / >30 < o s l c : r e s o u r c e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/shapes/Connection" / >31 < o s l c : r e s o u r c e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩

simulink/1.0/data#Connection" / >32 < / o s l c : C r e a t i o n F a c t o r y >33 < / o s l c : c r e a t i o n F a c t o r y >34 < o s l c : c r e a t i o n F a c t o r y >35 < o s l c : C r e a t i o n F a c t o r y >

50

Page 63: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

36 < d c t e r m s : t i t l e >Location for creation of Port Entries< /←↩d c t e r m s : t i t l e >

37 < o s l c : l a b e l >Port< / o s l c : l a b e l >38 < o s l c : c r e a t i o n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/port" / >39 < o s l c : r e s o u r c e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/shapes/Port" / >40 < o s l c : r e s o u r c e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩

simulink/1.0/data#Port" / >41 < / o s l c : C r e a t i o n F a c t o r y >42 < / o s l c : c r e a t i o n F a c t o r y >43 < o s l c : q u e r y C a p a b i l i t y >44 < o s l c : Q u e r y C a p a b i l i t y >45 < d c t e r m s : t i t l e >Block Query< / d c t e r m s : t i t l e >46 < o s l c : l a b e l >Block Query< / o s l c : l a b e l >47 < o s l c : q u e r y B a s e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/block" / >48 < / o s l c : Q u e r y C a p a b i l i t y >49 < / o s l c : q u e r y C a p a b i l i t y >50 < o s l c : q u e r y C a p a b i l i t y >51 < o s l c : Q u e r y C a p a b i l i t y >52 < d c t e r m s : t i t l e >Connection Query< / d c t e r m s : t i t l e >53 < o s l c : l a b e l >Connection Query< / o s l c : l a b e l >54 < o s l c : q u e r y B a s e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/connection" / >55 < / o s l c : Q u e r y C a p a b i l i t y >56 < / o s l c : q u e r y C a p a b i l i t y >57 < o s l c : q u e r y C a p a b i l i t y >58 < o s l c : Q u e r y C a p a b i l i t y >59 < d c t e r m s : t i t l e >Port Query< / d c t e r m s : t i t l e >60 < o s l c : l a b e l >Port Query< / o s l c : l a b e l >61 < o s l c : q u e r y B a s e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/port" / >62 < / o s l c : Q u e r y C a p a b i l i t y >63 < / o s l c : q u e r y C a p a b i l i t y >64 < / o s l c : S e r v i c e >65 < / o s l c : s e r v i c e >66 < / o s l c : S e r v i c e P r o v i d e r >6768 < / rdf :RDF>

By GET oslc:ServiceProvider with the URI http://localhost:8080/Simulink/oslc/service_provider/control, we can obtain the following response (partial):

1 <rdf :RDF x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"2 x m l n s : d c t e r m s ="http://purl.org/dc/terms/"3 x m l n s : o s l c ="http://open-services.net/ns/core#">45 < o s l c : S e r v i c e P r o v i d e r r d f : a b o u t ="http://localhost:8080/Simulink/←↩

oslc/service_provider/control">6 < d c t e r m s : t i t l e >7 OSLC Simulink OSLC Service Provider − Control8 < / d c t e r m s : t i t l e >9 < d c t e r m s : d e s c r i p t i o n >

51

Page 64: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

10 Provide Control integration functionalities of Tool Matlab /←↩Simulink , e . g . LoadModel ,

11 StartSimulation , Export , Import , etc .12 < / d c t e r m s : d e s c r i p t i o n >13 < o s l c : s e r v i c e >14 < o s l c : S e r v i c e >15 < o s l c : d o m a i n r d f : r e s o u r c e ="http://md.kth.se/oslc/simulink←↩

/1.0/control#" / >16 < o s l c : c r e a t i o n F a c t o r y >17 < o s l c : C r e a t i o n F a c t o r y >18 < d c t e r m s : t i t l e >Location for invoking control service ←↩

LoadModel< / d c t e r m s : t i t l e >19 < o s l c : l a b e l >Control service: LoadModel< / o s l c : l a b e l >20 < o s l c : c r e a t i o n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/control/load_model" / >21 < / o s l c : C r e a t i o n F a c t o r y >22 < / o s l c : c r e a t i o n F a c t o r y >23 < o s l c : c r e a t i o n F a c t o r y >24 < o s l c : C r e a t i o n F a c t o r y >25 < d c t e r m s : t i t l e >Location for invoking control service ←↩

StartSimulation< / d c t e r m s : t i t l e >26 < o s l c : l a b e l >Control service: StartSimulation< / o s l c : l a b e l >27 < o s l c : c r e a t i o n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/control/start_simulation" / >28 < / o s l c : C r e a t i o n F a c t o r y >29 < / o s l c : c r e a t i o n F a c t o r y >30 < o s l c : c r e a t i o n F a c t o r y >31 < o s l c : C r e a t i o n F a c t o r y >32 < d c t e r m s : t i t l e >Location for invoking control service ←↩

Select< / d c t e r m s : t i t l e >33 < o s l c : l a b e l >Control service: Select< / o s l c : l a b e l >34 < o s l c : c r e a t i o n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/control/select" / >35 < / o s l c : C r e a t i o n F a c t o r y >36 < / o s l c : c r e a t i o n F a c t o r y >37 < / o s l c : S e r v i c e >38 < / o s l c : s e r v i c e >39 < / o s l c : S e r v i c e P r o v i d e r >4041 < / rdf :RDF>

Here, we follow the strong assumptions made of OSLC directory services in Sec-tion 5.2.2.1 that data and control services are encapsulated in separate oslc:ServiceProviderresources, for the control ServiceProvider, only inlined oslc:CreationFactory resourcesexisted, whereas, for the data ServiceProvider, both oslc:CreationFactory and oslc:QueryCapabilityresources existed. Therefore we check the service type by checking if the currentoslc:ServiceProvider contains any oslc:QueryCapability resources.

In our example, the oslc:ServiceProvider with the URI http://localhost:8080/Simulink/oslc/service_provider/data is a data ServiceProvider, whereas, theoslc:ServiceProvider with the URI http://localhost:8080/Simulink/oslc/service_provider/control is a control ServiceProvider.

52

Page 65: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

After the identification the correct type of ServiceProvider, for data ServiceProvidergoto Step 3 for further processing, whereas, for control ServiceProvider goto Step 6for further processing.

Step 3: Find Data Resources

Each inlined oslc:CreationFactory or oslc:QueryCapability property represents onedata resource, however for the name of this data resource we have to assume it is fromthe URI of the inner property oslc:resourceShape, oslc:resourceType, oslc:creationor oslc:queryBase. With the listed sequence, we anticipate the resource name byextracting the last word of the URI. Here, we use this simplest way to anticipate thecorrect name, which is to select from the first URI in the listed sequence if existed. Fora more sophisticated solution, possible names should be recorded, and voted duringthe next steps when building the references between them. The user should also begiven a chance to select the ideal name.

In our example, according to the response of oslc:ServiceProvider with the URIhttp://localhost:8080/Simulink/oslc/service_provider/data, we can iden-tify three inlined oslc:CreationFactory (see line 17, 26, 35) and three inlined oslc:QueryCapability(see line 44, 51, 58), from which we can find three data resources, or classes in themodel, they are Block, Connection and Port. Take the one oslc:CreationFactory withlabel Block for example, we can anticipate the name of the data resource as Block byextracting the last word of the URI http://localhost:8080/Simulink/shapes/Block of the property oslc:resourceShape.

For each data resource, we need to check if the URI of oslc:ResourceShape re-source is given in the response. If it is provided, details of this data resource canbe constructed by parsing the oslc:ResourceShape given, otherwise, we need to queryone or more specific objects in that data type to anticipate the structure of the resource.Follow Step 4 if the URI of oslc:ResourceShape is given and Step 5 otherwise.

Please note, for the simplification implementation of the demo, we assume theannotated oslc:ResourceShape resource here is given by providing an external URI,not directly inlined in the current response. Also, in the current demo, the discovery ofthe additional parameters for the data services is not available as no suitable directoryservice for parameters defined in OSLC.

Step 4: Construct Data Resource Structures: Parse ResourceShape

Properties of the current data resource are analyzed and inserted to the correspondingclass as attributes or references. More specifically for properties with the built-in datatype like string, int, etc, an attribute is added to the class, otherwise, by analyzingthe URI of the given oslc:valueShape or oslc:valueType property, with the same wayin Step 3, we anticipate the referenced data type in the same assumption and addcorresponding reference to the current class. Numerical attribute of the attribute orreference is also specified by checking oslc:occurs property given. After the construc-tion of the data resource, the model is then updated.

53

Page 66: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

In our example, take the oslc:ResourceShape of the Block resource with URI http://localhost:8080/Simulink/shapes/Block for example, we can obtain the fol-lowing response:

1 < !−− g e n e r a t e d by t h e OSLC Adap te r G e n e r a t o r f o r Ecore , C o p y r i g h t ←↩2011 M a t t h i a s Bieh l , KTH, h t t p : / /www. md . k t h . s e / ~ b i e h l / o s l c e c o r e ←↩−−>

2 <rdf :RDF3 x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"4 x m l n s : d c t e r m s ="http://purl.org/dc/terms/"5 x m l n s : f o a f ="http://xmlns.com/foaf/0.1/"6 x m l n s : o s l c ="http://open-services.net/ns/core#" >7 < o s l c : R e s o u r c e S h a p e r d f : a b o u t ="http://localhost:8080/Simulink/←↩

shapes/Block">8 < d c t e r m s : t i t l e >Block Shape< / d c t e r m s : t i t l e >9 < o s l c : d e s c r i b e s r d f : r e s o u r c e ="http://md.kth.se/oslc/simulink/1.0/←↩

data#Block" / >10 < o s l c : p r o p e r t y >11 < o s l c : P r o p e r t y >12 < o s l c : n a m e >uuid< / o s l c : n a m e >13 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://purl.org/←↩

dc/terms/content" / >14 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://www.w3.org/2001/←↩

XMLSchema#string" / >15 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩

core#Zero-or-one" / >16 < / o s l c : P r o p e r t y >17 < / o s l c : p r o p e r t y >18 < o s l c : p r o p e r t y >19 < o s l c : P r o p e r t y >20 < o s l c : n a m e >name< / o s l c : n a m e >21 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://purl.org/←↩

dc/terms/content" / >22 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://www.w3.org/2001/←↩

XMLSchema#string" / >23 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩

core#Zero-or-one" / >24 < / o s l c : P r o p e r t y >25 < / o s l c : p r o p e r t y >26 < o s l c : p r o p e r t y >27 < o s l c : P r o p e r t y >28 < o s l c : n a m e >type< / o s l c : n a m e >29 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://purl.org/←↩

dc/terms/content" / >30 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://www.w3.org/2001/←↩

XMLSchema#string" / >31 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩

core#Zero-or-one" / >32 < / o s l c : P r o p e r t y >33 < / o s l c : p r o p e r t y >34 < o s l c : p r o p e r t y >35 < o s l c : P r o p e r t y >36 < o s l c : n a m e >parent< / o s l c : n a m e >37 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://md.kth.se/←↩

oslc/simulink/1.0/data#Block" / >

54

Page 67: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

38 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩simulink/1.0/data#Block" / >

39 < o s l c : v a l u e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩Simulink/shapes/Block" / >

40 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩core#Zero-or-one" / >

41 < / o s l c : P r o p e r t y >42 < / o s l c : p r o p e r t y >43 < o s l c : p r o p e r t y >44 < o s l c : P r o p e r t y >45 < o s l c : n a m e >children< / o s l c : n a m e >46 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://md.kth.se/←↩

oslc/simulink/1.0/data#Block" / >47 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩

simulink/1.0/data#Block" / >48 < o s l c : v a l u e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/shapes/Block" / >49 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩

core#Zero-or-many" / >50 < / o s l c : P r o p e r t y >51 < / o s l c : p r o p e r t y >52 < o s l c : p r o p e r t y >53 < o s l c : P r o p e r t y >54 < o s l c : n a m e >ports< / o s l c : n a m e >55 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://md.kth.se/←↩

oslc/simulink/1.0/data#Port" / >56 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩

simulink/1.0/data#Port" / >57 < o s l c : v a l u e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/shapes/Port" / >58 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩

core#Zero-or-many" / >59 < / o s l c : P r o p e r t y >60 < / o s l c : p r o p e r t y >61 < o s l c : p r o p e r t y >62 < o s l c : P r o p e r t y >63 < o s l c : n a m e >lines< / o s l c : n a m e >64 < o s l c : p r o p e r t y D e f i n i t i o n r d f : r e s o u r c e ="http://md.kth.se/←↩

oslc/simulink/1.0/data#Connection" / >65 < o s l c : v a l u e T y p e r d f : r e s o u r c e ="http://md.kth.se/oslc/←↩

simulink/1.0/data#Connection" / >66 < o s l c : v a l u e S h a p e r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/shapes/Connection" / >67 < o s l c : o c c u r s r d f : r e s o u r c e ="http://open-services.net/ns/←↩

core#Zero-or-many" / >68 < / o s l c : P r o p e r t y >69 < / o s l c : p r o p e r t y >70 < / o s l c : R e s o u r c e S h a p e >71 < / rdf :RDF>

By analyzing the response, we can identify the attributes like uuid, name and type,and references like parent, children, ports and lines. For the references, referenceddata type names are anticipated in a similar way. For example, reference ports is ref-erenced to Port data type by extracting the last word of the URI http://localhost:8080/Simulink/shapes/Port of the property oslc:valueShape (line 53).

55

Page 68: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Also, we can obtain the numerical attributes of each attribute or reference by look-ing into the oslc:occurs attribute. According to the OSLC specification, the possibili-ties are Zero-or-one, Exactly-one, One-or-many and Zero-or-many.

Step 5: Construct Data Resource Structures: Query Object Details

If there’s no annotated oslc:ResourceShape given for a specific resource, we have todiscover the structure of this resource on our own by querying a specific object inthat data type. To begin with, we get the list of objects by following the URI ofoslc:QueryCapability. Please note, here we assume we will get a list of resourceswith URIs instead of inlined resources.

In our example, if we pretend that we don’t have a oslc:ResourceShape for theBlock resource, then we have to follow the URI http://localhost:8080/Simulink/block to get a list of Blocks:

1 <rdf :RDF2 x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"3 x m l n s : o s l c _ s i m u l i n k _ d a t a ="http://md.kth.se/oslc/simulink/1.0/data←↩

#"4 xmlns :owl ="http://www.w3.org/2002/07/owl#"5 x m l n s : x s d ="http://www.w3.org/2001/XMLSchema#"6 x m l n s : r d f s ="http://www.w3.org/2000/01/rdf-schema#">7 < r d f : D e s c r i p t i o n r d f : a b o u t ="http://localhost:8080/Simulink/block">8 < rd f s :member r d f : r e s o u r c e ="http://localhost:8080/Simulink/block/1←↩

fc429e1-a0e6-4316-b5bb-8a1f2630b87c" / >9 < rd f s :member r d f : r e s o u r c e ="http://localhost:8080/Simulink/block/3←↩

ce3ebf6-fb28-402d-99f8-c6556bb1504a" / >10 < rd f s :member r d f : r e s o u r c e ="http://localhost:8080/Simulink/block←↩

/272fd601-9b74-4726-a4e3-22a57e451873" / >11 < / r d f : D e s c r i p t i o n >12 < / rdf :RDF>

Follow any one of the URI, we can get the details of one object. By analyzing thecontent of the response, we can also get the attributes or references of the current datatype. The algorithm here is more complex, and is introduced later by an example.Also, we may need to query several different objects, to make sure we get a completedump of all the properties.

In our example, if we look into the detail response of a Block object with URIhttp://localhost:8080/Simulink/block/272fd601-9b74-4726-a4e3-22a57e451873(see line 10 above), we can see the object has attributes type, name, uuid and refer-ences ports with URIhttp://localhost:8080/Simulink/port/41a94277-3a02-4faf-a489-953c4b7fb28b(see line 9 below) and children with URIhttp://localhost:8080/Simulink/block/cae9c004-c635-429f-bde7-709b626c34f9(see line 11 below). For the correct type of the references, we need to follow the refer-enced URI, and get the resource type by analyzing the response, just like we identifyBlock as the current object type by taking the local name of the whole resource (see

56

Page 69: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

line 7 below). More queries of the current data type are needed, as we can see theresult here is not complete compared to the result we obtained in Step 4.

1 <rdf :RDF2 x m l n s : r d f ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"3 x m l n s : o s l c _ s i m u l i n k _ d a t a ="http://md.kth.se/oslc/simulink/1.0/data←↩

#"4 xmlns :owl ="http://www.w3.org/2002/07/owl#"5 x m l n s : x s d ="http://www.w3.org/2001/XMLSchema#"6 x m l n s : r d f s ="http://www.w3.org/2000/01/rdf-schema#">7 < o s l c _ s i m u l i n k _ d a t a : B l o c k r d f : a b o u t ="http://localhost:8080/Simulink←↩

/block/272fd601-9b74-4726-a4e3-22a57e451873">8 < o s l c _ s i m u l i n k _ d a t a : l i n e s r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/connection/5cedbac9-d627-4071-aa58-250e8a8dce41" / >9 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/port/41a94277-3a02-4faf-a489-953c4b7fb28b" / >10 < o s l c _ s i m u l i n k _ d a t a : p o r t s r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/port/f525b6b7 -2528-4c66-9d9f-95e44bdcff94" / >11 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/block/cae9c004-c635-429f-bde7-709b626c34f9" / >12 < o s l c _ s i m u l i n k _ d a t a : c h i l d r e n r d f : r e s o u r c e ="http://localhost:8080/←↩

Simulink/block/1cd858d5-f1ca-4943-852a-3190dd6f72a6" / >13 < o s l c _ s i m u l i n k _ d a t a : t y p e >SubSystem< / o s l c _ s i m u l i n k _ d a t a : t y p e >14 < o s l c _ s i m u l i n k _ d a t a : n a m e >F1< / o s l c _ s i m u l i n k _ d a t a : n a m e >15 < o s l c _ s i m u l i n k _ d a t a : u u i d >272fd601−9b74−4726−a4e3−22a57e451873< /←↩

o s l c _ s i m u l i n k _ d a t a : u u i d >16 < / o s l c _ s i m u l i n k _ d a t a : B l o c k >17 < / rdf :RDF>

Please note, here we assume the name of the attributes or references is directlyfrom the local name in the properties of the response, and the referenced data type isdirectly from the local name of the resource type following the resource URI.

Step 6: Find Control Resources

By analyzing the URIs of oslc:creationFactory, we can obtain a list of provided con-trol resources. For the resource name, we assume it is from the URI of oslc:creation.

In our example, from the response of oslc:ServiceProvider with the URI http://localhost:8080/Simulink/oslc/service_provider/control, we can identifythe control resources like load_model, start_simulation, select, etc (line 17, 24 31).

Please note, in the current demo, the discovery of the parameters for the controlservices is not available as no suitable directory service for parameters defined inOSLC.

57

Page 70: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

6.2.3 Saving the Discovered Model

Saving the discovered model is easy with the help of EMF. Actually, the model storedin a file is equivalent to the EPackage object created in the memory, we can fill correctinformation to the object and serialize it to a file at last.

To facilitate the discovery algorithm, the EPackage object can be created before thediscovery algorithm begins, and is used as a data structure to hold the information wediscover in the process. For the initialization steps, two EPackage objects are createdwhich represents the separate data model and thecore model as we agreed, then sub-packages called control and oslc are created and added to the core model, and finallya special Control class is added to the control sub-package.

In the discovery process, updates including adding of new classes to the datamodel, adding of new operations to the Control class and adding of attributes or ref-erences to the data classes we created are made.

After the discovery, the two objects are written to the disk through EMF persistenceAPI.

In our example, according to the model design and the result we discovered, thedata model and core model are generated as in Figure 6.3 and Figure 6.4.

Compared to the model we designed and created manually in the construction pro-cess, as we agreed in the designing of the discovered tool adapter mode, here dataclasses are not inherited from the Prototype in the ifest-common model and more oslcannotations of the data or control services are annotated to facilitate the future use.

6.2.4 Model-based Generation of Code Stubs

The generation process here is quite similar to the generation process in the construc-tion of tool adapters. The only difference is that here, the generation only involveswith a few code stubs needed to integrate and consume the provided RESTful service.

According to SCA, to consume a RESTful web service, a Java interface should beavailable as the SCA service, and this is the only code we need to generate for thediscovered tool adapter.

In our example, Java interface with the name se.kth.md.generatedtoolchain.IDiscoveredSimulinkis created, for the content of this file, please refer to the generation result of the con-struction process in Appendix A as it is exactly the same as in the construction process.

In the big picture, an annotated object called discoveredSimulink typed in this in-terface is added to the main tool chain class. And in the configuration section of thetool chain, special configurations are added to bind the RESTful web service to theannotated object typed in the interface created.

Below is the configuration part of this discovered service in<sca:component name="GeneratedToolChain"> section in the main composite file:

58

Page 71: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 6.3. Discovered data model of Matlab/Simulink Tool Adapter

59

Page 72: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Figure 6.4. Discovered core model of Matlab/Simulink Tool Adapter

60

Page 73: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

1 < r e f e r e n c e name="discoveredSimulink">2 < f r a s c a t i : b i n d i n g . r e s t u r i ="http://localhost:8080/Simulink" / >3 < / r e f e r e n c e >

6.3 Summary of Assumptions

As in the construction process of tool adapters, the OSLC-based output only definesa specific way to output the information needed in OSLC. In the conversion from anEMF-based model to an OSLC-based output, information is lost inevitably. To fulfilthe need to reconstruct the similar EMF based model for discovered services, assump-tions are made to facilitate the discovery procedure. In Table 6.1, all the assumptionsmade in the discovery steps are summarized.

61

Page 74: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Table 6.1. Assumptions made in the automated discovery algorithm of unknown tool adapter conforming to OSLC

Position Assumptions made Notes

Step 2 Each data service includes an inlined oslc:CreationFactory re-source which contains the URI for the POST method to createa new object and a oslc:QueryCapability resource which con-tains the URI for the GET of a list of objects (the two URIsare normally the same). Each control service only includes ainlined oslc:CreationFactory resource which contains the URIfor the POST method to invoke this service.

Service type can be checked by checking if there’s any inlinedoslc:QueryCapability resources.

Step 3 The name of the data resource is extracted from the lastword of the URI of the inner property oslc:resourceShape,oslc:resourceType, oslc:creation or oslc:queryBase in theoslc:CreationFactory or oslc:QueryCapability property.

The simple algorithm to extract from the first available URIof the possible sources is used in the demo. More complexalgorithm is discussed as well.

Step 3 The annotated oslc:ResourceType resource is given by provid-ing an external URI

Alternative possibilities should be considered in the actual de-velopment.

Step 4 The name of the referenced data resource type is ex-tracted from the last word of the URI of inner propertyoslc:valueShape or oslc:valueType in the corresponding sec-tion of the oslc:ResourceShape

The simple algorithm is used in the model and more complexsituations should be considered in the actual development.

Step 5 The return value of the query to GET a list of objects will be alist of resources with URIs instead of inlined resources.

Alternatives should be considered in the actual development.

Step 5 The name of the attributes or references are directly from thelocal name in the properties of the response of GET the detailsof one object, and the referenced data resource type is directlyfrom the local name of the resource type following the refer-enced resource URI.

Step 6 Name of the control resource provided is from the URI ofoslc:creation property inlined.

More complex situation should be considered in the actual de-velopment.

Step 3 /6 the discovery of the (additional) parameters for the data or con-trol services is not available as no suitable directory service forparameters defined in OSLC.

62

Page 75: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

7. Conclusion

7.1 Summary

This thesis is a continuation of research on the tool adapters in tool integration withmodel-based approach. The original Matlab/Simulink tool adapter with only datafunctionalities is extended, in this basis, a more generic model-based tool adapter de-velopment platform is designed and implemented. With modeling, a lot of program-ming details are generalized and hidden, and can be fully understood by the usersfrom different background who may not be proficient in programming. With model-ing, tool adapters from different vendors can obey the same rule and be included inthe tool chain with less configurations.

This thesis is part of the research in providing a model-based tool integration frame-work with the focus on tool adapters. The research mainly includes the constructionand discovery of the tool adapters on the basis of the practices of extending the exist-ing Matlab/Simulink tool adapter. After the implementation of the model-based tooladapter construction framework, the Matlab/Simulink tool adapter is rewritten to fol-low the same standard and as a validation of the construction framework and resourceof the model-based tool adapter discover approach.

The whole work follows EMF as the base of tool adapter modeling and the model-to-tool-adapter generation process; follows OSLC to encapsulate data and controlfunctionalities of the tools as different resources and be exposed according to theOSLC specification; follows SCA to encapsulate tool adapters in a separate composite,and be included as part of the SCA based tool chain. Guidelines of tool adapter model-ing and discovered tool adapter modeling are proposed on the practices of OSLC andEMF, and with the assumptions on the modeling guidelines, model-to-tool-adaptergeneration engine and model-based discovery algorithm are created.

The result of the work can be used in the first step of creating tool adapters fordifferent tools with the same standard, and in the last step of discovering tool adaptersfrom other vendors and including them in the whole tool chain.

7.2 Limitations

As we summarized in Section 5.4 and 6.3, the major limitation of the work is asfollowed:

1. OSLC only specifies data resources clearly in it’s specification, thus to supportthe control functionalities, we make a strong assumptions on the separation

63

Page 76: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

of the two categories of resources. Assumptions on the directory services fordiscovery are also made in the same point to facilitate the discovery process.

2. The parameters of data resources (as classes) cannot be presented well in EMF,thus cannot be included in the model-based construction framework as well asthe discovery approach. This is also the reason that manual handing of param-eters is required in the implementation of tool adapters.

3. Directory services for parameters are not specified in OSLC, thus can’t be in-cluded in the automatical discovery approach.

7.3 Future Work

The control functionalities are vital for the integration process, and should be includedas part of OSLC. With the support of control integration functionalities, and clearspecification on the handling of the different categories of services in the directoryservices, the construction framework as well as the discovery approach can be greatlyimproved. More sophisticated discovery algorithm can be implemented with moreinvestigations of the resources we get through the interaction of the provided OSLCservices.

With special agreement on parameter modeling for data resources, parameter han-dling can be fully generated in the construction framework, and a lot of human workcan be saved. With the improvement of parameter handing in OSLC’s directoryservices, the discovery process can be more automated and much less work will beneeded in including the discovered tool adapter as the whole tool chain.

Finally, the modeling of the tool adapter can be further studied to include morecomplex type of resources like embedded resources. With this basis, more work canbe done in both the construction framework and discovery approach.

64

Page 77: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

References

[1] A. Alves, A. Arkin, S. Askary, C. Barreto, B. Bloch, F. Curbera, M. Ford,Y. Goland, A. Guzar, N. Kartha, and Others, “Web services business processexecution language version 2.0,” 2007. [Online]. Available:http://docs.oasis-open.org/wsbpel/2.0/wsbpel-v2.0.pdf

[2] C. Amelunxen, A. Königs, T. Rötschke, and A. Schürr, “Moflon: Astandard-compliant metamodeling framework with graph transformations,”2006, pp. 361–375. [Online]. Available: http://dx.doi.org/10.1007/11787044_27

[3] A. Anjorin, M. Lauder, S. Patzina, and A. Schürr, “emoflon: Leveraging emfand professional case tools,” in 3. Workshop Methodische Entwicklung vonModellierungswerkzeugen (MEMWe2011), 2011.

[4] Apache CXF, “Cxf user’s guide,” Tech. Rep., 2011. [Online]. Available:http://cxf.apache.org/docs/

[5] M. Biehl, J. El-Khoury, F. Loiret, and M. Törngren, “A domain specificlanguage for generating tool integration solutions,” in 4th Workshop onModel-Driven Tool & Process Integration (MDTPI2011) at the EuropeanConference on Modelling Foundations and Applications (ECMFA 2011), Jun.2011. [Online]. Available:http://www1.md.kth.se/~biehl/files/papers/mdtpi2011.pdf

[6] A. W. Brown and M. H. Penedo, “An annotated bibliography on integration insoftware engineering environments,” ACM SIGSOFT Software EngineeringNotes, vol. 17, no. 3, pp. 47–55, 1992.

[7] D. Chappell, “Introducing SCA,” Tech. Rep., 2007. [Online]. Available:http://www.chappellassoc.com/writing/Introducing_SCA.pdf

[8] R. Chinnici, J. J. Moreau, A. Ryman, and S. Weerawarana, “Web servicesdescription language (wsdl) version 2.0 part 1: Core language,” W3CRecommendation, vol. 26, 2007.

[9] E. Christensen, F. Curbera, G. Meredith, and S. Weerawarana, “Web servicesdescription language (wsdl) 1.1,” W3C Recommendation, Mar. 2001. [Online].Available: http://www.w3.org/TR/wsdl

[10] V. Dibartolo, “Freemarker: An open alternative to jsp,” JavaWorld.com, Jan.2001.

[11] R. T. Fielding, “Architectural styles and the design of network-based softwarearchitectures,” Ph.D. dissertation, University of California, Irvine, Irvine -Irvine, CA 92697, USA, 2000. [Online]. Available:http://portal.acm.org/citation.cfm?id=932295

[12] R. Frost, “Jazz and the eclipse way of collaboration,” IEEE software, pp.114–117, 2007.

[13] M. Gudgin, M. Hadley, N. Mendelsohn, J. J. Moreau, H. F. Nielsen,A. Karmarkar, and Y. Lafon, “Soap version 1.2,” W3C recommendation, vol. 24,2003.

65

Page 78: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

[14] M. J. Hadley, “Web application description language (wadl),” 2006.[15] ——, “Web application description language (wadl),” Mountain View, CA,

USA, Tech. Rep., 2006. [Online]. Available:http://portal.acm.org/citation.cfm?id=1698142

[16] C. Hein, T. Ritter, and M. Wagner, “Model-driven tool integration withmodelbus,” in Workshop Future Trends of Model-Driven Development, 2009,pp. 50–52.

[17] G. Klyne and J. J. Carroll, “Resource description framework (rdf): Conceptsand abstract syntax,” Tech. Rep., Feb. 2004. [Online]. Available:http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/

[18] V. Massol and T. O’Brien, Maven: a developer’s notebook. O’Reilly Media,Inc., 2005.

[19] B. McBride, D. Boothby, and C. Dollin, “An introduction to rdf and the jena rdfapi,” Retrieved August, vol. 1, p. 2007, 2004.

[20] Obeo, “Acceleo user guide,” Tech. Rep., Oct. 2011. [Online]. Available:http://www.obeonetwork.com/page/acceleo-user-guide

[21] Object Management Group (OMG), “Catalog of omg modeling and metadataspecifications,” Tech. Rep., Nov. 2008. [Online]. Available:http://www.omg.org/technology/documents/modeling_spec_catalog.htm

[22] ——, “Mof model to text transformation language (mofm2t) 1.0,” Tech. Rep.,Jan. 2008. [Online]. Available: http://www.omg.org/spec/MOFM2T/1.0/

[23] ——, “Omg mof 2 xmi mapping specification,” Tech. Rep., Aug. 2011.[Online]. Available: http://www.omg.org/spec/XMI/2.4.1/

[24] O. M. G. OMG, “Common object request broker architecture (corba), 3.2,”Tech. Rep., Nov. 2011. [Online]. Available:http://www.omg.org/spec/CORBA/3.2/

[25] Open Service Oriented Architecture (OSOA), “Service component architecturespecifications,” Open SOA, Tech. Rep., Nov. 2007. [Online]. Available: http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications

[26] Oracle, “Jersey 1.11 user guide,” Tech. Rep., 2011. [Online]. Available:http://jersey.java.net/nonav/documentation/latest/index.html

[27] C. Pautasso, “Bpel for rest,” 2008, pp. 278–293. [Online]. Available:http://dx.doi.org/10.1007/978-3-540-85758-7_21

[28] S. Pericas-Geertsen and M. Potocia, “Jax-rs: Java api for restful web services,”Tech. Rep., 2011.

[29] J. D. Poole, “Model-driven architecture: Vision, standards and emergingtechnologies,” in Workshop on Metamodeling and Adaptive Object Models,ECOOP, 2001.

[30] L. Seinturier, P. Merle, D. Fournier, N. Dolet, V. Schiavoni, and J. B. Stefani,“Reconfigurable sca applications with the frascati platform,” in ServicesComputing, 2009. SCC’09. IEEE International Conference on. IEEE, 2009,pp. 268–275.

[31] L. Seinturier, P. Merle, R. Rouvoy, D. Romero, V. Schiavoni, and J. B. Stefani,“A component-based middleware platform for reconfigurable service-orientedarchitectures,” Software: Practice and Experience, 2011.

[32] D. Steinberg, F. Budinsky, M. Paternostro, and E. Merks, EMF: EclipseModeling Framework, 2nd ed. Addison-Wesley Professional, Jan. 2008.

66

Page 79: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

[Online]. Available: http://www.worldcat.org/isbn/0321331885[33] Sun, “Java metadata interface (jmi),” Tech. Rep., Jun. 2002. [Online]. Available:

http://java.sun.com/products/jmi/[34] The OSLC Core Specification Workgroup, “Open services for lifecycle

collaboration core specification version 2.0,” Tech. Rep., Jun. 2011. [Online].Available: http://open-services.net/bin/view/Main/OslcCoreSpecification

[35] I. Thomas and B. A. Nejmeh, “Definitions of tool integration for environments,”Software, IEEE, vol. 9, no. 2, pp. 29–35, Mar. 1992. [Online]. Available:http://dx.doi.org/10.1109/52.120599

[36] A. Wasserman, “Tool integration in software engineering environments,” inSoftware Engineering Environments. Springer, 1990, pp. 137–149.

[37] I. Weisemöller, F. Klar, and A. Schürr, “16 development of tool extensions withmoflon,” Model-Based Engineering of Embedded Real-Time Systems, pp.337–343, 2011.

[38] M. N. Wicks, “Tool integration within software engineering environments: Anannotated bibliography,” Heriot-Watt University, Tech. Rep, 2006.

[39] M. N. Wicks and R. G. Dewar, “A new research agenda for tool integration,”Journal of Systems and Software, vol. 80, no. 9, pp. 1569–1585, 2007.

67

Page 80: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

Appendix A.Generated Code Stubs for Matlab/SimulinkAdapter Based on the Tool AdapterConstruction Platform

External Component/ISimulinkToolAdapter.java

1 package se . kth . md . generatedtoolchain ;23 / * I m p o r t s a r e ommited * /45 @Service6 public interface ISimulinkToolAdapter extends IToolAdapter{78 @Path ( "/block" )9 @GET

10 public Response GETBlockList ( @Context MessageContext mc ) ;1112 @Path ( "/block/{til_uuid}" )13 @GET14 public Response GETBlock ( @Context MessageContext mc ) ;1516 @Path ( "/block" )17 @POST18 public Response POSTBlock ( @Context MessageContext mc ) ;1920 @Path ( "/block/{til_uuid}" )21 @PUT22 public Response PUTBlock ( @Context MessageContext mc ) ;2324 @Path ( "/block/{til_uuid}" )25 @DELETE26 public Response DELETEBlock ( @Context MessageContext mc ) ;2728 / * D e c l a r a t i o n o f o t h e r d a t a s e r v i c e s a r e o m i t t e d h e r e * /2930 @Path ( "/control/load_model" )31 @POST32 public Response LoadModel ( @Context MessageContext mc ) ;3334 / * D e c l a r a t i o n o f o t h e r c o n t r o l s e r v i c e s a r e o m i t t e d h e r e * /3536 @Path ( "/oslc/service_provider_catalog" )37 @GET38 @Produces ( { "application/rdf+xml" , "application/xml" } )

68

Page 81: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

39 public String GETServiceProviderCatalog ( @Context MessageContext ←↩mc ) ;

4041 @Path ( "/oslc/service_provider/{serive_provider_type}" )42 @GET43 @Produces ( { "application/rdf+xml" , "application/xml" } )44 public String GETServiceProvider ( @Context MessageContext mc ) ;454647 @Path ( "/shapes/Block" )48 @GET49 @Produces ( { "application/rdf+xml" , "application/xml" } )50 public String GETBlockShape ( @Context MessageContext mc ) ;5152 / * D e c l a r a t i o n o f o t h e r ResouceShape s e r v i c e s a r e o m i t t e d h e r e * /5354 / * A d m i s t r a t a t i v e methods a r e o m i t t e d h e r e * /55 }

External Component/SimulinkToolAdapter.java

1 package se . kth . md . generatedtoolchain ;23 / * I m p o r t s a r e ommited * /45 @Scope ( "COMPOSITE" )6 public class SimulinkToolAdapter extends ToolAdapter implements ←↩

ISimulinkToolAdapter{78 / * A d m i s t r a t a t i v e methods a r e o m i t t e d h e r e * /9

10 @Reference11 private ISimulinkHelper helper = null ;1213 private ResponseBuilder getResponseBuilder ( ) {14 return helper . getResponseBuilder ( ) ;15 }1617 / * I m p l e m e n t a t i o n d e t a i l s o f t h e OSLC s e r v i c e s a r e o m i t t e d h e r e ←↩

* /1819 @Override20 public Response GETBlockList ( MessageContext mc ) {21 return processTemplate ( new RequestHolder ( mc , false ) , "←↩

doGETBlockList" ) ;22 }2324 @Override25 public Response GETBlock ( MessageContext mc ) {26 return processTemplate ( new RequestHolder ( mc , false ) , "←↩

doGETBlock" ) ;27 }28

69

Page 82: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

29 @Override30 public Response POSTBlock ( MessageContext mc ) {31 return processTemplate ( new RequestHolder ( mc , true ) , "←↩

doPOSTBlock" ) ;32 }3334 @Override35 public Response PUTBlock ( MessageContext mc ) {36 return processTemplate ( new RequestHolder ( mc , true ) , "←↩

doPUTBlock" ) ;37 }3839 @Override40 public Response DELETEBlock ( MessageContext mc ) {41 return processTemplate ( new RequestHolder ( mc , false ) , "←↩

doDELETEBlock" ) ;42 }4344 / * I m p l e m e n t a t i o n o f o t h e r d a t a s e r v i c e s a r e o m i t t e d h e r e * /4546 @Override47 public Response LoadModel ( MessageContext mc ) {48 return processTemplate ( new RequestHolder ( mc , true ) , "←↩

doLoadModel" ) ;49 }5051 / * I m p l e m e n t a t i o n o f o t h e r c o n t r o l s e r v i c e s a r e o m i t t e d h e r e * /5253 / * I m p l e m e n t a t i o n d e t a i l s o f t h e OSLC s e r v i c e s a r e o m i t t e d h e r e ←↩

* /5455 @Override56 public String GETServiceProviderCatalog ( MessageContext mc ) {57 Map<String , Object> bean = constructServiceProviderCatalog ( ) ;58 return executeTemplate ( new RequestHolder ( mc , false ) , null , "←↩

spc.ftl" ,59 bean ) ;60 }6162 @Override63 public String GETServiceProvider ( MessageContext mc ) {64 RequestHolder rh = new RequestHolder ( mc , false ) ;65 String type = rh . getFirst ( "serive_provider_type" ) ;6667 ParamHelper . testRequiredParam ( "service_provider_type" , type ) ;68 Map<String , Object> bean = constructServiceProvider ( type ) ;69 return executeTemplate ( rh , type , "sp.ftl" , bean ) ;70 }7172 @Override73 public String GETBlockShape ( MessageContext mc ) {74 return executeTemplate ( new RequestHolder ( mc , false ) , "data" ,75 "shapes/Simulink/block.ftl" , null ) ;76 }77

70

Page 83: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

78 / * I m p l e m e n t a t i o n o f o t h e r ResouceShape s e r v i c e s a r e o m i t t e d h e r e←↩* /

7980 }

Internal Component/ISimulinkHelper.java

1 package se . kth . md . generatedtoolchain . user ;23 / * I m p o r t s a r e ommited * /45 / / S t a r t o f u s e r code I S i m u l i n k H e l p e r i m p o r t s6 / / End of u s e r code78 @Service9 public interface ISimulinkHelper {

10 public static final String SERVICE_NAME = "Simulink" ;1112 public ResponseBuilder getResponseBuilder ( ) ;1314 public String getNS ( RequestHolder rh , String type ) ;1516 / / S t a r t o f u s e r code I S i m u l i n k H e l p e r u s e r methods d e c l a r a t i o n s17 / / End of u s e r code1819 public IEvent doGETBlockList ( RequestHolder rh ) ;2021 public IEvent doGETBlock ( RequestHolder rh ) ;2223 public IEvent doPOSTBlock ( RequestHolder rh ) ;2425 public IEvent doPUTBlock ( RequestHolder rh ) ;2627 public IEvent doDELETEBlock ( RequestHolder rh ) ;2829 / * D e c l a r a t i o n o f o t h e r d a t a s e r v i c e s a r e o m i t t e d h e r e * /3031 public IEvent doLoadModel ( RequestHolder rh ) ;3233 / * D e c l a r a t i o n o f o t h e r c o n t r o l s e r v i c e s a r e o m i t t e d h e r e * /34 }

Internal Component/SimulinkHelper.java

1 package se . kth . md . generatedtoolchain . user ;23 / * I m p o r t s a r e ommited * /45 / / S t a r t o f u s e r code S i m u l i n k H e l p e r i m p o r t s6 / / End of u s e r code

71

Page 84: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

78 @Scope ( "COMPOSITE" )9 public class SimulinkHelper implements

10 / / S t a r t o f u s e r code S i m u l i n k H e l p e r implement o t h e r i n t e r f a c e s11 / / End of u s e r code12 ISimulinkHelper {13 @Reference14 private IIdManager idManager = null ;1516 @Reference17 private IConverterService converterService = null ;1819 @Init20 public void initComponent ( ) {21 / / S t a r t o f u s e r code S i m u l i n k H e l p e r i n i t C o m p o n e n t22 / / TODO R e g i s t e r idManager wi th I I n i t I d S e r v i c e23 / / idManager . i n i t (SERVICE_NAME, t h i s ) ;2425 / / TODO R e g i s t e r XMI p a r s e r i f needed26 / / Resource . F a c t o r y . R e g i s t r y . INSTANCE . g e t E x t e n s i o n T o F a c t o r y M a p ( )←↩

. p u t (27 / / Resource . F a c t o r y . R e g i s t r y . DEFAULT_EXTENSION ,28 / / new XMIResourceFac toryImpl ( ) ) ;2930 / / TODO R e g i s t e r u s e r meta model31 / / R e s o u r c e S e t r e s o u r c e S e t = new R e s o u r c e S e t I m p l ( ) ;3233 / / r e s o u r c e S e t . g e t P a c k a g e R e g i s t r y ( ) . p u t ( I fes t_commonPackage .←↩

eNS_URI ,34 / / I fes t_commonPackage . eINSTANCE ) ;35 / / r e s o u r c e S e t . g e t P a c k a g e R e g i s t r y ( ) . p u t (←↩

O s l c _ s i m u l i n k _ d a t a P a c k a g e . eNS_URI ,36 / / O s l c _ s i m u l i n k _ d a t a P a c k a g e . eINSTANCE ) ;37 / / End of u s e r code38 }3940 / / S t a r t o f u s e r code S i m u l i n k H e l p e r u s e r methods4142 / / End of u s e r code4344 @Override45 public String getNS ( RequestHolder rh , String type ) {46 / / S t a r t o f u s e r code S i m u l i n k H e l p e r getNS47 / / TODO Implement getNS48 / / i f ( t y p e . e q u a l s I g n o r e C a s e ( " c o n t r o l " ) )49 / / r e t u r n C o n t r o l P a c k a g e . eNS_URI ;50 / / e l s e51 / / r e t u r n O s l c _ s i m u l i n k _ d a t a P a c k a g e . eNS_URI ;52 return "#NS#" ;53 / / End of u s e r code54 }5556 private IEventCustomResponse processRequest ( String ←↩

handlerClassName ,57 IHandlerData handlerData ) {

72

Page 85: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

58 IQuery query = QueryFactory . INSTANCE . createQuery (←↩handlerClassName ,

59 handlerData ) ;60 IEvent event = EventFactory . INSTANCE . createOslcEvent ( this , ←↩

query ) ;6162 / / S t a r t o f u s e r code S i m u l i n k H e l p e r p r o c e s s R e q u e s t63 / / TODO p r o c e s s ( e v e n t ) and s e t t h e c o r r e s p o n d i n g p a r t o f t h e ←↩

e v e n t64 return new OslcEventCustomResponse ( event ) ;65 / / End of u s e r code66 }6768 private IHandlerData prepare ( RequestHolder rh ) {69 IHandlerData handlerData = new HandlerData ( ) ;7071 / / S t a r t o f u s e r code S i m u l i n k H e l p e r p r e p a r e R e q u e s t H o l d e r72 / / TODO i d e n t i f y t h e s e r v i c e param key f o r t h e c u r r e n t t o o l , a ←↩

d e f a u l t s e r v i c e param c o u l d be s e t73 rh . setServiceParam ( "model_name" , "york" ) ;74 ParamHelper . addParam ( handlerData , "model_name" , rh .←↩

getServiceParam ( ) ) ;7576 / / Comment t h e f o l l o w i n g l i n e t o d i s a b l e t h e m u l t i s u b t r e e−←↩

l e v e l s a c c e s s77 ParamHelper . addParam ( handlerData , "subtree_levels" ,78 Integer . valueOf ( rh . getSubtreeLevels ( ) ) . toString ( ) ) ;79 / / End of u s e r code8081 return handlerData ;82 }8384 / * I m p l e m e n t a t i o n d e t a i l s o f t h e framework a r e o m i t t e d h e r e . * /858687 @Override88 public IEventCustomResponse doGETBlockList ( RequestHolder rh ) {89 IHandlerData handlerData = prepare ( rh ) ;9091 / / S t a r t o f u s e r code S i m u l i n k H e l p e r GETBlockList Impl92 / / Add custom params , v a l i d a t e t h e params9394 / / Do i n t h i s way t o add t h e param95 / / ParamHelper . addParam ( h a n d l e r D a t a , "PARAM_KEY" , rh ) ;9697 / / Do i n t h i s way t o add t h e r e s o l v e d i d98 / / ParamHelper . addParam ( h a n d l e r D a t a , "PARAM_KEY" , r e s o l v e ( rh , "←↩

PARAM_KEY" ) ) ;99

100 / / Do i n t h i s way t o v a l i d a t e t h e param101 / / ParamHelper . t e s t R e q u i r e d P a r a m ( "PARAM_KEY" , rh ) ;102103 return processRequest ( "model.get.Blocks" , handlerData ) ;104 / / End of u s e r code105

73

Page 86: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

106 / * I m p l e m e n t a t i o n o f t h e o t h e r h e l p e r methods a r e o m i t t e d h e r e . ←↩* /

107 }108109110111 }

SCA configuration file/Simulink.composite

1 <?xml version="1.0" e n c o d i n g ="UTF-8" standalone="no"?>2 < s c a : c o m p o s i t e x m l n s : s c a ="http://www.osoa.org/xmlns/sca/1.0"3 x m l n s : f r a s c a t i ="http://frascati.ow2.org/xmlns/sca/1.1"4 x m l n s : i d _ m a n a g e r ="se/kth/md/id_manager" x m l n s : c o n v e r t e r ="se/kth/←↩

md/converter"5 name="se.kth.md.generatedtoolchain.Simulink">6 < s c a : c o m p o n e n t name="IdManager">7 < s c a : i m p l e m e n t a t i o n . c o m p o s i t e name="id_manager:IdManager.←↩

composite" / >8 < s c a : s e r v i c e name="IdManager">9 < s c a : i n t e r f a c e . j a v a i n t e r f a c e ="se.kth.md.id_manager.←↩

IIdManager" / >10 < / s c a : s e r v i c e >11 < / s c a : c o m p o n e n t >12 < s c a : c o m p o n e n t name="converter">13 < s c a : i m p l e m e n t a t i o n . c o m p o s i t e name="converter:Converter.←↩

composite" / >14 < s c a : s e r v i c e name="RDFConverterService">15 < s c a : i n t e r f a c e . j a v a i n t e r f a c e ="se.kth.md.converter.←↩

IConverterService" / >16 < / s c a : s e r v i c e >17 < s c a : s e r v i c e name="XMIConverterService">18 < s c a : i n t e r f a c e . j a v a i n t e r f a c e ="se.kth.md.converter.←↩

IConverterService" / >19 < / s c a : s e r v i c e >20 < s c a : s e r v i c e name="AutoConverterService">21 < s c a : i n t e r f a c e . j a v a i n t e r f a c e ="se.kth.md.converter.←↩

IConverterService" / >22 < / s c a : s e r v i c e >23 < / s c a : c o m p o n e n t >24 < s c a : c o m p o n e n t name="Simulink">25 < s c a : i m p l e m e n t a t i o n . j a v a26 c l a s s ="se.kth.md.generatedtoolchain.SimulinkToolAdapter" ←↩

/ >27 < s c a : s e r v i c e name="ISimulinkToolAdapter">28 < f r a s c a t i : b i n d i n g . r e s t u r i ="http://localhost:8080/←↩

Simulink" / >29 < / s c a : s e r v i c e >30 < / s c a : c o m p o n e n t >31 < s c a : c o m p o n e n t name="SimulinkHelper">32 < s c a : i m p l e m e n t a t i o n . j a v a33 c l a s s ="se.kth.md.generatedtoolchain.user.SimulinkHelper" ←↩

/ >

74

Page 87: Tool Integration: Model-based Tool Adapter …uu.diva-portal.org/smash/get/diva2:506590/FULLTEXT01.pdfoperations are done by calling APIs of the tools as a black box. With this simple

34 < / s c a : c o m p o n e n t >35 < s c a : s e r v i c e name="SimulinkService" promote ="Simulink/←↩

ISimulinkToolAdapter">36 < s c a : i n t e r f a c e . j a v a i n t e r f a c e ="se.kth.md.generatedtoolchain.←↩

ISimulinkToolAdapter" / >37 < / s c a : s e r v i c e >38 < s c a : w i r e s o u r c e ="SimulinkHelper/idManager" t a r g e t ="IdManager/←↩

IdManager" / >39 < s c a : w i r e s o u r c e ="SimulinkHelper/converterService" t a r g e t ="←↩

converter/AutoConverterService" / >40 < s c a : w i r e s o u r c e ="Simulink/helper" t a r g e t ="SimulinkHelper/←↩

ISimulinkHelper" / >41 < / s c a : c o m p o s i t e >

75