Yea we’re in a transitional phase where Karaf is embedded within a non-OSGI 
environment. It would be very useful for this outside application to know when 
Karaf is fully started as I described. I guess we’ll continue employing the 
loop/sleep code for now.

We may need to revisit this soon though. I can customize Apache FileInstall to 
send an Event when it’s completed one directory scan. Is there anything 
available to me on the Karaf-side to know when the features list has been 
processed?

Thanks,
-Nick

From: Achim Nierbeck <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Wednesday, December 10, 2014 at 4:27 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: How to execute code after bundles started by Felix FileInstall?

Hmm, sorry to say this, but this seems like a flaw in design here.
As all in Karaf/OSGi is a service which might be there or might not be there you
never know if "everything" is loaded. If your application needs certain 
"dependencies" to be available
make sure your application is depending on other services. That's the 
modularity level you want to go.
Start levels are only there to help a bit with this scenario during the startup 
phase of the container as some
services should/could be available a bit more earlier, like a logging service. 
So all other services can profit from it.

Another way of "watching" or waiting for other Bundles is to use BundleTrackers 
or Extenders.

Regards, Achim



2014-12-10 21:29 GMT+01:00 Nick Baker 
<[email protected]<mailto:[email protected]>>:
We have a similar requirement which I¹m sad to say is being worked around
with wait code. We can¹t know the list of bundles/features which will be
deployed and required ahead of time. Our ETL application runs
transformations after startup which may contain steps provided by plugins
(deployed as bundles). When can the application be certain that the Karaf
environment is fully initialized, all features have been installed and
FileInstall has done a pass over the configured directories? Today if the
step component isn¹t available we loop/wait for a configurable timeout
then fail if it hasn¹t become available.

-Nick


On 12/10/14, 2:50 PM, "Jean-Baptiste Onofré" 
<[email protected]<mailto:[email protected]>> wrote:

>You can implement a BundleListener to catch when the bundle is
>installed/started and do some code.
>
>Regards
>JB
>
>On 12/10/2014 08:20 PM, thully wrote:
>> Our project (Cytoscape) utilizes Karaf for OSGi bundle loading and
>> management. We are using Felix FileInstall to load additional bundles
>> ("apps") installed by users. As it stands, the bundles loaded by Felix
>> FileInstall load after all other bundles. While this is generally what
>>we
>> want, we do have some code that we'd like to trigger after the bundles
>> loaded by FileInstall have started - or at least after an attempt has
>>been
>> made to start them.
>>
>> Is there a way to do this? It doesn't seem like Felix FileInstall has
>>much
>> of an API to speak of, though it seems this may be possible by using
>>Karaf
>> runlevels - particularly with the ability to respect load order on
>>3.0.2.
>> If not, it seems like we may need to move away from Felix FileInstall
>>and
>> write our own bundle installation mechanism...
>>
>>
>>
>> --
>> View this message in context:
>>http://karaf.922171.n3.nabble.com/How-to-execute-code-after-bundles-start
>>ed-by-Felix-FileInstall-tp4037120.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>
>--
>Jean-Baptiste Onofré
>[email protected]<mailto:[email protected]>
>http://blog.nanthrax.net
>Talend - http://www.talend.com




--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & 
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Reply via email to