felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r916023 - in /felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime: ComponentManager.java DescriptorEntry.java DescriptorParam.java DescriptorParser.java
Date Wed, 24 Feb 2010 22:45:57 GMT
Author: pderop
Date: Wed Feb 24 22:45:57 2010
New Revision: 916023

URL: http://svn.apache.org/viewvc?rev=916023&view=rev
Log:
added BundleDependency annotation

Modified:
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ComponentManager.java
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorEntry.java
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParam.java
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParser.java

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=916023&r1=916022&r2=916023&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
Wed Feb 24 22:45:57 2010
@@ -28,6 +28,7 @@
 import java.util.List;
 
 import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.dependencies.BundleDependency;
 import org.apache.felix.dm.dependencies.ConfigurationDependency;
 import org.apache.felix.dm.dependencies.Dependency;
 import org.apache.felix.dm.dependencies.ServiceDependency;
@@ -173,6 +174,11 @@
                         checkServiceParsed(service);
                         service.add(createConfigurationDependency(b, dm, parser));
                         break;
+                        
+                    case BundleDependency:
+                        checkServiceParsed(service);
+                        service.add(createBundleDependency(b, dm, parser));
+                        break;
                 }
             }
 
@@ -442,4 +448,44 @@
         cd.setCallback(callback);
         return cd;
     }
+    
+    /**
+     * Creates a BundleDependency that we parsed from a component descriptor entry.
+     * @param b
+     * @param dm
+     * @param parser
+     * @return
+     */
+    private Dependency createBundleDependency(Bundle b, DependencyManager dm,
+        DescriptorParser parser)
+    {
+        BundleDependency bd = dm.createBundleDependency();
+
+        // Set add/changed/removed
+        String added = parser.getString(DescriptorParam.added, null);
+        String changed = parser.getString(DescriptorParam.changed, null);
+        String removed = parser.getString(DescriptorParam.removed, null);
+        bd.setCallbacks(added, changed, removed);
+
+        // required
+        bd.setRequired("true".equals(parser.getString(DescriptorParam.required, "true")));
+        
+        // filter
+        String filter = parser.getString(DescriptorParam.filter, null);
+        if (filter != null) 
+        {
+            bd.setFilter(filter);
+        }
+        
+        // stateMask
+        int stateMask = parser.getInt(DescriptorParam.stateMask, -1);
+        if (stateMask != -1) 
+        {
+            bd.setStateMask(stateMask);
+        }
+
+        // propagate
+        bd.setPropagate("true".equals(parser.getString(DescriptorParam.stateMask, "true")));
+        return bd;
+    }
 }

Modified: felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorEntry.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorEntry.java?rev=916023&r1=916022&r2=916023&view=diff
==============================================================================
--- felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorEntry.java
(original)
+++ felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorEntry.java
Wed Feb 24 22:45:57 2010
@@ -29,5 +29,6 @@
     AdapterService,
     ServiceDependency,
     TemporalServiceDependency,
-    ConfigurationDependency
+    ConfigurationDependency,
+    BundleDependency
 }

Modified: felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParam.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParam.java?rev=916023&r1=916022&r2=916023&view=diff
==============================================================================
--- felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParam.java
(original)
+++ felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParam.java
Wed Feb 24 22:45:57 2010
@@ -102,7 +102,10 @@
     adapteeService,
     
     /* AdapterService attribute for the adaptee service filter (the parsed value is a String)
*/
-    adapteeFilter;
+    adapteeFilter,
+    
+    /* BundleDependency attribute for the state mask bundle (the parsed value is a string)
*/
+    stateMask;
     
     /**
      * Indicates if a given attribute is a Service attribute.

Modified: felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParser.java?rev=916023&r1=916022&r2=916023&view=diff
==============================================================================
--- felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParser.java
(original)
+++ felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/DescriptorParser.java
Wed Feb 24 22:45:57 2010
@@ -202,6 +202,34 @@
 
     /**
      * Once a component descriptor entry line is parsed, you can retrieve entry attributes
using this method.
+     *
+     * @param param
+     * @param def
+     * @return
+     */
+    public int getInt(DescriptorParam param, int def)
+    {
+        String value = getString(param, null);
+        if (value != null)
+        {
+            try
+            {
+                return Integer.parseInt(value);
+            }
+            catch (NumberFormatException e)
+            {
+                throw new IllegalArgumentException("parameter " + param + " is not an int
value: "
+                    + value);
+            }
+        }
+        else
+        {
+            return def;
+        }
+    }
+
+    /**
+     * Once a component descriptor entry line is parsed, you can retrieve entry attributes
using this method.
      * @param param
      * @return
      */



Mime
View raw message