Implemented the ranking property of aspects.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@918515 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
index e1374a5..ea8b242 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
@@ -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();
}
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
index e13ee89..d2d0b37 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
@@ -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);