Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » B3 » Heads up on Filters in p2 api
Heads up on Filters in p2 api [message #603385] Fri, 12 March 2010 13:10
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3229
Registered: July 2009
Senior Member
The p2 API for IInstallableUnit.getFilter() and IRequirement.getFilter() has changed in the last milestone. I think this
has some impact on the aggregator code.

The new API returns an IMatchExpression that will be evaluated against a context IU. This IU holds the properties that
prior to this change was passed in a Dictionary when evaluating the OSGi filter. Here's some sample code that tests a
filter:

HashMap<String, String> env = new HashMap<String, String>();
env.put("osgi.os", "linux");
env.put("osgi.ws", "gtk");
env.put("osgi.arch", "x86");
IInstallableUnit envIU = InstallableUnit.contextIU(env);

if(requirement.getFilter().isMatch(envIU)) {
// The filter matches the environment
}

HTH,
- thomas
Previous Topic:select-switch in repo config
Next Topic:Heads up on Filters in p2 api
Goto Forum:
  


Current Time: Sat Nov 22 17:58:40 GMT 2014

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

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