Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to create a p2 repo programmatically
How to create a p2 repo programmatically [message #537131] Tue, 01 June 2010 08:33 Go to next message
Eclipse UserFriend
Hi all,

I want to create a P2 repo programmatically with my plugin. Any reference I can follow ?

Thanks..

Chathuri
Re: How to create a p2 repo programmatically [message #537144 is a reply to message #537131] Tue, 01 June 2010 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

chathuri a écrit :
> Hi all,
> I want to create a P2 repo programmatically with my plugin. Any
> reference I can follow ?

You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: How to create a p2 repo programmatically [message #537239 is a reply to message #537144] Tue, 01 June 2010 11:52 Go to previous messageGo to next message
Eclipse UserFriend
Mickael Istria wrote:
> Hi,
>
> chathuri a écrit :
>> Hi all,
>> I want to create a P2 repo programmatically with my plugin. Any
>> reference I can follow ?
>
> You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher

While the wiki doesn't show any programmatic examples, those publisher tasks
do create p2 repos, so you can go look at their source code.

The source is in cvs at dev.eclipse.org, /cvsroot/rt,
org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publis her

As a particular example the p2.publish.featuresAndBundles ant task is
implemented by the class FeaturesAndBundlesPublisherTask, which will create
a repository or append to an existing one.

Find the repo creation code at Publisher#createMetadataRepository (and
createArtifactRepository).

-Andrew
Re: How to create a p2 repo programmatically [message #537327 is a reply to message #537239] Tue, 01 June 2010 21:13 Go to previous messageGo to next message
Eclipse UserFriend
HI,

Thanks for the info. I was able to create p2 repo half way by invoking "run" method of org.eclipse.equinox.launcher.Main() class. But the problem is, it copied only the artifacts.jar and content.jar to the given location. It did nt copy "Plugins" and "Features" folders.

I will try with the org.eclipse.equinox.p2.publisher as well..

Thanks.

Chathuri.
Re: How to create a p2 repo programmatically [message #537359 is a reply to message #537239] Wed, 02 June 2010 03:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi Andrew,

>> You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher
>
> While the wiki doesn't show any programmatic examples, ...

Is this example wrong: http://wiki.eclipse.org/Equinox/p2/Publisher#Extensible_API ?

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: How to create a p2 repo programmatically [message #537514 is a reply to message #537359] Wed, 02 June 2010 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Hi Mickael,

You are correct. I was able to create a p2 repo with the example you have pointed. Only problem with that code is, in the createActions method, it does nt pick features folder. It only picks plugins folder.

public static IPublisherAction[] createActions() {
IPublisherAction[] result = new IPublisherAction[2];
File[] bundleLocations = new File[1];
bundleLocations[0] = new File("/location to bundles/");
BundlesAction bundlesAction = new BundlesAction(bundleLocations);
FeaturesAction featureAction = new FeaturesAction(bundleLocations);
result[0] = bundlesAction;
result[1] = featureAction;
return result;
}

Hope this may helpful.

Chathuri
Re: How to create a p2 repo programmatically [message #537547 is a reply to message #537359] Wed, 02 June 2010 16:01 Go to previous message
Eclipse UserFriend
Mickael Istria wrote:

> Hi Andrew,
>
>>> You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher
>>
>> While the wiki doesn't show any programmatic examples, ...
>
> Is this example wrong:
> http://wiki.eclipse.org/Equinox/p2/Publisher#Extensible_API ?
>
> --
> Mickael Istria - BonitaSoft S.A.
> http://www.bonitasoft.com/products/downloads.php

Oh sorry, you are right. I only really looked at the first half of that
page and didn't see that part at the bottom.

That example should work fine, although it does use some internals
(*RepositoryFactory), you could use Publisher#createMetadataRepository
instead of using the factory.

-Andrew
Re: How to create a p2 repo programmatically [message #605902 is a reply to message #537131] Tue, 01 June 2010 09:01 Go to previous message
Eclipse UserFriend
Hi,

chathuri a écrit :
> Hi all,
> I want to create a P2 repo programmatically with my plugin. Any
> reference I can follow ?

You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: How to create a p2 repo programmatically [message #605904 is a reply to message #537144] Tue, 01 June 2010 11:52 Go to previous message
Eclipse UserFriend
Mickael Istria wrote:
> Hi,
>
> chathuri a écrit :
>> Hi all,
>> I want to create a P2 repo programmatically with my plugin. Any
>> reference I can follow ?
>
> You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher

While the wiki doesn't show any programmatic examples, those publisher tasks
do create p2 repos, so you can go look at their source code.

The source is in cvs at dev.eclipse.org, /cvsroot/rt,
org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publis her

As a particular example the p2.publish.featuresAndBundles ant task is
implemented by the class FeaturesAndBundlesPublisherTask, which will create
a repository or append to an existing one.

Find the repo creation code at Publisher#createMetadataRepository (and
createArtifactRepository).

-Andrew
Re: How to create a p2 repo programmatically [message #605908 is a reply to message #537239] Tue, 01 June 2010 21:13 Go to previous message
Eclipse UserFriend
HI,

Thanks for the info. I was able to create p2 repo half way by invoking "run" method of org.eclipse.equinox.launcher.Main() class. But the problem is, it copied only the artifacts.jar and content.jar to the given location. It did nt copy "Plugins" and "Features" folders.

I will try with the org.eclipse.equinox.p2.publisher as well..

Thanks.

Chathuri.
Re: How to create a p2 repo programmatically [message #605914 is a reply to message #537239] Wed, 02 June 2010 03:52 Go to previous message
Eclipse UserFriend
Hi Andrew,

>> You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher
>
> While the wiki doesn't show any programmatic examples, ...

Is this example wrong: http://wiki.eclipse.org/Equinox/p2/Publisher#Extensible_API ?

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: How to create a p2 repo programmatically [message #605918 is a reply to message #537359] Wed, 02 June 2010 13:28 Go to previous message
Eclipse UserFriend
Hi Mickael,

You are correct. I was able to create a p2 repo with the example you have pointed. Only problem with that code is, in the createActions method, it does nt pick features folder. It only picks plugins folder.

public static IPublisherAction[] createActions() {
IPublisherAction[] result = new IPublisherAction[2];
File[] bundleLocations = new File[1];
bundleLocations[0] = new File("/location to bundles/");
BundlesAction bundlesAction = new BundlesAction(bundleLocations);
FeaturesAction featureAction = new FeaturesAction(bundleLocations);
result[0] = bundlesAction;
result[1] = featureAction;
return result;
}

Hope this may helpful.

Chathuri
Re: How to create a p2 repo programmatically [message #605923 is a reply to message #537359] Wed, 02 June 2010 16:01 Go to previous message
Eclipse UserFriend
Mickael Istria wrote:

> Hi Andrew,
>
>>> You should try this page: http://wiki.eclipse.org/Equinox/p2/Publisher
>>
>> While the wiki doesn't show any programmatic examples, ...
>
> Is this example wrong:
> http://wiki.eclipse.org/Equinox/p2/Publisher#Extensible_API ?
>
> --
> Mickael Istria - BonitaSoft S.A.
> http://www.bonitasoft.com/products/downloads.php

Oh sorry, you are right. I only really looked at the first half of that
page and didn't see that part at the bottom.

That example should work fine, although it does use some internals
(*RepositoryFactory), you could use Publisher#createMetadataRepository
instead of using the factory.

-Andrew
Previous Topic:Adding jars to the Common Navigator
Next Topic:Execute eclipse Key binding through java code
Goto Forum:
  


Current Time: Sat Jul 12 23:17:05 EDT 2025

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

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

Back to the top