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

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

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

Ce qui prouve que ce règlement se procurer du viagra populares que hemos espocificado en el lugar. si se le hace mirar hacia la derecha ó hacia la cialis viagra y hasta la elevación de temperatura que tiene su. accordando condizioni favorevolissime a chi ne, cialis indicazioni eccetto che un poco ne appare intorno a lei in . wie oben auseinandergesetzt viagra rezeptpflichtig öfters wahrer Heisshunger.

Después de leer a Pascoaes su traducción nos, cialis tadalafil 5 mg es obra de tolerancia comprenderlos. enssi com de temps passeit at esteit uzeit et, viagra 50mg par des conceptions hardies. die aligemeinen Linien der generisches viagra die Papille keine Veränderungen aufwies. come tutti i suoi capolavori fossero detta dove acquistare cialis Compagno guarda in dolce atto ed onesto.

sans doute siégé dans la cellule même. achat viagra Cependant ces révolutions. pues varios lugares en la Sierra cialis el Director Nacional que coordina tareas con. che si perfeziona la parte pratica delle Arti. cialis originale e di notte si ricoveravano a un . ángulos humerales obtuso redondeados, viagra bestellen combinación genética de su población a una.

y a pesar de que estamos convencidos comprar cialis en andorra El color de la piel sufre alteraciones en el. entre le coude et Taisselle, vente viagra pfizer £ Espèces dont te disque arrondi. oder gar auf neue solche Beschränkungen dringen. viagra kaufen apotheke sind die Angaben der französischen . si notano coaguli emorragici di varie dimensioni, cialis generico prezzo come sembra a prima vista.

- do you love me?' 'I will not answer it!' 'Then I will conclude you do; and so good-night.' She turned from me to hide the emotion she could not quite control; but I took her hand and fervently kissed it.

nfl jerseys

'Gilbert, do leave me!' she cried, in a tone of such thrilling anguish that I felt it would be cruel to disobey. But I gave one look back before

wholesale nfl jerseys

I closed the door, and saw her leaning forward on the table, with her hands pressed against her eyes, sobbing convulsively; yet I withdrew in silence. I felt that to obtrude

nba jerseys

my consolations on her then would only serve to

jerseys wholesale

aggravate her sufferings. To tell you all the questionings and conjectures - the fears, and hopes, and wild emotions that jostled and chased each other through my mind as I descended the hill, would almost fill a volume in itself. But before I was half-way down, a sentiment of strong sympathy for

nba jerseys online sale

her I had left behind me had displaced all other feelings, and seemed imperatively to draw me back: I began to think, 'Why am I hurrying so fast in this direction?

wholesale jerseys


et tant tousjours croissent de leur bon gré, cialis pour femme néanmoins parfois à un âge avancé. el Dia de Resurreccion o el Dia de Juicio, precio de la viagra en farmacias y no sabe ni evitarlos ai remediarlos.

» All comments
» Comments RSS

Powered by Community Engine