Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Best way to trigger the confapply command?(What is the best solution to call the confapply command automatically ?)
icon5.gif  Best way to trigger the confapply command? [message #525075] Mon, 05 April 2010 13:59
Anthony Dahanne is currently offline Anthony Dahanne
Messages: 9
Registered: March 2010
Location: Montreal
Junior Member
Hello everyone,
I already posted a thread in the p2 forum asking how to automatically install new bundles in equinox with p2 director:
http://www.eclipse.org/forums/index.php?t=msg&goto=52442 9&#msg_524429
To sum up with , I want to add IU(s) to a running equinox and to start them automatically.
Today, I' m using p2 director to install the IUs to my target equinox (in its plugins and features directories)
To start these bundles without restarting my target platform, I connect to my target platform OSGi console and type :
>confapply

Then my IUs are started, according to p2.inf instructions I gave.
But that's not enough !
I would like my target platform to do this automatically, without waiting for me to type in this command.
To solve this issue, I'm about to create a new bundle, that will check every 30 seconds if the bundles.info file changed, if so, it will call confapply using this API :

@Override
	public void start(BundleContext context) throws Exception {
		this.context=context;
		plugin = this;
		super.start(context);
		FileMonitor fileMonitor = FileMonitor.getInstance();
		FileChangeListener listener = new FileChangeListener() {
			
			public void fileChanged(String filename) {
				ServiceTracker tracker = new ServiceTracker(Activator.this.context, Configurator.class.getName(), null);
				tracker.open();
				Configurator configurator = (Configurator) tracker.getService();
				try {
					configurator.applyConfiguration();
				} catch (IOException e) {
					e.printStackTrace();
				}
				finally{
					tracker.close();
				}
			}
		};;;
		fileMonitor.addFileChangeListener(listener , BUNDLES_INFO, 30000);
	}




But I think that this new feature should be part of the Equinox project...
Is it planned to add such a functionality (bundle discoverer and confapply triggerer) into the Equinox project ?
If not, is there a reason for that ? Should I do this differently to comply with the Equinox standards ?
Thank you very much for your help,
Regards,
Anthony


Previous Topic:[p2] Power User UI for P2
Next Topic:How to modularize a JSF/Facelets/Spring application with OSGi?
Goto Forum:
  


Current Time: Thu Aug 28 11:36:13 EDT 2014

Powered by FUDForum. Page generated in 0.01770 seconds