Bug 211102 - [repo] [ui] IMetadataRepositoryManager URL validation
Summary: [repo] [ui] IMetadataRepositoryManager URL validation
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 204184
  Show dependency tree
 
Reported: 2007-11-27 14:03 EST by Susan McCourt CLA
Modified: 2008-03-06 16:51 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2007-11-27 14:03:11 EST
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)
Comment 1 John Arthorne CLA 2008-01-11 11:43:13 EST
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.
Comment 2 Susan McCourt CLA 2008-01-11 12:52:51 EST
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.
Comment 3 Susan McCourt CLA 2008-02-26 16:03:13 EST
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.
Comment 4 Susan McCourt CLA 2008-02-27 13:01:46 EST
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.
Comment 5 John Arthorne CLA 2008-03-06 16:51:45 EST
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.