genOSLC Plugin

genOSLC Plugin Overview

Functionality Overview

A genOSLC plugin is an Angular application that uses the REST API provided with the genOSLC Java Framework to display and maintain a list of OSLC links between the currently selected Authoring Tool item. The plugin is integrated into the native UI of the Authoring Tool, which communicates with the genOSLC plugin notifying it of the selection of artifacts in the Authoring Tool.

API Description

Communication between the Authoring Tool and the genOSLC plugin is done via https://www.npmjs.com/package/genoslc-comms . This library provides the API needed to perform the common actions of selecting an item, displaying the preview of an artifact, displaying the global configuration selector or the artifact picker. The API is a wrapper around various postMessage calls required for the communication between the involved frames.

Create a GenOslcComms object after installing the npm package.

/** * * @param id - HTML DOM Element id of the iframe running the genOSLC plugin * @param showPreview - Function to be called when genOSLC wants to display a DUI preview of an external artifact * @param showPicker - Function to be called when genOSLC wants to display an artifact picker from an external application * @param showGCPicker - Function to be called when genOSLC wants to display the Global Configuration picker */ const genOslcComms = new GenOslcComms({ 'genoslc-iframe', (uri) => { // uri represent the URI of the artifact preview // the developer is responsible to display an iframe with uri as the source }, (uri) => { // uri represent the URI of the picker // the developer is responsible to display an iframe with uri as the source } (uri) => { // uri represent the URI of the Global Configuration picker // the developer is responsible to display an iframe with uri as the source } });

Afterwards select an artifact using the selectArtifact method:

genOslcComms.selectArtifact(artifactId, componentId, artifactLabel, domain);

Â