p2 directory / mirror engine [message #1130681] |
Wed, 09 October 2013 20:47 |
|
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 #1131725 is a reply to message #1130844] |
Thu, 10 October 2013 19:11 |
|
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 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.01564 seconds