Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 100491

Summary: [prov] manifest flag to "execute on startup"
Product: [Eclipse Project] Equinox Reporter: David Williams <david_williams>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: pascal
Version: 3.4   
Target Milestone: 3.4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 93219    

Description David Williams CLA 2005-06-16 18:27:21 EDT
This feature request is for something similar to the "early startup" extension
in plugins, but is not really capable of being "turned off" by user. 
I know you must cringe when you read that, but here's the use case, suggestions
welcome. 

We'd like to have some "internet proxy" preference settings a user can set (or
un-set). When they do this from the preference page, we of course make them
effective when they hit "ok". 

But, since these are basically "VM property settings" they should be in effect
from the beginnging, the next time they startup. 

So ... the way we currently solve this is to use the "early activation" startup
extension, but this is not ideal, since 1) not really "from the beginning" and
2) it does not conceputally make sense to allow user to "turn off" the function
from the startup preferences (though they still could from the internet proxy
preferences). 

I realize there's some danger of this sort of "execute" method being abused, but 
don't know how else to allow the functionality of this use-case. Thanks.
Comment 1 Jeff McAffer CLA 2005-06-16 21:58:40 EDT
Dare I answer with ideas...  Oh ok.

There is the osgi.bundles list in config.ini. There you can spec plugins that 
are run on startup (see the comment in the file for details).  If you really 
were going to do something like this then I would suggest some dedicated 
plugin that manages such properties and then setting/unsetting them 
effectively registers/deregisters the values appropriately.

Note also that if you are talking about setting system properties then these 
too can just be set in the config.ini. this file is loaded at runtime and the 
contained properties put in the system properties list.
Comment 2 Thomas Watson CLA 2005-06-17 09:04:30 EDT
Jeff mentions the osgi.bundles list in the config.ini.  This will work well if 
you have control over the config.ini that is shipped with a product.  But I 
can imagine in some cases you may be installing your plugins into an existing 
product for which you do not have control over the the config.ini.

In this case you can conceptually do the same thing that Jeff suggests by 
using the OSGi StartLevel service instead of the osgi.bundles list.  This 
solution would use two plugins.

- A "preference setting" bundle would provide the preference page for setting 
the values.  When the user first sets any settings on the preference page this 
bundle would find the "initial startup" bundle and set its start level to the 
appropriate level (if the "initial startup" bundle does not require 
core.runtime then you can set the startlevel to 1 which is the earliest 
possible start level).  After you set the start level of the "initial startup" 
bundle then you should start it.

- An "initial startup" bundle would read whatever settings you set and act 
appropriately when it is started.  This bundle must NOT have the 
"Eclipse-AutoStart: true" header in its bundle manifest.  This will allow it 
to be persistently started on next launch.  On each launch this bundle will 
get started very early and can read your settings and act accordingly.
Comment 3 Jeff McAffer CLA 2005-06-17 09:16:28 EDT
yup. that's a good approach.  One challenge is how the bundle is started (ie., 
where/when is Bundle.start() called).  Assuming the initial install case is 
handled, what about -clean or updates?  Despite our moral resistance to this 
kind of thing, we should consider possibilities for managing this and other 
scenarios.
Comment 4 Thomas Watson CLA 2006-04-10 15:45:33 EDT
A similar discussion has been going on in the equinox-dev mailing list.  We should investigate if there is something we can do in 3.3.
Comment 5 Thomas Watson CLA 2007-03-21 14:59:59 EDT
This is not going to be done in 3.3.  Maybe the new provisioning story will come to the rescue and allow us to configure bundles to be persistently started easily.
Comment 6 David Williams CLA 2007-03-21 16:37:29 EDT
(In reply to comment #5)
> This is not going to be done in 3.3.  Maybe the new provisioning story will
> come to the rescue and allow us to configure bundles to be persistently started
> easily.
> 

Which came first, the chicken or the egg? ... :) 
If that provisioning needs to use a proxy server, getting those preferences to take effect at the right moment may be more important than ever! 
Thanks for considering (and everyone's comments). 
Comment 7 Pascal Rapicault CLA 2008-06-23 10:55:52 EDT
p2 allows to associate a start level with a bundle and also to mark it started. I don't think much else is needed here from the initial requirements.
Also we have touchpoint actions to add vm args and program args.