OSGiUserStories

Contents

OSGi User Stories (since NetBeans 6.9)

This page lists the user stories for NB OSGi integration, meaning we look at how the user would accomplish several key goals.

Consume OSGi Bundle in NB RCP App

As a user, I have an existing OSGi bundle that I want to use in a NetBeans RCP application. (This bundle could be something I'm already using in some other part of my architecture, or some publicly available open source library that is packaged as an OSGi bundle.)

Using Ant

Project setup

  • module projects and module suite project are open in the IDE, created from the new project templates under NetBeans Modules category (Module, Module Suite, NetBeans Platform Application)
  • if the user wants also one of his modules to be loaded by Felix at runtime, not by NetBeans module system, the user can check Generate OSGi bundle checkbox at the last panel of new Module project wizard

Development (adding file types, working with layers, etc.)

  • the existing OSGi bundles are present in a folder on user's disk as JARs
  • in the module suite project's Properties on Libraries panel a new cluster with the OSGi bundles needs to be added as a dependency; Add Cluster action offers the user to Import a Cluster and generate configuration files for the bundle JARs when the user points to the folder with bundle JARs
  • user is adding dependencies and using NetBeans APIs in all his module and module suite projects the usual way

Building

  • user builds his modules and module suites the usual way

Debugging and Running including reloading modules after I make changes

  • Run, Debug actions on module suite project run an external instance of the Platform with the module suite's projects and all dependencies as usual
  • Install/Reload in Development IDE on module project installs and reloads the module and its dependencies in the current IDE as usual

Using Maven

Project setup

  • module projects and application project are open in the IDE, created from the new project templates under Maven category (Maven NetBeans Module, Maven NetBeans Application)
  • only the Maven NetBeans Module with the option "Allow OSGi bundles as dependencies" checked can have a dependency on an OSGi bundle

Development (adding file types, working with layers, etc.)

  • the existing OSGi bundles are present in a Maven repository (either a local repository or in a remote repository)
  • the Maven NetBeans Module using OSGi can have any OSGi bundle artifacts from any Maven repository added as its dependency
  • user is adding dependencies and using NetBeans APIs in his module projects the usual way

Building

  • user builds his modules and application the usual way

Debugging and Running including reloading modules after I make changes

  • Run, Debug actions on the NetBeans Platform Application project run an external instance of the Platform with the module projects and all dependencies as usual

Code New OSGi Bundle for use in NB RCP App

As a user, I am developing code that needs to be packaged as an OSGi bundle, and I want to make use of that code in a NetBeans RCP application (running with NB module system).

Using Ant

Project setup

  • one of my NetBeans Module projects has Generate OSGi Bundle property enabled, this module is then built with OSGi metadata in its manifest and is loaded as a regular OSGi bundle by Felix at runtime of my application

Development (adding file types, working with layers, etc.)

  • user is adding dependencies and using NetBeans APIs in all his module and module suite projects the usual way

Building

  • user builds his modules and module suites the usual way

Debugging and Running including reloading modules after I make changes

  • Run, Debug actions on module suite project run an external instance of the Platform with the module suite's projects and all dependencies as usual
  • Install/Reload in Development IDE on module project installs and reloads the module and its dependencies in the current IDE as usual

Using Maven

Project setup

  • an OSGi bundle project is open in the IDE, created from the Maven OSGi Bundle project template under Maven category in New Project wizard

Development (adding file types, working with layers, etc.)

  • user adds classes, edits code and adds dependencies to any other OSGi bundles (from some Maven repository) in his OSGi bundle project

Building

  • user builds the bundle using Build action as usual, a pure OSGi bundle JAR is created
  • the user can publish the OSGi bundle JAR as an artifact to any Maven repository
  • artifact of this OSGi bundle project can be later added as a dependency to a Maven NetBeans Module, as described in the "Consume OSGi Bundle in NB RCP App" usecase above

Debugging and Running including reloading modules after I make changes

  • Run, Debug actions for the OSGi bundle deploy the bundle into a Felix runtime container started by the IDE

Coding a NB RCP application that will run completely in OSGi

I am writing a new application and want to use the NetBeans Platform. However, I want to code all of my modules as OSGi bundles and run the entire application in the OSGi container.

Using Ant

Project setup

  • all module projects can be created with the Generate OSGi Bundle switch enabled

Building

  • user invokes OSGi / Build Bundles action on his module suite / application project

Debugging and Running

  • user invokes OSGi / Run in Felix on his module suite / application project

For all details see: NetBeansInOSGi

Using Maven

Not supported (yet).

In NetBeans 6.9 it is not supported for OSGi bundles created via Maven Support to depend on NetBeans APIs (any Platform modules).

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo