Bug 192466 - [prov] [repo] MetadataRepository should not implement IQueryable
Summary: [prov] [repo] MetadataRepository should not implement IQueryable
Status: RESOLVED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Incubator (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: equinox.incubator-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 209992
Blocks:
  Show dependency tree
 
Reported: 2007-06-13 11:05 EDT by Pascal Rapicault CLA
Modified: 2007-11-19 10:50 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2007-06-13 11:05:11 EDT
The implementation of IMetadataRepository currently implements IQueryable. This forces all repository providers to implement the query API which may
not be a trivial thing. Instead IMetadataRepository that support query should adapt to IQueryable.
Comment 1 John Arthorne CLA 2007-06-13 11:49:35 EDT
IQueryable is actually trivial to implement for any instance of IMetadataRepository:

IQueryable q = new QueryableArray(repository.getInstallableUnits());

Or, if IMetadataRepository only had an iterator method:

Iterator it = repository.iterator();
IQueryable q = new CompoundIterator(new Iterator[] {it}, id, range, requirements, and);

Another option is to remove the getInstallableUnits() method from IMetadataRepository, and have only IQueryable as the API to retrieve things from the repository. The getInstallableUnits() method is equivalent to:

IQueryable.query(null, null, null, false);
Comment 2 Jeff McAffer CLA 2007-06-13 15:32:00 EDT
yeah, I'm not sure there is much in it either way.  The point here really should be that we are free to get efficient impementations of the query mechanism if repos support it.  I don't think I really intended to have the repos implement IQueryable when I first did it but was juggling a bunch of different things and it ended up that way.  So, I am not fixed on one way or another.  

There was some concern about the API flexibility impact if the repos etc implement this interface.  Then if we add a method to IQueryable the repos have to change.  
Comment 3 Pascal Rapicault CLA 2007-06-26 08:19:03 EDT
Also as we looking into this, it may be interesting to look at the repository from JSR 124 and JSR 277.
Comment 4 Susan McCourt CLA 2007-11-14 14:26:29 EST
From a UI point of view, it would be kind of nice to view profiles and repos in terms of the queryable interface.  Then my model objects can use queryables to filter views at the profile/repo level.  For remote repos (and profiles?) this would speed things up quite a bit.

An adapter would be fine with the techniques suggested by John in comment #1 as a fallback.
Comment 5 John Arthorne CLA 2007-11-19 10:50:21 EST
This bug is no longer an issue. Since clients must subclass AbstractMetadataRepository instead of implementing the interface, we can provide a default IQueryable implementation so repositories don't have to implement it. On the other hand, if we used the adapter approach, then all clients would have to add some default handling for the case where the repository didn't adapt to IQueryable.