felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r953576 - in /felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd: AnnotationCollector.java EntryParam.java
Date Fri, 11 Jun 2010 06:19:58 GMT
Author: pderop
Date: Fri Jun 11 06:19:57 2010
New Revision: 953576

URL: http://svn.apache.org/viewvc?rev=953576&view=rev
Log:
added a new name attribute, allowing to dynamically configure the service dependency filter/required
attributes

Modified:
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java

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=953576&r1=953575&r2=953576&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
Fri Jun 11 06:19:57 2010
@@ -90,6 +90,7 @@ public class AnnotationCollector extends
     private String m_method;
     private String m_descriptor;
     private Set<String> m_methods = new HashSet<String>();
+    private Set<String> m_dependencyNames = new HashSet<String>();
     private List<EntryWriter> m_writers = new ArrayList<EntryWriter>(); // Last
elem is either Service or AspectService
     private MetaType m_metaType;
     private String m_startMethod;
@@ -210,13 +211,13 @@ public class AnnotationCollector extends
             //Patterns.parseMethod(m_method, m_descriptor, Patterns.VOID);
             // TODO check if method takes optional params like Service, DependencyManager,
etc ...
             m_initMethod = m_method;
-        }
+        } 
         else if (annotation.getName().equals(A_START))
         {
             //Patterns.parseMethod(m_method, m_descriptor, Patterns.VOID);
             // TODO check if method takes optional params like Service, DependencyManager,
etc ...
             m_startMethod = m_method;
-        }
+        } 
         else if (annotation.getName().equals(A_STOP))
         {
             //Patterns.parseMethod(m_method, m_descriptor, Patterns.VOID);
@@ -362,7 +363,7 @@ public class AnnotationCollector extends
         Long t = (Long) annotation.get(EntryParam.timeout.toString());
         if (t != null && t.longValue() < -1)
         {
-            throw new IllegalArgumentException("Invalid timeout value " + t + " in ServiceDependency
annotation in class " + m_className);
+            throw new IllegalArgumentException("Invalid timeout value " + t + " in ServiceDependency
annotation from class " + m_className);
         }
         
         // required attribute (not valid if parsing a temporal service dependency)
@@ -372,7 +373,14 @@ public class AnnotationCollector extends
         writer.putString(annotation, EntryParam.changed, null);
 
         // removed callback
-        writer.putString(annotation, EntryParam.removed, null);       
+        writer.putString(annotation, EntryParam.removed, null); 
+        
+        // name attribute
+        writer.putString(annotation, EntryParam.name, null);
+        String name = annotation.get(EntryParam.name.toString());
+        if (name != null && ! m_dependencyNames.add(name)) {
+            throw new IllegalArgumentException("Duplicate dependency name " + name + " in
ServiceDependency annotation from class " + m_className);
+        }
     }
 
     /**

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java?rev=953576&r1=953575&r2=953576&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
(original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
Fri Jun 11 06:19:57 2010
@@ -34,5 +34,6 @@ public enum EntryParam
     ranking,
     factory,
     factoryConfigure,
-    field
+    field,
+    name
 }



Mime
View raw message