FELIX-1229 : Support new annotations
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@784186 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
index d71dafa..055a793 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
@@ -21,11 +21,12 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.*;
import org.apache.felix.scrplugin.Constants;
import org.apache.felix.scrplugin.tags.JavaClassDescription;
import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.JavaMethod;
/**
* Description of a java tag for components.
@@ -89,6 +90,10 @@
return Util.getStringValue(annotation, desc, "name", Component.class);
}
+ public ConfigurationPolicy policy() {
+ return Util.getEnumValue(annotation, "policy", ConfigurationPolicy.class, Component.class);
+ }
+
public Class<? extends java.lang.annotation.Annotation> annotationType() {
return null;
}
@@ -120,6 +125,21 @@
map.put(Constants.COMPONENT_DS, String.valueOf(this.annotation.ds()));
map.put(Constants.COMPONENT_CREATE_PID, String.valueOf(this.annotation.createPid()));
+ // version 1.1
+ map.put(Constants.COMPONENT_CONFIG_POLICY, this.annotation.policy().getPolicyString());
+ final JavaMethod[] jms = this.sourceAnnotation.getContext().getParent().getParentSource().getClasses()[0].getMethods();
+ for(final JavaMethod jm : jms) {
+ final Annotation[] annotations = jm.getAnnotations();
+ for(final Annotation a : annotations) {
+ if ( a.getType().getJavaClass().getName().equals(Activate.class) ) {
+ map.put(Constants.COMPONENT_ACTIVATE, jm.getName());
+ }
+ if ( a.getType().getJavaClass().getName().equals(Deactivate.class) ) {
+ map.put(Constants.COMPONENT_ACTIVATE, jm.getName());
+ }
+ }
+ }
+
return map;
}
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
index 7a14c79..c59e74f 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
@@ -68,8 +68,8 @@
return Util.getClassValue(annotation, "referenceInterface", Reference.class);
}
- public String strategy() {
- return Util.getStringValue(annotation, desc, "strategy", Reference.class);
+ public ReferenceStrategy strategy() {
+ return Util.getEnumValue(annotation, "strategy", ReferenceStrategy.class, Reference.class);
}
public String target() {
@@ -108,7 +108,7 @@
map.put(Constants.REFERENCE_BIND, emptyToNull(this.annotation.bind()));
map.put(Constants.REFERENCE_UNDBIND, emptyToNull(this.annotation.unbind()));
map.put(Constants.REFERENCE_CHECKED, String.valueOf(this.annotation.checked()));
- map.put(Constants.REFERENCE_STRATEGY, emptyToNull(this.annotation.strategy()));
+ map.put(Constants.REFERENCE_STRATEGY, this.annotation.strategy().getStrategyString());
return map;
}