[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
[p2-dev] Re: Question about artifact mirroring
 | 
After some research I concluded that there was no shrink-wrapped way of 
doing this. So I created a new class:
public class CanonicalizeRequest extends MirrorRequest {
   private IArtifactDescriptor optimizedDescriptor;
   private IArtifactDescriptor canonicalDescriptor;
   public CanonicalizeRequest(IArtifactDescriptor optimizedDescriptor, 
IArtifactDescriptor canonicalDescriptor,
           IArtifactRepository targetRepository) {
       super(canonicalDescriptor.getArtifactKey(), targetRepository, 
null, null);
       this.optimizedDescriptor = optimizedDescriptor;
       this.canonicalDescriptor = canonicalDescriptor;
       setSourceRepository(targetRepository);
   }
   public void perform(IProgressMonitor monitor) {
       setResult(transfer(canonicalDescriptor, optimizedDescriptor, 
monitor));
   }
}
The mirroring is done by first using a RawMirrorRequest on the optimized 
descriptor, and then using CanonicalizeRequest to unpack (source and 
destination both pointing to the target repo). It seems to work well. 
Perhaps something to consider as a more generic feature for a mirroring 
application?
Regards,
Thomas Hallgren
Thomas Hallgren wrote:
Let's assume that I have a remote repository that contains two 
descriptors per artifact key, one optimized (pack200) and one 
canonical. I want to mirror this repository to another that later also 
will be deployed as a remote repository. How do I create a mirror that 
contains both the optimized and the canonical files? Copying both from 
a remote location using a RawMirrorRequest doesn't seem very optimal 
and using a standard MirrorRequest will transfer the optimized version 
but only store the canonical.
What I would like the mirror request to do is:
1. Copy the optimized version over the wire.
2. Store the optimized version verbatim.
3. Recreate the canonical version from the optimized one and store 
that too.
Has this use-case been considered?
Regards,
Thomas Hallgren