Mittwoch, 14. Oktober 2009

OSGi book summary part one

Summary for book "Die OSGI Service Platform-Eine Einführung mit Eclipse Equinox" link

The book is a good introduction to OSGi. It has 24 chapters, from OSGi introduction to OSGi and Equinox Standard Services. The book is divided in three part: part one: OSGi Framework, part two: OSGi Standard Services, part three: Equinox Services(Extensions)

Following chapters are discused in first part:
Bundles, Bundles lifcycles, Packages dependencies, OSGi Services, dynamic Services, Fragment Bundles, Security, Management of OSGi Service Platform, Packaging and Deployment


this blog summary the summary of the book:

* how to install Eclipse PDE (download eclipse-equinox-SDK-3.xxxx.zip)

* describe how OSGi work: bundles, layers, lifecycles, deployment, services, avaiable implementations(felix, equinox), example to start a http game services.


* Bundle Manifest have descriptive information about bundles, the manifest will be readed and interpreted by OSGi platform.
* Bundle-Classpath have locale paths
* Bundle-Activator is the start and stop point of a bundle with org.osgi.framework.BundleActivator
* BundleContext (parameter on start()/stop()), allow access to OSGi framework. Through context you can install new bundles, register listener, register and ask for services.

* Equinox console is a simpler Management Agent. You can ask for state of bundles and OSGi environment. A bundle has different states (installed, uninstalled, running, stoped)
* Activator Policies can change the behavior of bundles starts. (time, sequence, ressources). Lazy Activator set the bundle only start if other required him.
* It exists change of states with code too. (not only manifest-file)
* Bundle listener can notify you about state changes. Listener are registered with BundleContext.
* Bundle Cache save the states for persistence beyound the start()/stop() borders.

* For using other bundles you must explizit import/export you bundles in manifest-file.
* That is done with Export-Package and Import-Package labels.
* Required-Bundle specific the whole bundle. Import-Package only classes/packages. '*' import all class in a package.
* With Versioning you can specify which version of a same bundle the other bundle should use.
* With DynamicImport-Package you can import packages which doesn't exists yet.

* OSGi services are simple java objects (POJO Plain Old Java Objects). The services are registered to Service Registry with theirs class names. The services could quered by other bundles.
* The access to Services happen with ServiceReference and BundleContext
* On registry you can send some properties (which is a simple hash map)
* To get a reference: BundleContext.getServiceReferences() and the class name of service. Then you can use filter.
* With start leveln you can affect the start sequence of bundles.

* Sercice Tracker help you to work with one interface, independent from runtime/lifecycle. Tracker help dynamic react to services in/outgoing.
* ServiceTrackerCustomizer help you to react to different changes with call-back methods.
* Central OSGi Service Registry is the Whiteboard-Pattern and allow simple way the traditional listener-patern to replace.

* Fragments bundles expand the classpath of others bundles ( to avoid overloading of code/info for one bundle). It is a simple way to divide logic part from presentation(templates, languages).
* Fragmenst have no lifecycles (no Activators). manifest: Fragment-Host
* The Import/Export/Requirement information from Fragment Bundle will transfer to Host Bundle (which use the Fragment Bundle)
* Extension Bundles you can change the boot-classpath and expand it with additional features.

* Security in OSGi: local access can be setted to avoid execution in OSGI-INF/permissions.perm
* You can run only signed bundles or with certificates
* Conditional Permission Admin Service asign global authorization (Conditions)

* Management Agent implement an access to OSGi framework. For administrate framework from outside.
* It can be done by shell. or with programmatic.
* You can code your own commands with implement a CommandProvider with org.eclipse.osgi.framework.console.CommandProvider and register it to OSGi Service Registry.

* Plug-in Export Wizard is a simple facility to build bundles for extern world (and not only work with eclipse)
* For automatic build: ant4eclipse, Maven
* To start Eclipse Equinox: use org.eclipse.osgi_version.jar. Or start org.eclipse.core.runtime.adapptor.EclipseStarter from an Java application.
* With System properties or config.ini you can manipulate Equinox

Keine Kommentare:

Kommentar veröffentlichen