Maven search that uses the online APIs instead of the local index

Emilian Bold <[email protected]>
Newsgroups gmane.comp.java.netbeans.devel
Message-ID <CAL6R17AGW4Ju=u9UPWmOU+oVn3oGb7dDOng6_QmikmfwXuhT2w@mail.gmail.com>
Hello,

I have a basic implementation that searches the Maven online repository
instead of using the downloaded index. (Issue
https://netbeans.org/bugzilla/show_bug.cgi?id=254313 )

Running all queries online could allow us to give users the option of
disabling the heavy maven index download.

Now, the code is really simple so do tell me if I'm missing some subtle or
not so subtle aspect. I've only worked today on this thing.

What interested me was the query from the Add Dependency window that opens
when you right click the Dependencies node in a Maven project and pick Add
Dependency...

This seems to use the GenericFindQuery service from maven.indexer which
right now is only provided by NexusRepositoryIndexerImpl in maven.indexer.

What I did was very basic:

* I've created my own GenericFindQuery implementation which queries the
Maven repository using their API http://search.maven.org/#api (ClassesQuery
and ChecksumQueries would also be easy to implement with the API I believe).

* I've added another GenericFindQuery with a low position which delegates
to the other two query providers (so that the existing code would still get
results from NexusRepositoryIndexerImpl for say, the local repository).

There are a few problems here:

* org.netbeans.modules.maven.indexer.spi (which has GenericFindQuery,
ClassesQuery, ChecksumQueries, etc) is not a public package

* RepositoryQueries.Result can only be instantiated via AccessorImpl which
extends NexusRepositoryIndexerImpl.Accessor. Other modules (like mine)
would certainly need access to this.

* existing code assumes a single GenericFindQuery service provider (I fixed
this by adding a composite service on the 1st position)

* the Add Dependency UI and logic is a bit 'heavy' compared to the online
APIs. For example, it loads all the versions for a given artifact at once
instead of lazy loading the versions only when a node is expanded (see
MavenNodeFactory). Lazy loading would map better to a 2nd search using the
online API.

Let me know what do you think so far and how could we get the existing
maven.indexer APIs to a point where I can at least publish the plugin in
the Plugin Portal for testing.

--emi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.