Dev Dives: Streamline document processing with UiPath Studio Web
Eclipse Concierge - an OSGi R5 framework for IoT applications
1. Eclipse Concierge
- an OSGi R5 Framework
for IoT applications
Eclipse DemoCamps
Fall 2014
Jochen Hiller, Deutsche Telekom AG
2. What is Eclipse Concierge?
• Full OSGi R5 compatible core framework
• Keep a small footprint to work well
on embedded devices
• Remain “readable”
• Remain backwards-compatible
(Java 1.5, Java 1.4 under discussion)
• Being a sandbox for innovation around OSGi
• See JavaOne 2014 presentation:
Building Small and Efficient Internet of Things Applications with Concierge
3. Status of Eclipse Concierge
• Part of Eclipse IoT projects
• Developed by Jan Rellermeyer,
2 additional committers
• First release planned end 2014
Jan Rellermeyer Tim Verbelen Jochen Hiller
• Achieve full OSGi R5 compliance (1 test missing)
• Eclipse Kura is running on Concierge
• Eclipse projects are close linked to Equinox, Eclipse Runtime, difficult to
move over to Concierge
• Eclipse SmartHome (minimal runtime) is close to run on Concierge
5. Run Concierge from Commandline
$ java -jar org.eclipse.concierge-1.0.0.alpha2.jar -help
$ java -jar org.eclipse.concierge-1.0.0.alpha2.jar
$ java -jar org.eclipse.concierge-1.0.0.alpha2.jar
-istart repo/org.eclipse.concierge.shell-1.0.0.alpha2.jar
$ cd repo ; java -jar ../org.eclipse.concierge-1.0.0.alpha2.jar -all
6. How to use your own storage?
Embedded:
• Load bundles from Flash memory
• Place all temporary files into memory, not flash
$ cd /mnt/flash/app/repo
$ java -Dorg.osgi.framework.storage=/tmp/mystorage
-jar org.eclipse.concierge-1.0.0.alpha2.jar -all
7. How to Embed Concierge
Map<String, String> launchArgs = new HashMap<String, String>();
Framework framework = new Factory().newFramework(launchArgs);
framework.init();
framework.start();
BundleContext bundleContext = framework.getBundleContext();
Bundle shellBundle = bundleContext
.installBundle("org.eclipse.concierge.shell-1.0.0.alpha2.jar");
shellBundle.start();
bundleContext.installBundle("hello_1.0.0.jar");
// ...
// wait until framework will be terminated
framework.waitForStop(0);
8. Additional bundles
Separate extensions, to keep core framework as small as possible
o.e.c.extension.permission framework extension which adds PermissionAdmin, CondPermAdmin
required e.g. for Equinox Console
o.e.c.service.packageadmin provides OSGi R4.2 package admin 1.2
required e.g. for Apache Felix WebConsole
o.e.c.service.startlevel provides OSGi R4.2 start level service 1.1
required e.g. for Apache Felix WebConsole
o.e.c.service.xmlparser provides OSGi R5.0 XML Parser Specification 1.0
required e.g. for Equinox Extension Registry
o.e.c.shell provides simple shell without further dependencies
9. Size of Eclipse Concierge
• Framework about 250 kB (stripped debug info)
• All extensions as separate fragments/bundles to keep core as small as possible
$ ls -lR
./framework:
-rw-r--r-- 1 jhiller wheel 249354 Dec 1 10:07 org.eclipse.concierge-1.0.0.alpha2-nodebug.jar
-rw-r--r-- 1 jhiller wheel 333189 Nov 28 11:35 org.eclipse.concierge-1.0.0.alpha2.jar
./bundles:
-rw-r--r-- 1 jhiller wheel 13476 Nov 28 11:35 org.eclipse.concierge.extension.permission-1.0.0.alpha2.jar
-rw-r--r-- 1 jhiller wheel 13116 Nov 28 11:35 org.eclipse.concierge.service.packageadmin-1.0.0.alpha2.jar
-rw-r--r-- 1 jhiller wheel 3781 Nov 28 11:35 org.eclipse.concierge.service.startlevel-1.0.0.alpha2.jar
-rw-r--r-- 1 jhiller wheel 11974 Nov 28 11:35 org.eclipse.concierge.service.xmlparser-1.0.0.alpha2.jar
-rw-r--r-- 1 jhiller wheel 13059 Nov 28 11:35 org.eclipse.concierge.shell-1.0.0.alpha2.jar
$
11. System Packages Extra
• Concierge only includes java.* and org.osgi.* packages in export packages of System bundle
• Typical problem during bundle resolve:
[Mon Dec 01 13:39:22 CET 2014] [DEBUG] Solution: MultiMap {}
Exception in thread "main" org.osgi.framework.BundleException: Resolution failed
[BundleRequirement{Import-Package javax.management}, BundleRequirement{Import-Package javax.naming},
BundleRequirement{Import-Package javax.xml.parsers}, BundleRequirement{Import-Package org.w3c.dom},
BundleRequirement{Import-Package org.xml.sax}, BundleRequirement{Import-Package
org.xml.sax.helpers}]
at org.eclipse.concierge.Concierge.resolve(Concierge.java:2518)
• Other packages need to be added to “org.osgi.framework.system.packages.extra”
# required for Apache log4j
-Dorg.osgi.framework.system.packages.extra+=javax.management,
-Dorg.osgi.framework.system.packages.extra+=javax.naming,
-Dorg.osgi.framework.system.packages.extra+=javax.xml.parsers,
-Dorg.osgi.framework.system.packages.extra+=org.w3c.dom,
-Dorg.osgi.framework.system.packages.extra+=org.xml.sax,
-Dorg.osgi.framework.system.packages.extra+=org.xml.sax.helpers,
-istart ${repo}/log4j_*.jar
12. Bootdelegation
• Concierge only loads java.* packages from System ClassLoader
• All further packages from Java Runtime (sun.*, javax.*, com.sun.*, …) have
to be added to Bootdelegation
• Typically indicated by NoClassDefFound exceptions
• Enable org.eclipse.concierge.debug=true,
org.eclipse.concierge.debug.classloading=true for better analysis
-Dorg.osgi.framework.bootdelegation+=javax.*,
-Dorg.osgi.framework.bootdelegation+=sun.*,com.sun.*,
13. SyntheticBundleBuilder
• Plain Concierge Framework testing using OSGi TCK (not public)
• Additional regression tests for Concierge implementation
• Additional integration tests with “real” bundles from Equinox, Apache Felix, …
• Helper class “SyntheticBundleBuilder” to create bundles on the fly
SyntheticBundleBuilder builder = new SyntheticBundleBuilder();
builder.bundleSymbolicName("myBundle").bundleVersion("1.0.0")
.addManifestHeader("Import-Package", "org.osgi.framework")
.addFile("plugin.properties", "# a props file");
Bundle bundleUnderTest = framework.getBundleContext().installBundle(
"myBundle", builder.asInputStream());
bundleUnderTest.start();
URL resource = bundleUnderTest.getEntry("/plugin.properties");
// ... do more testing
14. Jochen Hiller
@jochenhiller
Concierge
Project http://eclipse.org/concierge
Mailinglist https://dev.eclipse.org/mailman/listinfo/concierge-dev
Product names, logos, brands and other trademarks referred to within this presentation are the property of their respective trademark holders.