On 05/09/2008, at 7:00 AM, Oleg Gusakov wrote:

I tried to create mercury-based wagon provider and got overwhelmed with Wagon's strange architecture decisions and APIs.

Yeah, as James said, it kind of grew with Maven (refactoring of Maven 1.x artifact code and an aborted pre-m2 attempt I believe) and the user facing API is not great at all.



First of all - inheriting from AbstractWagon and implementing required methods took 20 min - excellent! The rest two days (are still being) spent trying to understand:

- wagon-tests - I assume it's integration tests every provider has to pass?

More or less, but not that well separated from the implementation itself.



- why do tests requite provider to fire events, especially TRANSFER event? What happens when provider has much higher up APIs and does not control the transfer process? What if provider does not want to share events - why mandate them by the tests ??

This one of those things that is tied in too closely, and I added more to really confirm the current behaviour is retained rather than thinking about it from first principles.

I don't think the tests check anything more than at least one transfer event at the end for the total transferred (Which Maven uses for it's progress counter).



- why tests rely on the Resource object, while it's not manipulated anywhere in the APIs? Necessity to create on per each put or get represents an object leak for me. Especially highly artificial sequence of populating this object with data - set content length before Initiated event and tests fail.

No disagreement here, this is a poor abstraction.



- what is the exact combination of Resource manipulation in the get operation? I tried several and am still missing what should be filled in when: resource (local file, I assume?) is empty when firing getInitialized(), but tests fail, saying they expected resource with a content length and timestamp. ... any help is greatly appreciated!

I tried to make them consistent in the last release such that if the remote server supports it, they should set length and modified between initiated and started events.

If you are not inheriting StreamWagon, I'd suggest grabbing that and retaining the same boilerplate.



- where did getFileList() come from?? HTTP provider, for example, cannot do it without scrapping a page, and if repository has different indexing formats/options - it will not work. And tests fail I don't implement one. After all - this is why maven- metadata.xml exists!

- where did resourceExists() come from? In HTTP provider it is not possible without a try-and-fail cycle, which slows everything down - bad choice. This is why maven-metadata.xml exists!

- why such fascination with getIfNewer() in the APIs? This notion is external to a dumb http server and the suggested unix-like timestamp may yield wrong results by as much as 24 hours, depending on the server and client locations. This is why we use UTC timestamps in the metadata files .. and that is why metadata files exist :)

Wagon wasn't designed to take maven-metadata.xml into consideration (it predates the creation of metadata in the repository by some time), it's outside of maven-artifact.

- Brett

--
Brett Porter
[EMAIL PROTECTED]
http://blogs.exist.com/bporter/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to