Download - OSGi experiments
OSGi ExperimentsLadislav Gažo / [email protected] / @ladislavGazo
2 | Internal use only
Restart container
3 | Internal use only
Tomcat
.
.
.
.
.
.
Pleeeenty of projects=
Long time
4 | Internal use only
Something was wrong
• start-up time long
• hot redeploy is fail
• restart takes long
• multiple wars? maybe
• JRebel? maybe
• one big bunch of bitter jars?
• YES – this needs a solution
5 | Internal use only
OSGi
• old Alliance
• different class loading
– dependency hell no more
• modules a.k.a. bundles
• redeploy
• not clear what to choose
• but still small enough
6 | Internal use only
Eclipse Equinox
Apache Felix
Oracle Glassfish
Eclipse Virgo
Apache Karaf
7 | Internal use only
Challenges
• which runtime to choose
• how to properly structure
• inter/intra module
dependencies
• deployment model
• redeployment in dev
• database access
• Karaf
• Maven already helped a lot
• Blueprint, CDI
– optionally Spring, Guice
• e.g. from local m2 repo
• bundle:watch
• ehm... Hibernate is hard
8 | Internal use only
Layers & Bundle & Lifecycle
9 | Internal use only
Karaf PoC - https://github.com/lgazo/karaf-poc
fis-database fis-persistenceunitfis-database customer-domain event-domain
event-service
fis-shell fis-web
otherapp-persistenceunitotherapp-database order-domain
Features
• independent domain modules,
orchestrated persistence units
• multiple DBs
• service separated from view/access
modules
• multiple versions of a bundle
10 | Internal use only
<packaging>bundle</packaging>
<plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.3.7</version> <extensions>true</extensions> <configuration> <instructions> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> </instructions> </configuration> </plugin>
11 | Internal use only
Interesting commands
• ./karaf debug
• bundle:watch
• log:tail
• bundle:list
• feature:repo-add + feature:install
• install -s wrap:mvn:postgresql/postgresql/9.1-901-1.jdbc4
• bundle:tree-show
12 | Internal use only
Notable buzzwords + properties
• Blueprint
• Whiteboard
• Apache Aries, Eclipse
Gemini
• Distributed OSGi
• Pax
• SSH console, web console
• Features
• Language agnostic – bundles
can be in Java, Scala,
Groovy,...
• HttpService, Configuration
service, Activator, Logging
14 | Internal use only
Links
• Karaf PoC - https://github.com/lgazo/karaf-poc
• Apache Karaf – http://karaf.apache.org
• Apache Aries - http://aries.apache.org/
• Hibernate OSGi - https://github.com/brmeyer/HibernateOSGi