This document provides an overview of Naive OSGi, which aims to implement the Java OSGi specifications in C and C++ to enable modular software development for native languages. It discusses the motivations for Naive OSGi, including leveraging the benefits of OSGi for C/C++ applications. The current state of various OSGi-like implementations for C/C++ is examined, including the CTK Plugin Framework, Apache Celix, nOSGi, and the Service Oriented Framework. The document also covers the history of efforts toward a "Universal OSGi" and highlights some of the challenges involved in building a native OSGi framework.
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Native OSGi, Modular Software Development in a Native World - Alexander Broekhuis, Sascha Zelzer
1. Na#ve
OSGi
Modular
So1ware
Development
in
a
Na#ve
World
Alexander
Broekhuis
alexander.broekhuis@luminis.eu
Sascha
Zelzer
s.zelzer@dkfz-‐heidelberg.de
3. Alexander
Broekhuis
• So1ware
Developer
• Started
as
a
Java
Engineer
• Programming
C
since
2010
• At
Luminis
since
2008
• So1ware
House
• Research
and
innova#on
oriented
• Involved
in
Open
Source
(Apache)
• Apache
commiXer
since
2010
4. Sascha
Zelzer
• So1ware
Developer
• 15
years
of
experience
with
Java,
Eclipse,
C++
• Current
focus
on
modular
C++
systems
• For
research
environments
• Since
2005
at
the
German
Cancer
Research
Center
(DKFZ)
• Large
mul#-‐disciplinary
research
environment
• Mainly
cancer
research
and
medical
imaging
• Long
open-‐source
history
within
the
department
5. OSGi
is:
• component
based
framework
• allows
dynamic
assembly
of
components
• Java,
so
independent
of
opera#ng
system
OSGi
technology
is
the
dynamic
module
system
for
Java™
OSGi
technology
is
Universal
Middleware.
OSGi
technology
provides
a
service-‐oriented,
component-‐based
environment
for
developers
and
offers
standardized
ways
to
manage
the
so@ware
lifecycle.
These
capabiliBes
greatly
increase
the
value
of
a
wide
range
of
computers
and
devices
that
use
the
Java™
plaForm.
10. Benefits
• Making
products
with
many
varia#ons
• Improving
quality
through
re-‐use
• Speed:
#me
to
market
11. Na#ve
OSGi
"The
Na#ve
OSGi
project
is
a
collabora#ve
effort
to
write,
test,
and
implement
the
Java
OSGi
specifica#ons
in
C
and
C++
with
a
focus
on
interoperability
between
C,
C++
and
Java"
12. Mo#va#on
-‐
Why?
• C
and
C++
are
NOT
obsolete
• C++11
is
a
big
step
forward
• Tradi#onal
Applica#on
Domains
• Embedded
Devices
• Medical
Imaging
• Sensor
Networks
• Lightweight
Na#ve
Module
System
• Benefits
na#ve
developers
13. C/C++
Modulariza#on
• Examples
• CORBA
and
CCM:
Portable,
heavy-‐weight
• Service
Component
Architecture
(SCA)
• Problems
• Find
a
C/C++
implementa#on
with
an
appropriate
license
• Scope
can
be
too
broad/overwhelming
14. Benefits
• Mature
API
• OSGi
is
around
since
1999
• Core
Specifica#ons
are
small
• Enables
hybrid
Java/C/C++
solu#ons
• as
an
alterna#ve
to
JNI
• Eases
migra#on
• From
Na#ve
to
Java
• Embedded
Performance
16. History
-‐
Universal
OSGi
• RFP-‐89
• Proposed
to
the
mailing
in
2007
• Since
then
remained
silent
• Ongoing
(slow)
effort
to
pick
up
again
• Focused
on
• Suppor#ng
different
languages
in
OSGi
• Suppor#ng
framework
in
different
languages
• Languages
men#oned:
• Na#ve
(C
and
C++),
.NET
(C#),
Scrip#ng
(Javascript/Ac#onscript)
17. History
-‐
Universal
OSGi
• Completely
Different
Languages
• Na#ve,
Managed,
Scrip#ng
• Limit
Scope
• Focus
on
C/C++
• Makes
it
easier
to
progress
• Keeps
Focus
on
Common
Run#me
“Na$ve-‐OSGi”
18. Current
State
• OSGi-‐like
Implementa#ons
• CTK
Plugin
Framework
• Apache
Celix
• nOSGi
• Service
Oriented
Framework
(SOF)
19. Current
State
• Small
Communi#es
• No
Interoperability
• Different
bundle
format
• API
differences
• Wiring
solved
differently
• Module
layer
20. CTK
Plugin
Framework
Largest
biomedical
research
ins#tute
in
Germany
Founded
in
1964,
~2200
employees
Developed
at
the
German
Cancer
Research
Center
(DKFZ)
21. CTK
Plugin
Framework
• Part
of
“Common
Toolkit”
• Large
interna#onal
ini#a#ve
(medical
imaging)
• C++
API
is
very
close
to
the
OSGi
Specifica#on
• Provides
Implementa#ons
• Log
• Configura#on
Admin
• Metatype
• Event
Admin
• Runs
on:
Windows,
Linux,
MacOS
23. Apache
Celix
• Development
started
at
Thales
Netherlands
• Open
Sourced
/
Donated
by
Luminis
to
Apache
• Embedded
distributed
systems
• Dynamic
(Re)Configura#on
• Used
as
middleware
in
large
research
project
24. Apache
Celix
• Implemented
in
C
• API
close
to
the
specifica#on
• Adapted
to
Non-‐Object
Oriented
use
• Donated
to
the
Apache
Incubator
• Provides
• Log
Service
Remote
Service
Admin
• Devices
Access
Deployment
Admin
• Shell
25. nOSGi
• Research
project
at
University
of
Ulm
• Steffen
Kächele
• Very
lightweight
and
fast
implementa#on
(only
requires
c++
run#me
and
unzip)
• Runs
on
POSIX
systems
• Features
• Wiring
of
shared
objects
for
code-‐sharing
• Service
registry
with
filters
• Supports
source
bundles
(compiled
at
run#me)
• Comes
with
a
Shell
implementa#on
26. Service
Oriented
Framework
(SOF)
• Mature
open-‐source
project
(BSD)
• MaXhias
Grosam
• Shared
libraries
model
bundles
• Runs
on
Windows
and
Linux
• Features
• Service
registry,
trackers
and
listeners
• Provides
a
command
shell
• Remo#ng
capabili#es
(using
CORBA)
• Remote
services
and
service
listeners
• Command
shell
for
each
process
27. Specifica#on
• Members
• Goal
• Bundle
Format
• Module
Layer
• Life
Cycle
Layer
• Service
Layer
• C
and
C++
Interoperability
28. Members
• CTK
Plugin
Framework
• Apache
Celix
• nOSGi
Ini#al/startup
mee#ng
took
place
in
Hengelo
in
May
this
year
29. Goal
• Follow
OSGi
Specifica#on
• Allow
Interoperability
• Bundles
• Remote
Services
• Seamless
C
and
C++
Interoperability
• E.g.
provide
a
C
service,
consume
via
C++
interface
30. Goal
• Grow
Communi#es
• Combine
where
possible
• Channel
efforts
• Write
Open
Source
reference
• All
feedback
is
welcome!
32. Bundle
Format
• Like
Java
Archives
(JAR)
• Using
ZIP
format
• Bundle
Manifest
• .cmf
vs
.mf
• Headers
• Op#onals
• Libraries
• Resources
Layout:
-‐META-‐INF/
-‐MANIFEST.CMF
-‐OSGI-‐OPT
-‐share/
-‐include/
-‐src/
-‐lib/
-‐resources/
33. Module
Layer
• Shared
Libraries
model
Java
Packages
• Allows
Code
Sharing
• Mul#ple
Libraries
per
Bundle
• Symbols
must
be
exported
explicitly
• Addi#onal
visibility
control
• Symbol
Searching
Handled
by
Linker
• Meta-‐data
• Import/Export
Headers
• Execu#on
Environment
for
Addi#onal
Requirements
34. “Package”
Wiring
• Mechanism
from
nOSGi
• Library
Dependencies
Patched
at
Run#me
• To
match
with
available
exports
• Allows
Mul#ple
Versions
• Of
the
same
package
• Allows
Bundle
Updates
37. Service
Layer
• Na#ve
API
Close
to
the
Specifica#on
• Especially
C++
• C
API
is
adapted
to
Non-‐Object
Oriented
use
• Requirements
for
C++
• Be
Type-‐Safe
• Avoid
exposing
void*
where
possible
• Do
not
require
a
Service
base
class
• Allow
mul#ple
inheritance
of
Service
interfaces
38. Service
Layer
• Requirements
for
C
• Use
Struct
with
Func#on
pointers
for
Services
• Components
are
represented
as
void*
• Return
value
only
used
for
error
codes
• Return
values
via
arguments
39. C
/
C++
Interoperability
• Na#ve-‐OSGi
• Provides
both
C
and
C++
headers
• Provide
thin
bi-‐direc#onal
wrapping
• Service
Interfaces
• Should
provide
C
and
C++
• C++
Services
implemented
using
Interfaces
• C
Services
implemented
using
Structs
and
Func#on
Pointers
40. C
/
C++
Interoperability
• Service
Interfaces
• Provide
bindings
for
C
-‐>
C++
and
C++
-‐>
C
• IDL
for
Service
descrip#on
and
code
genera#on
• Service
Provider
• Implement
either
the
C
or
C++
header
• Service
Consumer
• Use
either
the
C
or
C++
API
41. C
/
C++
Interoperability
Native OSGi
C Framework Impl
C API
Headers & Utilities
C++ to C Wrapper
C++ API
CBundle
C++Bundle
C++Bundle
Native OSGi
C++ Framework Impl
C++ API
Headers & Utilities
C to C++ Wrapper
C API
CBundle
45. Outlook
• Write
Specifica#on
• Test
ideas/solu#ons
• As
part
of
the
OSGi
Alliance
• Define
Reference
Implementa#on
• Look
into
Compendium
Services
• Remote
Service
as
alterna#ve
to
JNI
• Adapt
other
Services
to
Na#ve-‐OSGi
• Community!