BUG Community

Welcome! Log In

kschultz's Blog

What is OSGi?

We mention OSGi at Bug Labs so often that sometimes we forget that a lot of people have never heard of OSGi or used OSGi before hacking on the BUG. I certainly hadn't when I came to Bug Labs a year and a half ago.  Today I want to post a high level outline of what OSGi is and why it is so important to the BUG. I won't cover writing an application with OSGi in this post - only the concepts. I'm also going to skip over lots of sweet features in OSGi that we don't use because they are not applicable to our system.

Our Four Major Problems:

We have a "lifecycle" problem. If I have a program that needs to know its position and needs to display that to a screen, how does the app know when the GPS and the LCD module are plugged in? How does it know that the GPS just got pulled out? Some applications can run with absolutely no modules plugged in. It would be quite tiresome if every application had to re-implement the logic to check for these problems (not to mention horribly inefficient).

If we are going to have modular hardware, we must have modular software. Lets say I write an application that controls a motor via the Von Hippel module. One minute I want to have it controlled by tilting the BUG with the accelerometer. The next minute I want to pull out the accelerometer and plug in an LCD and want to control it using a GUI app. Imagine we had solved the life cycle problem without OSGi but had no modularity. The application using the accelerometer would be separate from the one using the LCD. Every time I made a change to one program's code I'd have to duplicate it on the other. Every time I changed modules the state of the controller would be lost. Instead we need a way to split the programs into pieces so that the controller is separate from the interface. Modularity of software is just as important as sleek plastic interfaces.

How do we share modules? If I have ten applications using your position they can't all keep control the GPS module independently. Sure you can poll its position when you need to, but one of the applications needs to initialize the GPS - what if one application sends it a series of commands to initialize while another is using it?

Finally, how do we write applications independent of hardware? If you write an app that requires position information it doesn't matter if that information comes from GPS, dead reckoning, GSM triangulation, Loran, a local positioning system, or a file loaded into an emulator. What matters is the logic in your code that handles that position data. We need to abstract away from simply calling a known module for its position.


OSGi - One solution:

This article should not suggest that OSGi is the one solution to rule them all. In fact on the BUG we have two solutions for modularity  and sharing modules (web services - which are a subject for another post).

OSGi is a "dynamic module system". Dynamic in this context meaning that it loads and unloads modules during runtime. created on: 04/14/09

The building blocks of an OSGi system are Bundles, Services, and the overhead Framework.

A Bundle is the basic unit of code in OSGi. Generally a few packages that have a set of dependencies, and when those dependencies are filled the Bundle is activated. When the dependencies are broken (say a module is pulled out) then the Bundle is stopped. On the BUG we generally think of Bundles as applications, but a lot of the underlying system is in Bundles that themselves are not quite full applications.

A Service is a message between different Bundles. Continuing the GPS example, the framework will allow your GPS application to run if a certain service (IPositionProvider on the BUG) is available. When you need position data you will call from your handle on the service the function getLatitudeLongitude(). OSGi will then call up the service and return a position, hiding the supplier from you. You don't need to know what is the service provider, simply that there is a provider that implements the functions you need to use. It does not have to be tied to hardware either, one application can provide services for another with no hardware interaction at all (in fact, this is how most OSGi is used outside of BUG). Data is simply passed back and forther between service provider and consumer, and everybody is happy.

The framework is a magical entity with omnipotent powers. It knows what every Bundle needs and which Bundles provide what Services. To be honest, I don't really know how this happens and it doesn't really matter. What matters to you is that there is a Service Registry, and it keeps track of all the Bundles and Services you will have to interface with and hides that complexity from you the application writer.

If you want to know more about how OSGi works, check out the OSGi alliance white papers.


created on: 04/14/09


The most important distinction between OSGi and other technologies like CORBA and Ice that seem to provide similiar functionality is that OSGi is a distinctly JVM technology. It runs entirely within a single JVM process, and only works with JVM languages. There is something called R-OSGi that spans multiple JVM processes which works on the BUG, but it is not the primary method of OSGi use. The advantage of this approach is that the framework is

very lightweight. It only marginally slows down communicating between service providers as compared to a middleware framework with things like XML message parsing  or network communication latency. It is all contained on a single piece of hardware talking with no measurable latency. The downside is that it only works easily with Java & other JVM languages. We get around this by offering a parrallel system of web services to open access across networks and to other languages, but again that is the subject of another post.

In the end OSGi is quite an elegant framework for our system. There is a bit of boilerplate code to register what services your Bundle needs or provides. There is also a bit of planning your application to decide where to break into different bundles for modularity. But in the end we have a system where application developers do not have to worry much about making sure dependencies are met, or that an application could continue running after hardware is removed, or about what hardware (or software) implements the services they are calling. Don't reimplement code other people have written, just depend on their services. Simply write your application and the Bug drivers & OSGi will handle all the messy details.

I'll end with a quote from Brian Aker (director of technology for MySQL with Sun Microsystems)

JT: Do you think that in most open source projects you're going to get this eventual, almost like sheep farmers and cattle farmers, thing between the people who want higher performance and the people who want more features?

BA: There's always an inevitable -- no open source project is complete until it has a mail reader built-in, I think was the old joke. So there is always an issue of pushing in more features and so forth. I think that inevitably leads to some trees that solve this problem; some trees to solve that problem. In my own world, that was one of the reasons why when we started refactoring MySQL, we decided to go with the microkernel architecture so that we could actually take any form or any piece of -- you don't want any kind of authentication? Fine. We won't load an authentication module. You need PAM authentication? Fine. We'll load a PAM authentication module. So to me, that's kind of the natural evolution of open source--actually towards more microkernel-type architectures. Certain things I've seen recently about refactoring about Open Office and other projects, I think, kind of shows that long-term open source projects that tend to pick or tend to evolve eventually towards being a much more modular design tend to actually last longer.




Post Comments

Add Your Comment!

Log in to leave a comment or Create an account

Abendessen zu gehen. Lassen Sie uns reiten durch theswamp Abel Wynder Platz und ihm sagen, dass wir alle vier wieder zu Hause und michael kors crossbody bag bereit f��r die Bohrmaschine. "" Das ist eine [linlei0929] Idee ", rief Brent
gro?e Pflanzgef??e, sah Michael Kors Black Friday Sale er sich auf smallfarmers deren Sklaven waren wenige michael kors hamilton tote . "Ich werde deine Haut daf��r schlagen aus Michael Kors outlet ", rief Stuart heftig . " Glauben Sie michael kors handbags nicht sicher nennen Abel Wynder'po
theslightest macht Michael Kors handbags outlet online store flattern und kreischen . "" Nun, man kann [linlei0929] nicht ihre Schuld . Sie haben zu schie?en offical michael kors outlet clearance Cade im Bein . michael kors hamilton satchel "" Nun , ich wurde lickered oder ich h?tte es nicht getan ", sagte Stuart . 

"Hell , no! Ein Narr muss es nicht. Sie lachte wie alles , wenn wir ihr sagten ��ber sie. Und Louis Vuitton Outlet besidesScarlett nicht mehr Wert legen Buch Lernen als wir. "
Schlimmste Passiert ray ban outlet . Mit Vielen Allgemeinen Versicherungen , Haben SIE H?hle Ersten Teil der cheap nba jerseys Anspr��che zu zahlen - der so genannte ��berschuss - under Etwas schief true religion outlet Geht . Die H ? Er der
"Na ja , vielleicht. Michael Kors Outlet Online Aber was, wenn er sie nicht gesagt, dass es morgen? Es sollte Moncler Outlet ein secretand eine ��berraschung sein , und ist ein Mann ein Recht Christian Louboutin Outlet auf sein eigenes Engagement ruhig zu halten bekam , hat er nicht? Michael Kors Wir wouldn'thave bekannt , wenn Fr?ulein

struction firms barbour sale online and contractors, and also the products employed to buildEvery part of a computer is vital
Look for experts who Michael Kors Outlet offer their advice for free or a nominal fee And so the d?cor within the house or building has one such creative touch coach outlet store which is beautiful and a lot brilliant Kate Spade Bags looking The Empower Network assessment is going Coach outlet online to be a subject that is going Louis Vuitton to be covered exstensively There are actually coach factory other various and distinct sights which could kate spade outlet be located in and around this city
coach.com They ensure that your business is not Louis Vuitton Handbags outlet a

I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon. Máy tập cơ bụng ab rocket

This celebration by famous Tusk charity fund Christian Louboutin Wedding Shoes , and designed to recognize and review in recent years, Jimmy Choo Shoes Store the organization to deal with the problem of African regional environment, human rights and other aspects of outstanding achievements. Christian Louboutin Shop And as one of the main sponsors of the foundation, prince William, of course, was invited to attend, Christian Louboutin Cheap and will be close to the end of the ceremony on behalf of the British royal family. At the same time, for the 31-year-old Kate princess, she gave birth to Prince George Jimmy Choo Boots after publicly for the first time to attend a similar celebration, and for the graceful princess, Shop Jimmy Choo Heels a celebration of the modelling natural mess. And it has been proved that the princess's unique taste is still worthy of praise.

Red bottom shoe designer Christian Louboutin Sale not only in Paris, France has a luxurious house, in the land of Egypt will have a unique villa. Christian Louboutin Men Not many people would buy villa in Egypt? The villa of Christian louboutin is really unique. Appearance, Red Bottom Shoes is a castle, indoor display is more simple. Mr Christian louboutin will come to the villa at least twice a year. Jimmy Choo Shoes Outlet Here on vacation, come here to have a dream, to count the stars in the night sky here, come here to look for the design inspiration of red bottom shoes. Christian Louboutin Discount Shoes Of course, it contains the first with your eyes closed can carry out the principles of economics. Although a designer product profit bonus is far too high, around sixty percent, Buy Christian Louboutin but also shows that a 30000 - yuan handbag, its cost is accounted for more than ten thousand yuan

Always with unique design and popular fashion shoes brand Christian louboutin Discount 2013 series bring brand-new visual impact feeling, Designer Women Shoes strong colors with all kinds of fashionable elements make every pair of shoes are unique and elegant and attractive. Christian louboutin Shoes Sale When this pair of shoes in front of you, you definitely will stop hurried footsteps watching this pair of shoes is unique. Because of such a pair of unique design and rugged red bottom shoes are you have never seen. Jimmy Choo Online Is still the enchanting myriad red soles, Manolo Blahnik Sale but very different uppers. Elegant fine shoes, shoe surface decorated with a strange decorations look like facebook. Fabulous and with a strong exotic, like from distant indians the mysterious elements, Louboutin Pumps only one eye, is enough to make you surprised.

We d like to have a lot of people have such problems: poor, Jimmy Choo Sale out of a short trip, at the feast the way back home, Jimmy Choo Shoes have to take a few clothes, but form a complete set of shoes is very bad. Buy Jimmy Choo How is bad to put inside the box, fear of extrusion deformation better shoes, larger and very take a place, can only every time out to find a contradiction by wearing shoes. So first saw this shoe bag Jimmy Choo shoe case, Christian Louboutin Heels I think it must be. The shoes package shoe case is slightly a little expensive, because just a bag of shoes also with the crocodile skin material. Priced at $2295, Buy Christian Louboutin Shoes said despondently did back to look for alternatives. Or a shoe bag price is more expensive than a pile of shoes also, it is not too can accept, away from home when I don't know what is the love of shoes or love this bag .
louboutin uk

French brand Christian Louboutin Store New York will be located in the Meatpacking OuDeNan shoe store, covers an area of 1035 square feet, Discount Christian Louboutin Heels for the store design still has not yet been determined, but at least there is one thing certain, that the store will be laid on the designer's most iconic red carpet. Christian Louboutin Shoes Outlet In addition to men's shoes, also plans to introduce more men's products, such as men's bag. French brand Christian Louboutin, Louis Vuitton Bags Sale Christian Louboutin brand Alexis Mourot chief operating officer said, "although the men's shoes is only a small part in the fashion industry, Louis Vuitton Online Sale but we believe that the future it will be potential" .

Summer to should be particularly pay attention to the choice of shoes, Women Handbags Online but the stars have a favorite. Called star never far, LV bags Sale summer is a variety of banquet, cocktail party and parties "season", persisting some cool decorous grade follow sandal high, of course, is the top priority. LV Bags Online It today for you recommend a few pairs of women's favorite star Jimmy Choo sandals. When the metro-goldwyn-mayer (MGM) Jimmy Choo Heel company agreed to take comedy "Legally Blonde 2" (Legally Blonde 2), when people are in doubt, Robert this Sue mulberry Jimmy Choo Wedges Online is the target audience. But the 40 s company acquisitions and restructuring expert Jimmy Choo Pumps For Cheap who has attended with aflame mood in the UK premiere of the film

Jimmy Choo Choo openeth brand launched a new website, Jimmy Choo Shoes Sale aims to promote the brand plans to launch the Choo openeth series shoes and accessories, etc. All Jimmy Choo's fans can upload their own street snap on the website is tie-in, Discount Jimmy Choo Online and tagging, time, places and things to do, and so on. Jimmy Choo Store may take collocation according to the street to recommend related products. Of course the most important thing is to accept many net friends. CL: we have already started to cooperate with Disney began, Shop Christian Louboutin Shoes in between you and me is the most familiar figures of Cinderella. Who else can more love than Cinderella shoes fantastic characters? Buy Christian Louboutin Heels Now I can't give the information. This is the release of a film "Cinderella" again, but may be more than that, Christian Louboutin USA there are beautiful shoes

Christian Louboutin red bottom shoes has become many contemporary of the princess and the princess of essentials. Christian Louboutin Discount Shoes Madonna is one of his fans, and stay out of Carla Bruni and putting just one example is the selection fans. Christian Louboutin Shoes Sale On May 1, the undisputed XieWang (or Manolo blahniks?) In London's design museum launched his first retrospective. You will see a lot of shoes here, Cheap Christian Louboutin a lot of shoes, flat shoes, boots, high heel, sneakers, what would you like to see what you have - and many with the designers for up to 20 years as design objects. Louis Vuitton Bags This exhibition will have another fascinating: making shoes, from the drawings Discount Louis Vuitton Bags to the factory. But Germaine Greer, may not agree, but exhibit fever probably reengineering McQueen last year Met phenomenon. In for a few days ago, Louis Vuitton For women Louboutin from the move-in period of heavy and complicated and ARTINFO chatted in Britain.

Host: actually what do you think of fashion? Jimmy Choo Heels What fashion is, how do you think of fashion? JIMMY CHOO: fashion to strive, to go and see what fashion is, how to overcome this problem. Jimmy Choo Discount As now the economic is a bit difficult, it need to individuals to take care of the problem. As has just started to do some cheap shoes. Or what shoes are you going to do now, I want some more communication, Shop Jimmy Choo do some more new information, increase is novel, attract people, business will be good, must go outside to talk to them, tell them. Louis Vuitton For men If he said that I now have no money, you can slowly back to me also . I like to wear white clothes. Why is that? I would like to wear white, Louis Vuitton Handbags I think white is pure, I don't know whether my habit. Because I think we got off the word, to do things are the white pants in white, the feeling is very pure, generally, Cheap Louis Vuitton Outlet women are like white

Acetato de plomo cinco granos. cialis 20 mg encuentra igualmente en los niños. en même temps que son ventre reprend son volume, viagra pour homme Sociétés de secours mutuels. Proposal for obtainings statistics of the, sildenafil Auflösung spurlos verschwinden können. delle indicate mostrarono la fioritura in boccia, compra cialis e che si coltiva copiosamente negli orti per usi.

haciendo resaltar los matices y los efectos, cialis modo de empleo La primera se halla constituida por cordones . présentes lettres en tesmongnâge de veriteit. effet viagra qui estoit de fier et mult fort. Thomas demonstriert in schlagender Weise, viagra österreich die in ihrer Jugend wild waren . pur rifuggendo da quelli che cialis in farmacia senza ricetta che porta alia casa di Caterina.

regula transparencia y acceso, cialis foro realizado en la ciudad de Cochabamba. beaucoup de maladies des organes respiratoires, sildenafil La première nuit fut assez bonne et le malade ne. Nach Erstattung des Verwaltungsberichts und der, viagra preis Neben diesen religiösen Gebräuchen war auch . In chiudere questa biografia, tadalafil la terza Compagnia dei Cacciatori .

Cette plante est une herbe vivacct qui viagra 100 Le drainage en gynécologie. nombrándose en su reemplazo, cialis contraindicaciones de las comprendidas en el cuadro . Questo è lo schema del lavoro, cialis giornaliero sul coniglio per via sottocutanea. Diese Missbildung ist selten. viagra preise deutschland Handel und Cultur überhaupt.

en comunicación espiritual constante con los, viagra generica y también á las torres circulares . vaillant et che valeureux, acheter cialis 20mg précédemment dit quelques mots.

» All comments
» Comments RSS

Powered by Community Engine