Author: marrs Date: Wed Mar 3 15:35:20 2010 New Revision: 918515 URL: http://svn.apache.org/viewvc?rev=918515&view=rev Log: Implemented the ranking property of aspects.
Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java?rev=918515&r1=918514&r2=918515&view=diff ============================================================================== --- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java (original) +++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java Wed Mar 3 15:35:20 2010 @@ -46,11 +46,20 @@ * the filter condition to use with the service interface this aspect is applying to. * @return the filter condition to use with the service interface */ - String filter(); + String filter() default ""; /** * Additional properties to use with the aspect service registration * @return additional properties to use with the aspect service registration */ - Param[] properties(); + Param[] properties() default {}; + + /** + * Ranking of this aspect. Since aspects are chained, the ranking defines the order in which they are chained. + * Chain ranking is implemented as a service ranking so service lookups automatically retrieve the top of the + * chain. + * + * @return the ranking of this aspect + */ + int ranking(); } Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java?rev=918515&r1=918514&r2=918515&view=diff ============================================================================== --- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java (original) +++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java Wed Mar 3 15:35:20 2010 @@ -146,7 +146,8 @@ adapterProperties, adapteeService, adapteeFilter, - stateMask + stateMask, + ranking }; /** @@ -602,8 +603,14 @@ // Parse service filter String filter = annotation.get(Params.filter.toString()); - Verifier.verifyFilter(filter, 0); - info.addParam(Params.filter, filter); + if (filter != null) { + Verifier.verifyFilter(filter, 0); + info.addParam(Params.filter, filter); + } + + // Parse service aspect ranking + Integer ranking = annotation.get(Params.ranking.toString()); + info.addParam(Params.ranking, ranking.toString()); // Generate Aspect Implementation info.addParam(Params.impl, m_className);