felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r784186 - in /felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag: ComponentTag.java ReferenceTag.java
Date Fri, 12 Jun 2009 16:44:34 GMT
Author: cziegeler
Date: Fri Jun 12 16:44:34 2009
New Revision: 784186

URL: http://svn.apache.org/viewvc?rev=784186&view=rev
Log:
FELIX-1229 : Support new annotations

Modified:
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java?rev=784186&r1=784185&r2=784186&view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ComponentTag.java
Fri Jun 12 16:44:34 2009
@@ -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;
     }
 

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java?rev=784186&r1=784185&r2=784186&view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
Fri Jun 12 16:44:34 2009
@@ -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;
     }



Mime
View raw message