Skip to content

amitjoy/dependency-graph-osgi

Repository files navigation

logo

Why? start with what and why

This is an easy to use tool to visualize OSGi Dependencies in a graph. In addition, this tool also supports detection of cyclic dependencies in the plotted graph. The primary goal is to minimize the effort in analyzing big software projects based on OSGi.


Requirements

Java 8+

Contribution contributions welcome

Want to contribute? Great! Check out Contribution Guide


Project Import

Import as Maven Project

Import the project as an Existing Maven Project (File -> Import -> Maven -> Existing Maven Projects)


Building from Source

  1. Run mvn clean package in com.amitinside.dependency.graph.osgi
  2. This will build the project
  3. The target directory will contain dependency.graph.osgi-0.0.1-SNAPSHOT-jar-with-dependencies.jar

License

This project is licensed under EPL-2.0 License


Usage

To use this application, you need an OBR (OSGi Bundle Repository) Index XML File.

OBR Index Generation

  1. You need to download the bnd command line utility from https://search.maven.org/artifact/biz.aQute.bnd/biz.aQute.bnd
  2. Using terminal, switch to your workspace directory and execute - java -jar biz.aQute.bnd.jar index */target/*.jar
  3. This assumes that all the target artifacts are kept in target directory in the respective projects
  4. Alternatively, you can copy all your project JARs inside a separate directory
  5. Switch to this newly created directory in command line and execute java -jar biz.aQute.bnd.jar index *.jar
  6. Both the aforementioned commands will generate OBR index.xml in the respective directories where the command is executed

Create Bundles List

  1. You need to have a file comprising the bundle symbolic names of the bundles whose dependencies will be plotted on the graph
  2. You can create a bundles.txt (or give it a name of your choice) with bundle symbolic names in separate lines. You can also use wildcards. For example, com.google.* will consider all the bundles whose symbolic names start with com.google. Apart from it, you can also use negations. For example, !org.apache* would remove all the bundles from the Graph whose symbolic names start with org.apache.

Help Command:

usage: Dependency Graph in OSGi - Help
 -?                 Show Help
 -bundles <arg>     Bundle List File Location
 -cycle             Check for Cycle Existence
 -debug             Turn on Debug Mode
 -edge              Show Edge Labels
 -help              Show Help
 -ns <arg>          Namespace Type to Plot [ALL, PACKAGE, SERVICE,
                    IDENTITY, EE, NATIVE, CONTENT, IMPLEMENTATION,
                    CONTRACT, BUNDLE, HOST, CUSTOM] (Default ALL)
 -ns_custom <arg>   Custom Namespace (Needs to be set if ns option is set
                    to CUSTOM
 -obr <arg>         OBR Index File Location

Example

java -jar dependency.graph.osgi-0.0.1-SNAPSHOT-jar-with-dependencies.jar -obr index.xml -bundles bundles.txt -edge - Plot the matched bundles from bundles.txt using the specified OBR index.xml with edge labels


Tools Used

  1. https://bnd.bndtools.org
  2. http://graphstream-project.org

plotted graph example


Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages