On 17/06/2011, at 6:13 AM, Jarrod Roberson wrote:

> I am trying to add this feature to Archiva, but I can't figure out where to
> start?
> 
> This is a critical feature I need to add for our environment in order to
> enabled my distributed team to create projects from a standard set of
> company archetypes?
> 
> What I need to know is:
> 
> 1. How to search all the repositories for artifacts of packaging type
> "maven-archetype"?

Are you working against trunk (unreleased, and significant changes to the 
repository APIs), or trying to patch Archiva 1.3.x?

The place to point you will be different for each, but on trunk you could look 
at:
https://svn.apache.org/repos/asf/archiva/trunk/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java

That counts all objects of a certain type, which would help you do the same 
here. There's two alternatives implemented depending on whether you store the 
metadata in JCR or not.

Alternatively, you could search the maven repository index that is typically 
generated (this would be the same in both versions)

> 
> 2. How / Where to add a simple Servlet so that it will respond to
> http://[archiva]/archetype-catalog.xml
> with the results of all the available archetypes I find in the available
> repositories?

Do you want to generate it dynamically, or have it a flat file that is updated 
whenever a new archetype is added to the repository (or occasionally 
repopulated by a scan)?

>    I need to combine the internal and snapshot ( and any others )
> repositories for this to really be useful. But I am only using internal and
> snapshot right now.

This should just appear as the normal catalog at the root of a repository 
group, right?

If it's dynamic, you'd just widen the search criteria, if they are generated 
then the group request would need to merge the files. You'll find a similar 
situation for metadata files in ArchivaDavResourceFactory.java (archiva-webdav 
module).

> 
> I forked the project on GitHub and will contribute my solution back there
> when I get it working.

Great, welcome! Please pardon our dust as Olivier is doing quite a bit of trunk 
cleanup at the moment. I hope that doesn't get in your way :)

- Brett

--
Brett Porter
[email protected]
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter




Reply via email to