Community
Participate
Working Groups
It would be nice to validate a repo URL before trying to load the repo. As it is, loading a repo is potentially so slow, that I don't want to try to do it as part of the validation sequence. (See bug #204184)
I'm not sure of this one, because I don't know what kind of validation we can do without loading contents from the URL. We can attempt an openStream on the URL to see if there is anything there, but it doesn't provide much certainty that the repository is valid.
The majority of times this fails for a user, it's a mistyped/pasted URL. So knowing that nothing is there is the main case. Beyond that, I think it's reasonable to have to go through the load sequence to find out about bad content.
I'm going to take this one. For the extension location scenario, we need to know if a repo manager thinks a URL is valid before we decide whether to auto-generate a repo. This involves asking the managers if a URL is valid for them. Perhaps in the short run the manager will really just load the repo to find out, but I still think the semantic is different.
Fixed in HEAD. John, you may want to look over the new API added to IMetadataRepositoryManager and IMetadataRepositoryFactory. The validation specifies that the implementor should make their best attempt to validate the URL doing as much validation as possible up to but not including the load itself. It did not seem appropriate to add this API to artifact managers since it's not needed at this time (end users don't add artifact repos, and the validation/load are much more closely tied in artifact repos). I refactored the code in the factory implementations to have a validateAndLoad(boolean doLoad) method so that there are not duplicate implementations of the validation logic. I did some additional refactoring in the UpdateSite factory and repo to move some of the simple validation from the repo to the factory. Also added a new status code for invalid locations.
Finally got around to looking at this.. looks good. I just did some touch-ups in the javadoc - removed the advice for implementors from IMetadataRepositoryManager#validate (which nobody implements), and removed the advice for callers from IMetadataRepositoryFactory (which nobody should be calling except the repo manager). This nicely separates the client-side API contract from the SPI for repository providers.