osgi-best-practices
osgi-best-practices copied to clipboard
Show some of the OSGi best practices in Action
osgi-best-practices
OSGi application with an angular UI, REST Service and OSGi service. The design follows current best practices for OSGi R7 applications.
Slides for eclipsecon 2109 talk "Testing OSGi applications"
Modules
- parent - Defines common dependencies and the build of OSGi bundles
- backend - Tasklist api, OSGi service impl and REST service. In a full blown application you might want several bundles here
- halbrowser - Repackaged halbrowser for OSGi
- ui - Static Angular UI that uses the REST backend
- app - Defines the index and application assembly using bndrun
Build
mvn clean install
Run
cd app; java -jar target/app.jar
Alternatively run in Apache Karaf
Download and run Apache Karaf 4.2.6
feature:repo-add mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.features/1.0.5/xml
feature:install aries-jax-rs-whiteboard aries-jax-rs-whiteboard-jackson war
install -s mvn:net.lr.osgibp/net.lr.osgibp.backend
install -s mvn:net.lr.osgibp/net.lr.osgibp.ui/1.0.0-SNAPSHOT
Test
Resources
- OSGi enroute microservice example - Great example for a rest service. It also shows how to do JPA in OSGi.
- Sling bundle parent - Contains many of the best practices
- Some hints to boost your productivity with declarative services
- Bnd maven plugins documentation
- OSGi R7 Highlights JAX-RS Whiteboard
- Best practices for Restul apis
- Pure Annotation-Driven Bundle Development