Community
Participate
Working Groups
To fix bug Bug 247664 while respecting Bug 248056 we need to be able to know if a repository is loaded. There's a couple ways do do this but it would be better if it was included in the API
If we end up doing API for this, let's consider something more detailed than a boolean, such as LOADED, NOT_LOADED, NOT_FOUND, LOADING, etc. The UI could probably take advantage of this in certain places.
I agree that that would be good functionality but I actually discovered that the exact functionality I needed is contained in the ArtifactRepositoryManager contains(URL) method. As a temporary fix I've simply added this method to the IArtifactRepositoryManager class on my local machine.
Created attachment 113296 [details] Adds functionality for RepoManagers to check if URL is already loaded as a repository in both cases the functionality was already coded into the concrete classes, all I did was change private to public for metadata and add public in front of boolean for artifact. Also I added the method "public boolean contains(URL location);" to both IArtifactRepositoryManager and IMetadatarepositoryManager. My patches for Bug 247664 and Bug 248056 both currently rely on this code.
I think Susan's requirement makes sense. CC'ing John as he will be working on the API side of that.
I will take this because I am currently heavily refactoring the repository manager classes.
What Andrew meant here was not to know if a repository is loaded, but just to determine if a repository is already in the list of known repositories. I.e., it's just a contains() method that he needs. The problem with returning information on whether a repositories is "loaded" (in memory), is that with our caching behaviour a repository that is loaded at one moment could be flushed from memory immediately afterwards. So an isLoaded() method would an answer that could immediately become invalid. The only other thing I considered was combining a contains() method with isEnabled(). I..,e a getState() method that returns EXISTS, ENABLED, etc as bit-masks. Although this removes a method and enables us to add extra values in the future, I don't think this is very useable for clients. So, I'm leaning towards just adding the single contains() method (returning a boolean), that returns "is this a known repository".
Created attachment 117697 [details] Added new API, and removed all places where we were downcasting
Released.