maven-wagon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason van Zyl <jvan...@maven.org>
Subject Re: New interfaces in Wagon
Date Wed, 31 Mar 2004 15:33:09 GMT
On Wed, 2004-03-31 at 05:42, mmaczka@interia.pl wrote:
> Jason (and others!)
> 
> I think that last version of Wagon interface
> 
> public interface Wagon
> {
>     String ROLE = Wagon.class.getName();
> 
>     void get( Artifact artifact, File destination )
>         throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
> 
>     void put( File source, Artifact artifact )
>         throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
> 
> ..
> 
> }
> 
> is bit too simple. 

Simple is good!

There are still two more things that I would like to get in as far as
transfering files directly and support for direct repository to
repository transport. I scaled them back because the tests were so
limited for what was there but they can be built back up.

> 
> What I wanted to support with Wagon is that some artifacts (sometimes metadata) like
MD5 sums, xx-snapshot-version files are fetched directly into memory so you do need to write
a dozen of files and read from them right after they were created.

This might be useful, but I don't know if it's really necessary. I think
keeping things at the file level is probably the easiest thing to
support and nabbing a file after it's transported isn't really that big
a deal.

> With Wagon's TransferListener you are able to compute MD5 sums on the fly when data is
copied. 
> So to make processing bit faster I imagined the following algorithm:
> 
> String path = "xxx";
> 
> Wagon  wagon = getWagon( ... );
> 
> MD5TransferListener md5TransferListener= new MD5TransferListener();
> 
> SHA1TransferListener sha1TransferListener= new MD5TransferListener();
> 
> wagon.addTransferListener( md5TransferListener);
> 
> wagon.addTransferListener( sha1TransferListener);
> 
> wagon.get( file, path );
> 
> String computedMd5 = mdTransferListener.getDigest();
> 
> String actualMd5 = wagon.getToString( path + ".md5"  );
> 
> // compare md5
> 
> ...
> 
> String computedSha1 = sha1TransferListener.getDigest();
> 
> String actualSha1 = wagon.getToString( path + ".sh1"  );
> 
> // compare sha1
> 
> ...
> 
> 
> It will be way faster (number of disk IO operations is much smaller)

Possibly, but I really don't think the added complication of pulling the
artifact into memory first. But again, I didn't see much testing for
this. I scaled everything back to what I could test.

> 
> Other example:
> When we are searching for the latest version of the snapshot artifact,
> we need to fetch from all visible repositories xx.artifact-version file
> and find that repository whic contains the latest version of the given snapshot and compare
it with the local version.
> This file is quite small but still we don't want to save dozen of such files
> to disk (finding unique name for each) and then read from them and delete them right
after we are done with each of them.

I don't see what the big deal is, so we save a bunch of files to disk
first. But the API can be expanded out again and the first client Wagon
will be fully integrated into will be Maven. Let me wire Wagon in
completely to Maven and see what happens.

> My implementation of Wagon introduced 2 key interfaces: Wagon and Repository.
> 
> I imagined theat simplification of usage of the API will be implemented one level higher
than that.
> 
> I was actually thinking about something like:
> 
> class ArtifactRepository
> {
>      
>      WagonFactory wagonFactory;
> 
>      Repository  repository
>      
>      File  getToFile( Artifact artifat ) throws ....;
> 
>      String  getToString( Artifact artifat ); 
>      
>      /**
>       * Controls if md5 checksum are computed and verified
>       * during "get" operation and md5 checkusum are automatically
>       * computed and transfered
>       * to the repository during "put" operation (this means 2 calls to  
>       * wagon.put are made - one for artifact second for md5sum
>       */
>      void useMd5s( boolean value);
> 
>      void useSha1s( boolean value );
>      
>      ...
> 
> }

I don't think mixing verification into the actual artifact is a good
idea and there is no notion of searching in Wagon but we could add that.

> etc. So users will even don't have to know that wagon exists. 
> 
> 
> I think that last changes in the API over simplified it and excluded some nice possibilties
while the simplicity level for the end user is still not optimal. 

I'm going to go from end-to-end today with integrating Wagon into Maven
so I'll be the first to tell you. But again, there were barely any tests
for anything so I went to town. I also believe the Wagon interface is a
balance between simplicity and functionality. It's easy to make simple
stream based wagons and the interface in the WagonManager/Conducter will
eventually be. Let me do the round trip with integrating Wagon into
Maven first.

> 
> regards
> 
> Michal
> 
> 
> 
> 
>  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wagon-dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: wagon-dev-help@maven.apache.org

-- 
jvz.

Jason van Zyl
jason@maven.org
http://maven.apache.org

happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...

 -- Thoreau 


---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-dev-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-dev-help@maven.apache.org


Mime
View raw message