Heads up on Filters in p2 api [message #603385] |
Fri, 12 March 2010 13:10 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03313 seconds