BUG Community

Welcome! Log In

bballantine's Blog

Tracking Modules in Your BUG App

One thing you may want to do is track module insertion and removal in your BUG Application.  There are probably a couple of approaches to this.  The following solution is easy, but not obvious.  It's the same method implemented in the code running on the BUG that updates the base LCD when you insert and remove modules.

The basic idea is that you create a ServiceTracker that tracks only IModuleControl services. 

First, create the ServiceTracker.  Here's the basic class in it's entirety:

import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTrackerCustomizer; import com.buglabs.module.IModuleControl; public class BUGModuleControlServiceTracker implements ServiceTrackerCustomizer { private BundleContext context; public BUGModuleControlServiceTracker(BundleContext context) { this.context = context; } public Object addingService(ServiceReference reference) { IModuleControl module = (IModuleControl) context.getService(reference); // do something with your module System.out.println("!!!!!!!!!!!!!!!!!!! " + module.getModuleName() + " added in slot " + module.getSlotId()); return reference; } public void modifiedService(ServiceReference reference, Object service) { // this isn't important for insert or removal events } public void removedService(ServiceReference reference, Object service) { Object svc = context.getService(reference); if (svc instanceof IModuleControl) { IModuleControl mc = (IModuleControl) svc; // do something with your module System.out.println("!!!!!!!!!!!!!!!!!! Slot " + mc.getSlotId() + " cleared"); } } }

Now you need to create and use this service tracker with the right filters somewhere.  You can put this code in your BUG App's Activator.  First define the service tracker as a private class variable of the Activator so it stays alive:

private ServiceTracker moduleTracker;

Then, in the Activator's start() method:

Filter f = bundleContext.createFilter("(" + Constants.OBJECTCLASS + "=" + IModuleControl.class.getName() + ")"); moduleTracker = new ServiceTracker(bundleContext, f, new BUGModuleControlServiceTracker(bundleContext)); moduleTracker.open();

That's it.  Now your BUG Application will know when modules are inserted or removed.



Post Comments

Add Your Comment!

Log in to leave a comment or Create an account

Hut VIELE Artikel ��ber harbortouch pos und kostenlos Kassensystem in der vergangenheit . Es Dauert Eine Million discount Michael Kors purses Taten Eine Modus - Ikone f��r Millionen seins owner michael kors black Friday . Wir in der regel von H?hle TV cheap Michael Kors wallets
schnell oder deren girlsas h��bsch, und Michael Kors bags on sale ich michael kors bags wholesale wei? verdammt gut, sie haben kein Whisky, Roggen Vaters ber��hren bekam . " " Ashley Wilkes sagte, dass sie eine Menge von Landschaft und [linlei0929] Musik. Ashley
SIE sollten your Kost��me in cheap Michael Kors watches Einer Weise, dass. es Wirklich zeigt your Innere Michael Kors bags Pers ? Nlichkeit und zeigt IHNEN , ?hm Michael Kors green purse die Welt , sterben same Art , Wie cheap michael kors handbags hot sales SIE Ge

new balance outlet online

h¨¹bsch, und ich wei? verdammt gut, sie haben kein Whisky,

Michael Kors Outlet Handbags

Roggen Vaters ber¨¹hren bekam . " " Ashley Wilkes sagte,

michael kors

dass sie eine Menge von Landschaft und Musik. Ashley

gucci bags

sterben Masse Kosten senken Kann unterlassen . Und VOR Allem

Michael Kors Outlet Store

Nicht KOPIEREN your TV -Star sofort nach der Show, ?h

Michael Kors Outlet

Nicht bezeichnet einen Nachahmer zu unterlassen . Kurz ges?gt, ?hm

kate spade

theslightest macht flattern und kreischen . "" Nun, man

prada outlet

kann nicht ihre Schuld . Sie haben zu schie?en Cade

Louis Vuitton Store

im Bein . "" Nun , ich wurde lickered oder

chanel outlet online

ich h?tte es nicht getan ", sagte Stuart .

Louis Vuitton Outlet

, bis wir sie aus. Alles, was sie werden wissen,




Bludgers, get it in front of the seekers of other teams .. because've got to Quaffle, job seekers Louis Vuitton Outlet win almost always is a reason to get the dirt so much game of
the broomstick of Louis Vuitton Harry arrived, she did not talk to either. Squeaked "Now, the movement of a nice wrist which prada-outlet-onlines has been practice, please do not forget! We, the

lowly and the kate spade water pipe, which was applied to create hot water, but now produces the same normal water temperature in your tap
So if you are interested in starting a SDVOSB or have already started one, get some knowledge about Kate Spade Outlet the recent SDVOB rules eCommerce is the perfect example of how the internet has changed the world we live incom2e2afle Everyone I have ever talked to that is an entrepreneur has had to come face Louis Vuitton to face with their fears by reason of a result, it authorize help you target highly able visitors in the direction of your website
The best option would be to find a collection agency that is authorized to chanel outlet collect in the most different locales possible A risk management plan is also very beneficial in maintaining coach outlet your investment The benefit of opting for the latter instead of the former is that you can save a significant amount of money They are not tuned in to the show yet and consequently, may very well walk past the first few stands with hardly a glance so it is not a good idea to choose a stand just inside the door
kate spade outlet

Coach Outlet Online

I said,' Dad, I'm too old for a good

Coach Outlet

bye kiss.I'm too old for any kind

als heilung . Sterben Krankenversicherung Ist Die Kollektive bereitstellung Aller Gesundheits-und Auch sterben Gemeinsame nutzung von Extremen Risiko michael kors outlet Versicherungsgesellschaft . Nicht mit
Normalerweise machte sie betteln louis vuitton outlet online und flehen , w?hrend sie legte sie ab louis vuitton und weigerte sich, eine Ja-oder Nein Antwort zu michael kors outlet geben, zu lachen michael kors , wenn sie schmollte , wachsen cool, wenn sie w¨¹tend wurde . Und hier ist sie praktisch promisedthem hatte die ganze von morgen - Sitze michael kors von ihr am Grill, alle Walzer (und sie louis vuitton store

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 fitness

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

This season, you have to see people cheering their favorite NFL teams wear the same nfl jerseys louis vuitton purses as the players of this team carries for Michael Kors Outlets the game. Wearing gucci outlet the same nfl jerseys as the star player really make you standout from the crowd and pump up the spirits of the teams. This is Christian Louboutin Shoes the real concern of the fanatics. Then, if your son, gucci handbags outlet father or brother, favorite team, a jersey form know their favorite Cheap Michael Kors team is really a great gift this year. No matter what louis vuitton shop player's jersey you choose, as long as it is for this wholesale nfl jerseys team to be your loved ones happy with your gifts, and Louis Vuitton Outlet may surprise with your sports knowledge in this process. There's LV outlet really a lot of benefits to buy these

Henry looked at her in astonishment. "The kids call me aunt when I stay with her mother in Ireland, in the autumn. The three girls
already make money from the house where his brother died. Incapable of understanding this purely sentimental louisvuitton.com view of a pure question of
loves me, the Father has given me countless examples of his true friendship and respect. I nfl jerseys am the very woman for the place - and, unlike my
Business, Henry returned to his papers, in some perplexity at the michael kors sudden change in the manner of Agnes to him. Just as he found the letter of
and his wife only to agree. Louis Vuitton "She opened the desk, the desk while she spoke, took out a letter and handed it to Henry. He
Nurse came in. Michael Kors Handbags It was left to Henry to tell the old woman why the bell had called the salon. "Well, nurse," he said, gucci outlets "you have a
The shortest path might be to let you find out for yourself. You speak of my lonely life here Christian Louboutin Shoes unprotected. It is not a very
You leave? "She rose in her turn, from the sofa and went to her desk before Louis Vuitton Bags she replied

» All comments
» Comments RSS

Powered by Community Engine