felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r903433 - in /felix/trunk/dependencymanager: annotation/src/main/java/org/apache/felix/dm/annotation/api/ annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/ runtime/src/main/java/org/apache/felix/dm/runtime/
Date Tue, 26 Jan 2010 21:46:44 GMT
Author: pderop
Date: Tue Jan 26 21:46:44 2010
New Revision: 903433

URL: http://svn.apache.org/viewvc?rev=903433&view=rev
Log:
removed "changed/removed" callbacks from temporal service dependency annotation

Modified:
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/TemporalServiceDependency.java
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ComponentManager.java

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/TemporalServiceDependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/TemporalServiceDependency.java?rev=903433&r1=903432&r2=903433&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/TemporalServiceDependency.java
(original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/TemporalServiceDependency.java
Tue Jan 26 21:46:44 2010
@@ -97,14 +97,4 @@
      * the annotation is applied on a class field.
      */
     String added() default "";
-
-    /**
-     * Returns the callback method to be invoked when the service properties have changed.
-     */
-    String changed() default "";
-
-    /**
-     * Returns the callback method to invoke when the service is lost.
-     */
-    String removed() default "";
 }

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=903433&r1=903432&r2=903433&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
Tue Jan 26 21:46:44 2010
@@ -88,39 +88,41 @@
     private final static Pattern m_methodCompoPattern = Pattern.compile("\\(\\)\\[Ljava/lang/Object;");
 
     // List of component descriptor entry types
-    enum EntryTypes {
-        Service,
-        ServiceDependency,
-        TemporalServiceDependency,
+    enum EntryTypes
+    {
+        Service, 
+        ServiceDependency, 
+        TemporalServiceDependency, 
         ConfigurationDependency,
     };
-    
+
     // List of component descriptor parameters
-    enum Params {
-        init,
-        start,
-        stop,
-        destroy,
-        impl,
-        provide,
-        properties,
-        factory,
-        factoryMethod,
-        composition,
-        service,
-        filter,
-        defaultImpl,
-        required,
-        added,
+    enum Params
+    {
+        init, 
+        start, 
+        stop, 
+        destroy, 
+        impl, 
+        provide, 
+        properties, 
+        factory, 
+        factoryMethod, 
+        composition, 
+        service, 
+        filter, 
+        defaultImpl, 
+        required, 
+        added, 
         changed,
         removed,
-        autoConfig,
-        pid,
-        propagate,
-        updated,
+        autoConfig, 
+        pid, 
+        propagate, 
+        updated, 
         timeout
     };
-    
+
     /**
      * This class represents a parsed DependencyManager component descriptor entry.
      * (either a Service, a ServiceDependency, or a ConfigurationDependency descriptor entry).
@@ -129,7 +131,7 @@
     {
         /** The component descriptor entry type: either Service, (Temporal)ServiceDependency,
or ConfigurationDependency */
         EntryTypes m_entry;
-        
+
         /** The component descriptor entry parameters (init/start/stop ...) */
         Map<Params, Object> m_params = new HashMap<Params, Object>();
 
@@ -360,7 +362,7 @@
         else if (annotation.getName().equals(A_CONFIGURATION_DEPENDENCY))
         {
             parseConfigurationDependencyAnnotation(annotation);
-        } 
+        }
         else if (annotation.getName().equals(A_TEMPORAL_SERVICE_DEPENDENCY))
         {
             parseServiceDependencyAnnotation(annotation, true);
@@ -404,7 +406,8 @@
      */
     private void parseServiceDependencyAnnotation(Annotation annotation, boolean temporal)
     {
-        Info info = new Info(temporal ? EntryTypes.TemporalServiceDependency : EntryTypes.ServiceDependency);
+        Info info = new Info(temporal ? EntryTypes.TemporalServiceDependency
+            : EntryTypes.ServiceDependency);
         m_infos.add(info);
 
         // service attribute
@@ -443,24 +446,25 @@
         // defaultImpl attribute
         info.addClassParam(annotation, Params.defaultImpl, null);
 
-        // required attribute (not valid if parsing a temporal service dependency)
-        if (! temporal) {
-            info.addParam(annotation, Params.required, null);
-        }
-
         // added callback
         info.addParam(annotation, Params.added, (!m_isField) ? m_method : null);
 
-        // changed callback
-        info.addParam(annotation, Params.changed, null);
-
-        // removed callback
-        info.addParam(annotation, Params.removed, null);
-        
-        // timeout attribute (only valid if parsing a temporal service dependency)
-        if (temporal) {
+        if (temporal)
+        {
+            // timeout attribute (only valid if parsing a temporal service dependency)
             info.addParam(annotation, Params.timeout, null);
         }
+        else
+        {
+            // required attribute (not valid if parsing a temporal service dependency)
+            info.addParam(annotation, Params.required, null);
+
+            // changed callback
+            info.addParam(annotation, Params.changed, null);
+
+            // removed callback
+            info.addParam(annotation, Params.removed, null);
+        }
     }
 
     /**
@@ -528,7 +532,7 @@
         {
             sb.append("\n\t").append(info.toString());
         }
-        m_reporter.warning(sb.toString()); 
+        m_reporter.warning(sb.toString());
     }
 
     /**

Modified: felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ComponentManager.java?rev=903433&r1=903432&r2=903433&view=diff
==============================================================================
--- felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ComponentManager.java
(original)
+++ felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ComponentManager.java
Tue Jan 26 21:46:44 2010
@@ -313,21 +313,10 @@
             sd.setDefaultImplementation(defaultServiceImplClass);
         }
 
-        // Set required flag (always true for a temporal dependency)
-        if (temporal)
-        {
-            sd.setRequired(true);
-        }
-        else
-        {
-            String required = parser.getString(DescriptorParam.required, "true");
-            sd.setRequired("true".equals(required));
-        }
-
         // Set bind/unbind/rebind
         String added = parser.getString(DescriptorParam.added, null);
-        String changed = parser.getString(DescriptorParam.changed, null);
-        String removed = parser.getString(DescriptorParam.removed, null);
+        String changed = temporal ? null : parser.getString(DescriptorParam.changed, null);
+        String removed = temporal ? null : parser.getString(DescriptorParam.removed, null);
         sd.setCallbacks(added, changed, removed);
 
         // Set AutoConfig
@@ -337,14 +326,22 @@
             sd.setAutoConfig(autoConfigField);
         }
 
-        // Set the timeout value for a temporal service dependency
+        // Do specific parsing for temporal service dependency
         if (temporal)
         {
+            // Set the timeout value for a temporal service dependency
             String timeout = parser.getString(DescriptorParam.timeout, null);
             if (timeout != null)
             {
                 ((TemporalServiceDependency) sd).setTimeout(Long.parseLong(timeout));
             }
+            
+            // Set required flag (always true for a temporal dependency)
+            sd.setRequired(true);
+        } else {
+            // for ServiceDependency, get required flag.
+            String required = parser.getString(DescriptorParam.required, "true");
+            sd.setRequired("true".equals(required));
         }
         return sd;
     }



Mime
View raw message