Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » How to validate an upgrade before installation(How to validate an upgrade before installation)
How to validate an upgrade before installation [message #933748] Fri, 05 October 2012 05:56 Go to next message
Martin Wiklander is currently offline Martin Wiklander
Messages: 3
Registered: October 2012
Junior Member
We have an eclipse feature that is licensed and the license is handled by our own code. The user can go in on our update-site and upgrade his feature. The problem we face is when the user's license needs to be updated before he can use the new upgrade.

What I want to do is to validate the feature version against the users license and warn the user that his license needs to be updated before he install.

I thought I would do this using a custom eclipse p2 touchPoint action validateLicense

Example:
My code is called, where I validate the version against the user's license. If it fails I warn the user and he can then cancel the installation.

So my first question is:
Do I get this right, or is it some other way to do this?


My second question is pretty basic:
Where do I tell eclipse to run my code? I have looked at the help But I don't understan where to pu the code or config so that my code get executed. Is it in the feature.xml?

Lastly:
Is there an example how to create and use p2 touchPonts?

[Updated on: Fri, 05 October 2012 08:28]

Report message to a moderator

Re: How to validate an upgrade before installation [message #960092 is a reply to message #933748] Sat, 27 October 2012 02:54 Go to previous messageGo to next message
Peter Severin is currently offline Peter Severin
Messages: 19
Registered: July 2009
Junior Member
Martin, where you able to progress on this issue? I have a similar
demand for WireframeSketcher plugin and I was wondering whether p2
actions are the way to go.

As for where to put your configuration, I think you just need to add a
p2.inf file as described here:
http://wiki.eclipse.org/Equinox/p2/Customizing_Metadata

This configuration will be added to content.xml in your update site.

As for custom action code this is all I could find:
http://stackoverflow.com/questions/6154367/a-working-example-of-custom-p2-provisioning-action

Another place to look are probably p2 actions in
org.eclipse.equinox.p2.touchpoint.eclipse project.
Re: How to validate an upgrade before installation [message #983332 is a reply to message #960092] Tue, 13 November 2012 16:26 Go to previous messageGo to next message
Martin Wiklander is currently offline Martin Wiklander
Messages: 3
Registered: October 2012
Junior Member
Hi,

Thanks for your response. I have also found your links but I didn't really managed anything. I actually got an answer from Ian Bull suggesting me to use an Installable Unit (IU) (or Eclipse Feature) to representing the license. But that doesn't help me because I need to execute code during installation.

Same question at stack overflow with an answer from Ian bull: Sorry I can't add a link because of the 5 messages rule. But search for: "How to validate an upgrade before installation"


Re: How to validate an upgrade before installation [message #986125 is a reply to message #983332] Mon, 19 November 2012 00:27 Go to previous message
Peter Severin is currently offline Peter Severin
Messages: 19
Registered: July 2009
Junior Member
Martin,

I followed the steps from StackOverflow link
(http://stackoverflow.com/questions/6154367/a-working-example-of-custom-p2-provisioning-action)
and I have a system that seems to work.

I left out "touchpoint" extension as it's unnecessary in my case, but
the rest is the same.

My action is executed during install phase (instructions.install) but
maybe configure phase could work too. Collect phase did not work. I put
it in p2.inf in my feature.

The action is executed during installation process, after the download
was already performed. Ideally it would be before the download but it's
not a big issue for me. Returning an error status from the action
cancels the install. It leaves some downloaded files around but they do
not get activated and are probably removed later by p2's garbage collector.

I also managed to do some more interesting things. My actions plugin has
a dependency (optional and non-greedy) on my host plugin. So the install
works like this:
* Actions plugin is downloaded
* My action is executed
* The action detects whether my host plugin is already installed and if
yes, it calls into it to retrieve licensing info. The host plugin has to
expose an API for the action. Action checks host plugin's version to
detect whether the API is there or not.
* The action now can decide whether to proceed or cancel the install. It
can even interact with the user using Display#syncExec (this is what the
code in checkTrust phase does so I think it's safe). If needed, the
action could also detect whether the install is headless.

Some gotchas:

* Action must be versioned. I just replace 1.0.0 with the same version
my plugin has. This way the latest version of the action plugin is
always downloaded before being executed. This is great because now any
problem with action code can be fixed and update/install retried.
* Actions API changed between Eclipse 3.5 and 3.6. I will probably drop
support for 3.5 as it's pretty old anyway.

I still need to test how this works with different versions of Eclipse
and other IDEs. I saw a strange (non-blocking) error with 3.6. However
the results are promising and it looks like the system might actually work.

I hope this helps you.


Best regards,

Peter
Previous Topic:artifacts.xml documentation?
Next Topic:different behaviors when mirroring a p2 repository
Goto Forum:
  


Current Time: Thu Aug 21 14:07:41 EDT 2014

Powered by FUDForum. Page generated in 0.01524 seconds