Differences between revisions 2 and 3
Revision 2 as of 2004-09-28 15:00:57
Size: 2201
Revision 3 as of 2009-09-20 22:01:44
Size: 2201
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Problem Description

When using configurations in HiveMind, it is common to order the values in the configuration. This is most commonly done inside a initializeService() method.

It would be nice to have a declarative way to order components, either by sorting on one (or more) columns, or by makeing use of the Orderer to order values by dependencies.

Proposed Solution

Allow additional elements inside the <schema> element to support ordering.

Note that these solutions operate on the objects not the contributions.


A <sort> element is used to sort the objects based on a property value.

  <sort property="..."/>

Sorting takes place on the objects (not the contributed elements).


An <order> element is used to order the objects by contributions. This requires identifying three properties of the object: the name property that uniquely identifies each object, the before property that indicates which other objects must follow (post requisites) and the after property, which specified wihch objects must precede (pre-requisites).

  <order name-property="..." before-property="..." after-property="..."/>

The three attributes identify the properties. Where (as is common) the properties match the defaults ("name", "before", "after"), the corresponding attributes may be omitted. Thus, in many common cases, simply putting an empty <order/> element into the <schema> will suffice!


Do we need to support sorting on multiple columns? Descending sorts? Sorting with comparators?

KnutWannheden: I was thinking about this problem a few days ago. The approach I came up with was somewhat different though. I thought it would almost be easier if the ordering were specified in Java. The class which the contributions are mapped to would thus either have to implement Comparable or HiveMind's Orderable interface. HiveMind could then automatically order the contributions accordingly. This would also quite elegantly solve the problems of sorting on multiple columns and descending sorts by leaving the problem up to the developer. Thoughts?

ContributionOrderingProposal (last edited 2009-09-20 22:01:44 by localhost)