p2 API and the b3 Aggregator, Top Eclipse Helios Feature #5

June 17, 2010 | 4 min Read

The official Helios release is less than 1 week away, and we are now into the Top 5 Features that I’m most excited about. Over the past week I’ve been highlighting some of upcoming features of the Eclipse Helios release. These features include: improvements to the Java Development Tools, Plug-in Development Environment, API Tools and the Eclipse Platform. Number 5 on my Top 10 List is: p2 API and the b3 Aggregator.

On Monday I discussed the importance of API when it comes to Eclipse projects. The p2 team has been working on the API for almost 3 years now and when Helios is released the p2 API will be official. What does this mean? It means you can build provisioning solutions around p2 without worry that the entire system will change from under you. In fact, I’ve been on both sides of the p2 fence: helping to define the API and then building the new Yoxos Launcher and Yoxos Enterprise solutions, using this technology.  If you are building a system that needs SelfUpdate, Install, Uninstall and RollBack, and you have anything more complicated than a few static dependencies, you should really consider p2.

Here are some of the API highlights:

1. Support for multiple agents: This means you can manage multiple applications using a single controller. Once you create (or acquire) the agent, you can acquire agent services for: computing provisioning plans, working with metadata, working with artifacts, performing installs, etc… We make heavy use of this in Yoxos since our systems can both update themselves and manage your Eclipse installs.

2. A new approach to Queries: Querying metadata is an essential part of any provisioning system and p2 now supports both a p2 Query Language and a simple QueryUtil class to create the most common queries.

3. Java 5 generics: No we did not just leave all the Java 1.4 people behind and finally decide to move to Java 5; but rather, p2 now uses generics and down-compiles to Java 1.4 for backwards compatibility. This is a huge step forward for all the Java 5+ developers out there.

4. The operations API: The saying “Make easy things easy and hard things possible” has been on our mind as we designed the p2 API. While p2 has a very powerful planner (award wining planner I should add), the idea of crafting provisioning plans and executing these plans on an engine in order to affect a profile, is quite frankly – complicated! Using the operations API you can easily invoke common “operations” like update this item, or install this other thing. For an idea of what’s involved, please see our help documentation.

5. Real API: You will notice that we dropped provisional from many of our package names. Feel free to browse the p2 API Java docs.

There are also a number of improvements to the API to make things more consistent.

Thanks goes out to the entire p2 team for all the hard work (and heated discussions :-)). In particular, John Arthorne, DJ Houghton, Thomas Hallgren, Susan McCourt, Daniel Le Berre, Simon Kaegi, Andrew Niefer, Henrik Lindberg, Matthew Piggott, Tom Watson and Pascal Rapicault.

In addition to the API, Steffen Pingel and Susan McCourt have worked on a new Discovery UI which can be used to provide a branded presentation of a p2 repository. Tools like Mylyn use this UI to make it easy for users to install Mylyn Connectors.

Finally, there are other projects around Eclipse.org that make working with p2 a little easier.  PDE/Build, b3 and the newly proposed Tycho project make it possible to build p2 repositories.  However, one project is the real workhorse behind the Helios release – the buckminster / b3 aggregator.  The aggregator combines repositories from various sources into a new aggregated p2 repository. The aggregator has both a UI component and can be run headless (i.e., you can aggregate p2 repositories as part of your build process). Also, you can use the aggregator to get a detailed view of what’s in a p2 repository.  For more information on this impressive tool, checkout their wiki page.

In addition to creating aggregated p2 repositories, the b3 aggregator can produce maven repositories.

Kudos for this work goes out to Thomas Hallgren, Henrik Lindberg, Filip Hrbek and Karel Brezina.

Ian Bull

Ian Bull

Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.

He leads the J2V8 project and has served on several …