Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 301900

Summary: SimpleArtifactRepository.setProperty() breaks agent contract
Product: [Eclipse Project] Equinox Reporter: Thomas Hallgren <thomas>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, eclipse, irbull
Version: 3.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 299987    

Description Thomas Hallgren CLA 2010-02-04 18:14:32 EST
The SimpleArtifactRepository.setProperty() method contains the following code:

 //force repository manager to reload this repository because it caches properties
 ArtifactRepositoryManager manager = (ArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
 if (manager.removeRepository(getLocation()))
    manager.addRepository(this);

I.e. it obtains the ArtifactRepositoryManager wihtout going through an agent. I'm not sure how to fix this since it's rather difficult to get hold of the correct agent at that point in the code. I see three options:

1. The code is rewritten so that the manager doesn't need to be involved in the setProperty operation.
2. The API is changed so that the agent is passed as a parameter to the setProperty call.
3. A field is added to the SimpleArtifactRepository so that it remembers which agent it was that created it.

Which one is best?
Comment 1 Andrew Niefer CLA 2010-02-05 09:20:08 EST
See bug 296280 where the CompositeArtifactRepository required the manager as well.
There we we added a field and passed the manager in on the constructor.  

We can perhaps pull that field up into AbstractArtifactRepository.

We should also do a quick review of all the other implementations we have of IArtifactRepository to make sure no others have the same problem.
Comment 2 Thomas Hallgren CLA 2010-02-05 17:10:40 EST
Fixed as part of bug 299987.