Eclipse tooling for osgi bundle restart on workspace change - java

We develop a huge set of OSGi bundles based on Equinox and start it within Eclipse with a "OSGi Framework" launch configuration. The start of the framework with all necessary bundles and data takes 1-2 minutes which is the reason why we used DCEVM and JRebel to hot-deploy changed classes.
Now with Java 8 these methods do not work properly any more (DCEVM is available for Java 7 only, and JRebel has too many limitations - freezing debug sessions, no support for added instance fields etc). Since our application is quite modular, I imagine an Eclipse function (via plugin?) that monitors the workspace for class changes and restarts the affected bundles after the incremental build is finished.
Are you aware of some tooling that might help for this task?

Bndtools provides such an environment. It is also superior to the eclipse plugin perspective in a lot of other ways. For example it has great support for declarative services.

DCEVM supports java8 now. Lets look at https://github.com/dcevm/dcevm
If you need hotswap support Eclipse RCP/OSGI you can use https://github.com/HotswapProjects/HotswapAgent It has module for Eclipse OSGI.

Related

How to get started with Java modules?

I'm reading about OSGi and JBoss modules. I understand the purpose of modules -- to avoid Jar hell and conflicting classes -- but I don't know where to start if I want to write a new application that uses them. Is there a kernel somewhere that I can start with, that then loads the other modules? I don't want to run Eclipse or Wildfly; I want to start fresh with my own app. Hello world for modules.
Edit: I'm using IntelliJ, and for several reasons I really don't want to switch to Eclipse. So I can't do much with answers that require I install Eclipse plugins.
OSGi would be the first choice. JBoss Modules is still much more an internal JBoss thing than a general purpose modularity solution.
To start with an OSGi application, take a look at Bndtools. This is an Eclipse plugin to make OSGi development easy. From there you can create a "run configuration" which is the definition of your application. From there you can also export the application to a single executable JAR to distribute your app.
This is a nice video to get you started.
Also, for more high level components (REST, databases, scheduling etc.) take a look at Amdatu.
Try starting with OSGi enRoute: http://enroute.osgi.org/. This is a project, still in development, to demonstrate using OSGi.

How to build desktop applications with Apache Karaf/OSGi?

Well im into building OSGi application for a while, but i can't really find some tutorials which show the way to build Desktop Application ( in any languages ) with OSGi/Karaf.
I want to use karaf because it can then wrap Felix/Equinox. Most of Tutorials i found are about Enteprise Application(WEB). So is there any tutorials, which talk about building desktop application based on OSGi/Karaf?
Here is an example of a GUI application project that uses Apache karaf:
https://bitbucket.org/lorainelab/igb-fx
Using karaf to run a gui-based desktop application decreases development time. A developer makes a change to a bundle, builds the bundle, and then uses karaf shell commands to reload just that one bundle into the running application. There is no need to restart the entire application to view the effects of the new code. This is why were are using it.
We are using OSGi because we want greater modularity in the code base and because we want to support dynamically loaded "Apps" developed by 3rd party developers who write against our genome browser API.
Sorry the main intend right now for Karaf is to be used as a Server, though it still should be possible to start some guis on top. As your already familiar with building such bundles I'm sure you most probably could use just the minor version of Karaf and place your bundles in it. I have to admit I never done this before, so I'm not really sure about it.
First of all OSGI is a component framework, it also leverages a feature missing in Java since its inception - runtime versioning. If you really need it (OSGI), it doesn't depend wether you develop a WEB or desktop application. In general I would recommend you to take a look at this documentation:
http://fusesource.com/docs/esb/4.2/deploy_osgi/Build-ModifyMaven.html
In that link you'll find how to convert an existing Maven project to bundle, check further chapters - there's info how-to deploy jars in e.g. Karaf (Karaf is an OSGI container)
Hope, this helps

Using Netbeans Platform with JavaFX 2?

I am building a desktop application on JavaFX 2, and want to speed up my development --
Is RCP the way to go? How steep is the learning curve?
There is the eFX project which tries to adapt the NetBeans Platform for JavaFX.
From what I know about the NetBeans Platform source code, I doubt though that they managed to get rid of the Swing dependencies. (This might be important once you want to deploy your application to a platform which doesn't support Swing. See: Compact Profiles and Project Jigsaw).
Also it uses the NetBeans Platform module system rather than OSGi (many Apache Commons libraries as well as other libraries come with OSGi meta data but not with NetBeans Platform meta data). There is a way to run OSGi bundle in a NetBeans Platform though, but, of course, this would mean that you have to know 2 module systems.
I also don't know if the NetBeans Platform Maven plugins work with eFX or if you have to use Ant.
As an alternative also note that (mainly for the concerns mentioned above) I've recently released an initial Early Access version of Drombler FX, a modular RCP for JavaFX based on OSGi and Maven (POM-first):
http://puces-blog.blogspot.ch/2012/12/drombler-fx-building-modular-javafx.html
http://wiki.drombler.org/GettingStarted

Java: IDE working well with Maven War overlays

We have a Java EE 6 web application which is fully mavenized, and we use the Maven "war overlay" facility to add customer specific files, and which currently runs in Glassfish 3.1.
We have traditionally used Eclipse for development, but I have found that the combination of Maven processing and War deployments may not be optimal in terms of deployment times, and that the mavenization allows us to use any IDE with good Maven support.
Therefore is Eclipse the best bet for our particular scenario (maven war overlays -> glassfish, and debugging it) or is e.g. Netbeans or IntelliJ better?
Please, back opinions with actual experiences, thanks.
EDIT: Some inital experiments with Netbeans 7.2 bundled with Glassfish 3.1.2.2 under Ubuntu 12.04.1 strongly hints that Netbeans work much faster in this scenario.
Admittedly Netbeans does have some nice features for Java EE Development and can be downloaded pre-packaged with glassfish, making life a bit easier.
BUT frankly as far as I am concerned it comes down to witch IDE you are most comfortable with. As any advantage you may gain from slighly better support, will be wiped out completly by your (teams) not being familiar enough with the new IDE's features and tools.
I guess what you really ought to considering is something like JRebel, witch plugs directly into the JVM, allowing real hot deployment. And has been developed specifically for faster Development by reducing the time spend on rebuiling and republishing entire projects for even the smallest of changes.
All the mentioned IDEs have more or less similar features in regards to maven support and hardly any of then could help you in this particular scenario. You could rather try avoiding maven overlays in development process as it adds time to the build phase. As suggested earlier, you could also benefit of JRebel for faster turnarounds. With that you will not have to run mvn clean install and save plenty of your valuable time.

Managing a Large OSGi Application

I have a large, growing OSGi application with a number of bundles. I am curious to know the best way to manage this type of application. Currently, I am using Eclipse and Maven, but although this is great for building bundles (via maven-bundle-plugin), as of now it has not been easy to manage the entire application.
What I would like to do is either have ONE run configuration or ONE pom.xml that can be launched and the entire application/project be built and launched. Also, I would like to have something that would be good for debugging.
I have heard of PAX Construct and have it installed in Eclipse, but so far it has been of little help (maybe I'm not using it correctly).
I am sure there are people out there with large OSGi applications that are being managed correctly. Any advice that could be shared would help tremendously.
Thank you,
Stephen
A run configuration is possible via Pax Runner. It lets you choose OSGi platform implementation, specify profiles (pre-packaged sets of bundles for some role, e.g. web, log, ds, etc.) and has good provisioning support, for instance it can load bundles from Maven repository. As a result, you can have a run configuration like
--platform=felix
--log=INFO
--profiles=scalamodules,ds,config,log
mvn:com.my/bundle/1.0.1-SNAPSHOT#update
# other bundles
In case your application is very large or you have different applications, there a way to create own profiles as well.
Well...
It all deopends on what do You mean by "managing" the application.
For dev time launching, building and debugging - Eclipse IDE should fit the bill just perfectly.
Maven... I can't speak for it, as I've never used it myself.
We have a pretty large eclipse based application (several, actually) and on the dev side of things we are not using anything special besides the Eclipse and it's integrated SCM.
In the cc build server, we also use headless eclipse to do the building and packaging.
Now the setup of the workspace has gone a bit out of hand of late with all the dependencies and intermediate build steps, so we are investigating Buckminster for managing the materialization of target platform and workspace resources.
If that works out, we'll probably move to building with Bucky as well - it sure looks promising.
(I do not have any experience with PAX, but at a glance, it looks promising as well...)
i'm quite new to OSGi but,
wouldn't it be possible to use OBR-service in such a way that
you would have one OBR repository file which needs the bundles
and let the OBR-service figure out the dependencies and populate your OSGIhost for you?
This area I think has very poor support at the moment. OSGI doesn't really define anything about deployment or packaging so its up to other frameworks (e.g. Eclipse) to come up with their own way of doing it.
If you are building an RCP (Eclipse base) application, then the eclipse systems do all this stuff, right down to creating exes etc. However builds are mainly done on the Eclipse workspace, headless builds are trickier. The Tycho project is trying to make this more sensible by joining the Maven and Eclipse build cycles, however it is still focussed on RCP applications rather than generic OSGI.
If you not doing RCP, which is my situation as well, then you probably have to roll your own solution, as I haven't found any general solution. Here's an outline of what we do:
We define one POM project that lists all the bundles that are contained in your application. All this project does is list the references - lets call it the 'bundle-list' project.
Then, we use pax provision to run the project in development mode. This is achieved by making the 'bundle-list' pom the parent of the provisioning pom of the pax project (usually in the 'provision' folder). Then, when you start pax, it uses the list of bundles from that project to start OSGI. The bundle references in the 'bundle-list' project have to be marked as 'provided' scope for this to work.
Then, to create a distribution, we have another project. This project also has the 'bundle-list' project as its parent. This project uses various plugins to create a distribution, including downloading the bundle jars. The distribution includes scripts that start up OSGI, but these are hand written, there's no pax systems here.
This works well for us to keep the list of bundles in one place, but there's still a lot of hand written scripts, and there are issues sharing configuration between the two systems - e.g. config files, bundle start levels etc.

Categories

Resources