Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 275800 - It is impossible to mirror repository references.
Summary: It is impossible to mirror repository references.
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 275740
  Show dependency tree
 
Reported: 2009-05-12 03:03 EDT by Thomas Hallgren CLA
Modified: 2010-03-02 16:10 EST (History)
2 users (show)

See Also:


Attachments
Patch that introduces better API for repository references (103.69 KB, patch)
2010-02-08 12:03 EST, Thomas Hallgren CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hallgren CLA 2009-05-12 03:03:47 EDT
The list of referenced repositories that is maintained by the IMetadataRepository is not accessible and hence, not possible to mirror.

The LocalMetatadaRepository has the method publishRepositoryReferences(). It will send events on the IProvisioningEventBus. This is not what you want in a mirroring scenario since you want full control over the process and you want to view the involved repositories as something generic.

I need a new method, IMetadataRepository.getReferences() that returns the references known by a repository. AFAICS, the following changes are necessary:

1. The URLMetadataRepository must cache the references too. Not just the units
2. The CompositeMetadataRepository must return the (unique) sum of the references contained in all its children
3. The private method LocalMetadataRepository.createRepositoriesSnapshot() is made public and renamed to getReferences()
Comment 1 Thomas Hallgren CLA 2009-05-12 03:06:00 EDT
I can provide a patch for this but I need input before I proceed. Is this what we need? Any chance to get this in before RC1? If not, any other suggestions on how to solve bug 275740?
Comment 2 John Arthorne CLA 2009-05-12 10:32:28 EDT
I don't see a problem with adding this. We only didn't add API for this before because we didn't have a need for it. I am curious if adding a listener to the event bus for DISCOVERY events would work as a short term fix, but that's definitely not a long term answer.

Note some mirror users definitely don't want references to be propagated (for example people creating a locked down corporate mirror). I think if support for this was added to the mirror application, it would have to be enabled explicitly via an argument.
Comment 3 Henrik Lindberg CLA 2009-05-12 14:22:52 EDT
(In reply to comment #2)
> Note some mirror users definitely don't want references to be propagated (for
> example people creating a locked down corporate mirror). I think if support for
> this was added to the mirror application, it would have to be enabled
> explicitly via an argument.
>
They would probably benefit from being able to specify a fileter - *.eclipse.org would probaby be ok, but not *.warez.net.


Comment 4 Thomas Hallgren CLA 2009-06-11 23:41:13 EDT
(In reply to comment #2)
> I am curious if adding a listener to the event bus for DISCOVERY events
> would work as a short term fix
>
The answer is no. It doesn't work since the event doesn't propagate the RepositoryReference.Nickname. The Options isn't propagated fully either.

My workaround right now is to use reflection to access the private method LocalMetadataRepository.createRepositoriesSnapshot(). That works.
Comment 5 Thomas Hallgren CLA 2010-02-08 12:03:29 EST
Created attachment 158489 [details]
Patch that introduces better API for repository references

This patch does the following:

1. Introduces an IRepositoryReference interface.
2. Changes the method addReference(four parameters) to a method that takes a collection of IRepositoryReference. This is because the repository needs to be saved once the references are added and it's better to do that once for all references then once for each reference.
3. Adds a getReferences() method.
4. Adds a -references flag to the mirror application to enable mirroring of references.
5. Adds a test that references are mirrored properly.

This patch also contains a fix for bug 302134.
Comment 6 Thomas Hallgren CLA 2010-03-02 09:29:48 EST
Would anyone object to that I apply this patch? It makes the repository references API.
Comment 7 John Arthorne CLA 2010-03-02 10:27:06 EST
It looks fine to me. My only suggestion is to put IRepositoryReference in the package org.eclipse.equinox.p2.repository rather than in the metadata repository package. Although only metadata repositories use this concept currently, there is nothing inherently specific to metadata repositories about repository references, and we could conceivably add a notion of references to artifact repositories in the future (or even other repository types).
Comment 8 Thomas Hallgren CLA 2010-03-02 16:10:17 EST
I committed this with John's proposed change.