On Wed, Jul 25, 2012 at 4:07 PM, Richard S. Hall <[email protected]>wrote:

> On 7/25/12 10:57 , Dan Gravell wrote:
>
>> The best way to do this sort of stuff is to create a management agent that
>>> records, deploys, and reinstates the proper state of your application
>>> after
>>> deployment operations.
>>>
>>
>> So would the agent record the current state for each bundle, stop each
>> bundle, update it, refresh, then restart?
>>
>
> Pretty much.


Ok! That works. I was a little intimidated by what you mean by 'management
agent' but after several tries I got this working... at least with my
current batch of updates. Here's what I do... I would appreciate a sanity
review.

https://gist.github.com/3177368

Some notes...

The 'resourcesToUpdateExceptUpdater' is required because the updater
bundle, where this code lives, cannot be stopped while this code works.
That's because the bundle context becomes invalid. *Edit* actually, I now
use the system bundle's context for some of this work... maybe I can use
that instead?

The 'sendUiStoppingMessageAndBlock' stuff is to instruct the UI to begin
polling for the restart of the user interface after update. The Semaphore
should return very quickly. It has to be a semaphore because the update
sent to the UI occurs in a different thread - the UI is a comet web based
UI.

Dan

Reply via email to