Bug 254652 - [api][repo] Work out IArtifactRepository/IArtifactDescriptor api
Summary: [api][repo] Work out IArtifactRepository/IArtifactDescriptor api
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Andrew Niefer CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2008-11-07 16:05 EST by Andrew Niefer CLA
Modified: 2010-03-04 15:51 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 Andrew Niefer CLA 2008-11-07 16:05:43 EST
Coming out of bug 249035.

With ArtifactDescriptors storing an MD5 sum for the artifact, it is important for the descriptor to match the actual file.  This is managed via the ArtifactDescriptor equals and hashCode, and the implementation of these methods depends on the Repository's implementation of IArtifactRepository#getOutputStream.

Therefore, ArtifactDescriptor should not be API.  Any implementor of IArtifactRepository should also implement an IArtifactDescriptor.  Adding a method IArtifactRepository#createArtifactDescriptor(IArtifactKey) would be useful.

And move ArtifactDescriptor to org.eclipse.equinox.internal.p2.artifact.repository.simple
Comment 1 Andrew Niefer CLA 2009-10-19 15:52:32 EDT
Making ArtifactDescriptor not API turns out to be a large change.

The new proposal is IArtifactDescript#equals and #hashcode will be defined as API.
This makes the implementation of these methods independent of the repository implementations.  Repository implementations will need to account for this.

The proposed implentation uses the artifact key (id & version), the processing steps, and the format property (IArtifactDescriptor.FORMAT).


The existing implementation also considers the ArtifactDescriptor.ARTIFACT_REFERENCE property.  We will need to review the use of this when removing it from the equals & hashCode.
Comment 2 Pascal Rapicault CLA 2009-10-20 13:22:23 EDT
I think IArtifactKey may have the same problem and its implementation class is not API.
Comment 3 Andrew Niefer CLA 2009-11-03 15:31:53 EST
I have gone ahead and added
IArtifactRepository#createArtifactDescriptor
to help with publishing in the case when the person publishing needs to set repo specific items on the descriptor, as an example, RepositoryListener sets repository properties for artifact references.
Comment 4 Andrew Niefer CLA 2010-03-04 15:51:15 EST
I think this is done.  Anything else can go in bug 293340