Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » p2 directory / mirror engine
p2 directory / mirror engine [message #1130681] Wed, 09 October 2013 20:47 Go to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 304
Registered: July 2009
Location: Germany
Senior Member
Hi,

I want to run both director application and mirror application of p2 in commandline.
I want to implement a commandline application without the whole eclipse stuff to run a p2 director and mirror application.

If I'd create an eclipse product with a headless plugin in it, eclipse generates some os dependend runners. So i think I have to export a product for every os. But that's not what I want.
I want to have one app for all platforms to keep it simple so I thought it would be nice to have a simple java main-method application. May also be an eclipse runtime but without this platform dependend stuff (if this is possible).

Does this work? What do I need?
Or do you have another suggestion to solve my problem?

After googling some times, I try it in the following way:

FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator().next();
Map<String, String> config = new HashMap<String, String>();
config.put(Constants.FRAMEWORK_STORAGE, "/tmp/hallo" + System.currentTimeMillis());
config.put(Constants.ACTIVATION_LAZY, "true");
config.put(Constants.FRAMEWORK_STORAGE_CLEAN, "true");
config.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.osgi.service.cm");


Framework framework = frameworkFactory.newFramework(config);
framework.start();
BundleContext context = framework.getBundleContext();

.... than install all my bundles, that I need 

.... and then start them 

ServiceReference providerRef = framework.getBundleContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
if (providerRef == null) {
throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$
}
IProvisioningAgentProvider provider = (IProvisioningAgentProvider) context.getService(providerRef);
if (provider == null) {
throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$
}


But my problem is, that there seems to be no service of type IProvisioningAgentProvider.SERVICE_NAME available since providerRef == null

Can you please give me a hint if I'm on the right way and how this service is started, so I can get a reference?
Do you have some example code how to start p2 apps from commandline?

Thanks a lot


Best regards
Markus

[Updated on: Wed, 09 October 2013 20:48]

Report message to a moderator

Re: p2 directory / mirror engine [message #1130844 is a reply to message #1130681] Thu, 10 October 2013 00:57 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
The simplest way to go about this is to grab a platform or SDK download and start eclipse with the following command line:
java -jar plugins\org.eclipse.equinox.launcher_<someVersion>.jar -application org.eclipse.equinox.p2.director ....

The platform download will contain some platform specific bundles, but this is not an issue since p2 don't need those.

If you don't like the fact that your distribution contains platform specific bundles, then you can build your own RCP app that includes the necessary p2 bundles (though i don't think there is a way to avoid the executable on the product editor) and start the application using the same command line than previously mentioned or by shipping a shell script.

I can't find it at the moment, but there has been recent interest in having p2 provide a standalon director app.

HTH
Re: p2 directory / mirror engine [message #1131725 is a reply to message #1130844] Thu, 10 October 2013 19:11 Go to previous messageGo to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 304
Registered: July 2009
Location: Germany
Senior Member
Hi Pascal,

thank you for your answer...
sorry, I was not exact in my describtions...

I want to implement a commandline app that builds and preconfigures my eclipse distributions.
One step is mirroring updatesites and installing features from remote updatesites or mirror into these
distributions. it's a quite similar workflow what yoxos does, I guess.

These should be done headless, for example in my ciServer hudson. And to handle this I could have a headless application, which initializes equinox, I think. But I want to integrate this in different buildsystems like maven, gradle, ant and so a very easy commandline solution would be very nice.

The best way would be
 java -jar mysuperapp.jar [PARAMETER]

Is this possible? Doesn't tycho have a similar usecase? Do you know how they initialize all things?

Hope I could give you a better view what is my usecase.

Cheers
Markus

[Updated on: Sat, 12 October 2013 06:25]

Report message to a moderator

Re: p2 directory / mirror engine [message #1145947 is a reply to message #1130844] Sat, 19 October 2013 22:22 Go to previous messageGo to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 304
Registered: July 2009
Location: Germany
Senior Member
Hi Pascal,

I'm not really famiiliar with OSGI and equinox yet. Can you please tell me the cleanest way to get the osgi runtime downloaded automatically? I am running in a an gradle context and want to write a a gradle-plugin to build my eclipse based things. Do you know how tycho does this bootstrapping?

Would be nice if you could give me a hint

Cheers
Markus
Re: p2 directory / mirror engine [message #1209770 is a reply to message #1130844] Mon, 25 November 2013 17:49 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 10/10/2013 02:57, Pascal Rapicault wrote:
>
> I can't find it at the moment, but there has been recent interest in
> having p2 provide a standalon director app.

you mean this one?

http://www.eclipse.org/downloads/download.php?file=/tools/buckminster/products/director_latest.zip


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:Triggering an Uninstallation of a Feature While Installing Another Feature via Touchpoint Actions
Next Topic:Give me some references or advice about how to build and publish a p2 update site
Goto Forum:
  


Current Time: Tue Mar 19 07:40:50 GMT 2024

Powered by FUDForum. Page generated in 0.01564 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top