osgi experiments

14

Click here to load reader

Upload: seges

Post on 13-May-2015

806 views

Category:

Technology


0 download

DESCRIPTION

Introduction to OSGi, modularity & proof of concept in Apache Karaf with Hibernate persitsence

TRANSCRIPT

Page 1: OSGi experiments

OSGi ExperimentsLadislav Gažo / [email protected] / @ladislavGazo

Page 2: OSGi experiments

2 | Internal use only

Restart container

Page 3: OSGi experiments

3 | Internal use only

Tomcat

.

.

.

.

.

.

Pleeeenty of projects=

Long time

Page 4: OSGi experiments

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

Page 5: OSGi experiments

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

Page 6: OSGi experiments

6 | Internal use only

Eclipse Equinox

Apache Felix

Oracle Glassfish

Eclipse Virgo

Apache Karaf

Page 7: OSGi experiments

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

Page 8: OSGi experiments

8 | Internal use only

Layers & Bundle & Lifecycle

Page 9: OSGi experiments

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

Page 10: OSGi experiments

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>

Page 11: OSGi experiments

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

Page 12: OSGi experiments

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

Page 13: OSGi experiments

13 | Internal use only

Thank you for your patience

[email protected]@ladislavGazo

Page 14: OSGi experiments

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