Skip to content

Developers Guide

dotasek edited this page May 3, 2021 · 3 revisions

Building CyREST

CyREST can be built with Maven:

mvn clean install

Code coverage for tests is reported here:

/target/site/jacoco/index.html

Architecture Overview

OSGi JAX-RS Connector

CyREST makes use of the OSGi JAX-RS Connector project. This connector allows other Cytoscape Apps to add endpoints to the CyREST API by providing OSGi Services annotated with JAX-RS annotations.

The OSGi JAX-RS Connector ships as an OSGi bundle, and thus cannot be imported in the same manner as a Maven dependency. It must be installed and started from the CyActivator bundle when Cytoscape is already running. In addition, in order to run, the Connector requires specific bundles to be available in the OSGi context. Some of these bundles are already packaged, but not installed and started, within Karaf, the runtime on which Cytoscape is run. Others must be installed and started, in the same manner as the Connector itself. The order in which these bundles are installed is important, as there are dependencies that must be satisfied for each bundle to successfully install and start.

The management of the dependencies is done using this class: /src/main/java/org/cytoscape/rest/internal/task/OSGiJAXRSManager.java

Delayed Start

CyREST waits until all apps are completely started before registering all its services. This happens so that its internal app endpoints and Swagger docs are complete before end users can access them.

Event Flushing

Cytoscape manages its own events independently of CyREST. When the Cytoscape API makes changes to the network, particularly visualization related ones like style changes, events are created, but not guaranteed to be resolved. Therefore, directly accessing the Cytoscape API is accompanied in CyREST by calls to CyEventHelper's flushPayloadEvents method, using CyREST's EventFlushRequestFilter and EventFlushResponseFilter Filter implementations.