Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] another m5 migration issue

Ciao Guys :)
Found another problem in my 3.5 migration attempt, would you please help
me find the best possible solution for this?

What I'm trying to achieve is quite simple, I'm trying to query the
QueryableMetadataRepositoryManager using 3 queries as a compound:
1.) Latest Version Query
2.) Property Query (Is group?)
3.) Layer Query

Now, that layer query is the problem. What it's trying to achieve is to
get some structure into the groups,
based on their dependencies. p2 UI has something very similar. However,
my layer query is also performing another check,
even before it looks at the layer: removing "empty" root groups.
Consider this group structure:

- Root-Group A
-- Sub-Group a
- Root Group B
- Root Group C
-- Sub Group c
---- Sub Sub Group cc

I'm trying to get rid of the empty group "Root Groub B". It's much like
getting rid of an empty category (well, a category that has a version
attached to it and is installable like your standard IU is). Removing
such empty groups was done in Collectors before, but now the right way
seems to be to have multiple queries to that's what I do. I really like
the approach by the way, it feels much cleaner:).  The problem I'm
running into is that my view is empty, and the explanation is simple: In
the first run everything goes as planned:
1.) Latest finds a LOT of IUs
2.) Property Query finds groups only: A,a,B,C,c,cc
3.) Layer Query finds layer 0 groups: A, C (it skips B because it's an
empty group)

But for some reason all the queries are performed a second time, on the
sub-group A,C:
1.) Latest finds A,C
2.) Property Query : A,C
3.) Layer Query finds layer 0 groups: (it skips A and C because they
appear to be empty groups)

I'm wondering why the queries are executed twice,the code in
CompoundQuery::query (~line 48) looks like this:
			if (!isMatchQuery) {
				// If it is not a MatchQuery then we
must query the results.
				collector = results.query(query,
collector, subMonitor.newChild(10));
			} ....

I'm pretty sure I'm doing something wrong, but running the same query
twice seems to be a performance issue if there is no good reason for it
anyway, so I might be on to something. Still, please feel free to
suggest alternative, more p2-friendly ways for achieving what I'm trying
to do.. :)

TIA,
Ciao, hh



Back to the top