archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: Facets (was: Re: svn commit: r921376)
Date Wed, 10 Mar 2010 16:45:13 GMT

On 11/03/2010, at 3:12 AM, Wendy Smoak wrote:

> On Wed, Mar 10, 2010 at 10:08 AM, Brett Porter <brett@apache.org> wrote:
> 
>> http://archiva.apache.org/ref/1.4-SNAPSHOT/metadata-content-model.html
>> 
>> It's a way of storing plugin / functionality-specific metadata extensions - so the
Maven specific parts (type, classifier, snapshot info) that is not part of the canonical content
model are put into there.
> 
> Thanks!  That's not getting indexed [1], I'll see about linking it
> from somewhere so Google can find it.

I think we just did :)

Anyway, there was a thread earlier where we hadn't quite decided whether to push dev't docs
into APT / Subversion, or into Confluence.

> 
> 'Metadata extensions' sounds potentially useful for storing arbitrary
> metadata, like ratings (5 stars!) or approval status (whether an
> artifact is allowed to be used in production) in a corporate
> environment.  Or am I way off?

Yes, that's exactly what it's for. It's all derived from the ideas that have been posted here
over the last couple of years relating to extensible metadata, and making it a fundamental
part of the system and APIs rather than something tacked on.

The work I'm doing at the moment is refactoring so that the available artifact type mappings
becomes extensible, essentially using the "Maven 2" facet for storing type and classifier
of an artifact. With a little work tomorrow that will be done, and I'll add a plugin that
illustrates it.

It might be good to do a simple metadata 'CRUD' page as a new tab. Is anyone interested in
working on that? 

Here's some pointers - the extent of the code (aside from the actions) is not much more than:

1) create a new facet type (look at MavenProjectFacet for an example, or we could create a
generic one that is just a set of key-value pairs), put it in a new project in plugins/, and
include that dependency in the webapp.

2) Look it up in an action:

    /** @plexus.requirement */
    private MetadataResolver resolver;

...

    ProjectVersionMetadata metadata = resolver.getProjectVersion( repoId, groupId, artifactId,
version );
    MetadataFacet facet = metadata.getFacet( "unique-id-of-my-facet" );

3) use the values for the CRUD forms:

    facet.toProperties()
    facet.fromProperties()

4) Store it:

    /** @plexus.requirement */
    private MetadataRepository metadataRepository;

...

    metadataRepository.updateProjectVersion( repoId, groupId, artifactId, metadata );


There's also facets at the artifact level, but there isn't a good place in the UI to show
them right now. One step at a time :)

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/





Mime
View raw message