Giter Club home page Giter Club logo

osgi-scr-graph's Introduction

logo

This repository comprises the API and optional Apache Felix Gogo Command to generate a DOT graph of the Service Component Runtime (SCR).


amitjoy - osgi-scr-graph stars - osgi-scr-graph forks - osgi-scr-graph License - Apache Build - Passing GitHub release

Minimum Requirements

  1. Java 8
  2. OSGi R7

Modules

This project comprises the following list of bundles -

  1. in.bytehue.osgi.scr.graph - The Service Component Runtime(SCR) Graph API and Implementation
  2. in.bytehue.osgi.scr.graph.example - Example project for usages

Installation

To use it in the OSGi environment, you only need to install in.bytehue.osgi.scr.graph.


Project Import

Import as Eclipse Projects

  1. Install Bndtools
  2. Import all the projects (File -> Import -> General -> Existing Projects into Workspace)

Building from Source

Run ./gradlew clean build in the project root directory


Developer

Amit Kumar Mondal ([email protected])


Contribution contributions welcome

Want to contribute? Great! Check out Contribution Guide


License

This project is licensed under Apache License Version 2.0 License


Usage


Apache Felix Gogo Command


Note that, the command will only work if and only if Felix Gogo bundles are installed in the OSGi runtime.

Graph Generation

help-graph

gogo

Cycle Detection

help-cycle

cycle_gogo

plain-cycle

Screenshot 2021-02-02 at 12 01 20


DOT Graph

Copy the DOT graph representation format to a file having an extension of .dot and execute the following to convert them to PNG/SVG

  • dot -Tpng filename.dot -o filename.png
  • dot -Tsvg filename.dot -o filename.svg

To install dot in your computer, please follow this link


SCR Runtime

graph

Cycle Detection

cycle


API Usage Examples


Graph Generation:
@Component
public final class GraphGenrator {

    @Reference
    private ScrGraph scrGraph;

    public String graph() {
        final Graph<ScrComponent, DefaultEdge> graph = scrGraph.getGraph();

        final Writer writer = new StringWriter();
        scrGraph.exportGraph(graph, writer);

        return writer.toString();
    }
}

Cycle Detection:
@Component
public final class GraphCycleFinder {

    @Reference
    private ScrGraph scrGraph;

    public String cycle() {
        final List<List<ScrComponent>> cycles = scrGraph.getCycles();
        if (cycles.isEmpty()) {
            return "No SCR cycle exists";
        }
        final Graph<ScrComponent, DefaultEdge> cyclesAsGraph = scrGraph.getCyclesAsGraph();
        final Writer writer = new StringWriter();
        scrGraph.exportGraph(cyclesAsGraph, writer);

        return writer.toString();
    }

}

osgi-scr-graph's People

Contributors

amitjoy avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.