Giter VIP home page Giter VIP logo

capella_oslc_connector's Introduction

Capella OSLC Adapter

This repository consists of the following parts:

  • Capella (Eclipse) plugin providing an interface for retrieving EMF data from Capella (CapellaEmfApi)
  • Capella (Eclipse) plugin that exposes the data retrieved by the previous plugin using embedded jetty server (CapellaSever)
  • Maven project which is an OSLC Adapter generated using Eclipse Lyo based on the SysML v2 OSLC server and domain https://github.com/oslc-op/sysml-oslc-server
  • Set of sample HTTP requests for testing and demonstration purposes

The overall functionality of the adapter is that the plugins can be used to run a server that provides a simple API in Capella. The plugins are seperated into a plugin called CapellaEmfApi that retrieves the data from Capella (using AQL) and CapellaServer that exposes the retrieved data using embedded jetty server. The OSLC server Generated by Eclipse Lyo then fetches the resources from the CapellaServer and exposes them itself with all of the added OSLC functionality. The adapter is read-only.

The elements are provided using the domain of the referenced SysML v2 OSLC server project. The mapping from Capella model is however totally experimental and most Capella resources are represented as Element with only some of the properties mapped. Some of the Capella resources are mapped to SysML elements Package, Class, Connector, Relationship, Generalization and Port usage, but the mapping is present only to suggest the mapping mechanism inside of adapter and can't be itself seen as a proper implementation.

Running the OSLC adapter

Running the plugins

Both Capella plugins can be run by placing the content of ExportedPlugins/ into dropins/ folder of the Capella installation.

Apart from the two plugins, the folder ExportedPlugins/ also contains the additional dependencies required by the plugins, in particular javax.servelt-api and gson.

Once the plugins are installed the Embedded Server button for starting/stopping the server should appear in the upper bar.

The default port for the server to run at is 3333. If this is changed, the OSLC Adapter maven project needs to be modified accordingly in the UrlHelper.java as it counts on the CapellaServer api to be accessible at http://localhost:3333.

Supported Capella versions The plugins were tested for Capella releases 1.4.2, 5.0 and 5.1

Running the maven project

Run the maven project in OSLCAdapter/ folder: mvn jetty:run-exploded

In default setting, the homepage is available at http://localhost:1331/sysml_oslc_server/

Oslc.where

Simple oslc.where query is enabled on all implemented query capabilities. Queries containing compound terms are not supported.
Adapter supports the following properties:

Sample query can look as follows, see Sample requests for more. ** Simple string eq query** (on QueryCapability for Class):
?oslc.where=sysml:name="Station information system"
full url encoded query:
http://localhost:1331/sysml_oslc_server/services/projects/TGV2ZWwgQ3Jvc3NpbmcgVHJhZmZpYyBDb250cm9s/service3/sysmlClasss/query?oslc.where=sysml:name=%22Station%20information%20system%22\

Selection dialogs

Adapter implements very simple selections dialog. Elements description, name and identifier are searched and returned if any of them contains the provided search text.

Sample requests

The TestRequests/ folder contains files with .http suffix, that can be run using the REST Client extension for VS Code https://marketplace.visualstudio.com/items?itemName=humao.rest-client but it should be easy to extract the URLs to be run elsewhere if needed.

All of the files contain requests that are to be run against the Capella sample project Level Crossing Traffic Control that can be found at https://download.eclipse.org/capella/samples/5.1.0/ (or navigate on the page to the correct Capella version) as LevelCrossingTrafficControl.zip.

The folder contains:

  • OslcServer.http file for testing the functionality of the whole adapter (both plugins and the maven project) together
  • DemonstrationSequence.http that shows how the client can reveal the content of a PUBLI [LAB] Components and exchanges in the logical architecture diagram in Capella
  • CapellaServer.http to send requests separately to the CapellaServer plugin and test its API
  • CapellaServerGenericEndpoint.http that tests additional functionality of the CapellaServer -> see Capella generic endpoints

Plugin development

The easiest way to set up the development environment is to open the plugin projects directly in Capella. (The maven project can be opened as desired)

The dependencies for javax.servelt-api and gson are still needed and can be also resolved by having these 2 archives placed in the dropins/ folder of the Capella installation in which the plugins are developed.

Capella generic endpoints

The CapellaSever Contains 2 endpoints that are unused in the whole resulting OSLC adapter. These are generic endpoints for retrieving the Capella resources without mapping them to the SysML domain. This is added, as the resources can be mapped generically using the EMF reflective API and could be potentially useful for different clients.

CapellaServer API endpoints

CapellaServer endpoints are briefly described here. The baseurl is the chosen URL where the server runs like http://localhost:3333. Use of each of the endpoints can be seen in the sample requests.

Endpoint for retrieving the projects that does not expect any parameters:
baseurl/projects

Each of the query capability in the OSLC server has its own endpoint for querying the collections that all behave the same: baseurl/element
baseurl/sysmlclass
baseurl/relationship
baseurl/generalization
baseurl/portusage
baseurl/sysmlpackage
baseurl/connector
required parameters: projectName which identifies the project that is queried and linkBaseUrl which is the baseUrl of the OSLC server for querying a single resource (specific resource whose identifier is resid can be found at linkBaseUrl/resid) which is needed for constructing the OSLC resources on the side of CapellaServer. This dependency may be handled otherwise in the future.
optional parameters: limit and page to provide paging capability fullTextSearch that is used for simple selection dialogs implementation and aqlExpr that is used to filter the capella elements based on additional conditions (oslc.where expressions are transformed to these) for information about AQL, see https://www.eclipse.org/acceleo/documentation/

if both aqlExpr and fullTextSearch are provided, only fullTextSearch is performed.

Endpoint for retrieving a single element by id:
baseurl/resources
required parameters: projectName, linkBaseUrl as described above and elementId which identifies the specific element.

Capella generic endpoints

The additional generic endpoints for retrieving the unmapped elements work in a similar way:

Endpoint for retrieving a single element by id:
baseurl/api/resource
required parameters: projectName and elementId as described above.
optional parameters: includeTypes - if provided with value true, the element is returned together with infomration about its type and all supertypes.

Endpoint for retrieving elements collection:
baseurl/api/resourcecollection
required parameters: projectName, as described above
optional parameters: page, limit, fulltextsearch as described above and aqlQuery which is a custom AQL query to be executed for retrieving project elements.

capella_oslc_connector's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.