+ All Categories
Home > Technology > Eclipse Concierge - an OSGi R5 framework for IoT applications

Eclipse Concierge - an OSGi R5 framework for IoT applications

Date post: 16-Jul-2015
Category:
Upload: jochenhiller
View: 266 times
Download: 0 times
Share this document with a friend
14
Eclipse Concierge - an OSGi R5 Framework for IoT applications Eclipse DemoCamps Fall 2014 Jochen Hiller, Deutsche Telekom AG
Transcript

Eclipse Concierge - an OSGi R5 Framework

for IoT applications

Eclipse DemoCamps Fall 2014

Jochen Hiller, Deutsche Telekom AG

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

Status of Eclipse Concierge• Part of Eclipse IoT projects • Developed by Jan Rellermeyer,

2 additional committers • First release planned end 2014 • 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

Jan Rellermeyer Tim Verbelen Jochen Hiller

Eclipse Concierge

Demo

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

How to use your own storage?

$ cd /mnt/flash/app/repo $ java -Dorg.osgi.framework.storage=/tmp/mystorage \ -jar org.eclipse.concierge-1.0.0.alpha2.jar -all

Embedded: • Load bundles from Flash memory • Place all temporary files into memory, not flash

How to Embed ConciergeMap<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 terminatedframework.waitForStop(0);

Additional bundlesSeparate 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

Size of Eclipse Concierge

$ 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 $

• Framework about 250 kB (stripped debug info) • All extensions as separate fragments/bundles to keep core as small as possible

XargsFileLauncher

$ java -jar org.eclipse.concierge-1.0.0.alpha2.jar myapp.xargs

# myapp.xargs -Dorg.osgi.framework.system.packages.extra+=javax.xml.parsers -DrepoDir=./repo

-istart ${repoDir}/org.apache.felix.gogo.runtime-0.12.*.jar -istart ${repoDir}/org.apache.felix.gogo.shell-0.10.*.jar -istart ${repoDir}/org.apache.felix.gogo.command-0.14.*.jar

• Concierge supports Knopflerfish styled xargs file for startup • Enhanced property (variable replacement) and install notation (wildcard support)

System Packages Extra

[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)

• Concierge only includes java.* and org.osgi.* packages in export packages of System bundle • Typical problem during bundle resolve:

# 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

• Other packages need to be added to “org.osgi.framework.system.packages.extra”

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.*,

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

Jochen Hiller@jochenhiller

Concierge

Product names, logos, brands and other trademarks referred to within this presentation are the property of their respective trademark holders.

Project http://eclipse.org/concierge Mailinglist https://dev.eclipse.org/mailman/listinfo/concierge-dev


Recommended