felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r765541 - in /felix/trunk/deviceaccess/src/main/java/org/apache/felix/das: DeviceManager.java DriverAttributes.java util/DeviceAnalyzer.java util/Util.java
Date Thu, 16 Apr 2009 09:41:41 GMT
Author: mcculls
Date: Thu Apr 16 09:41:41 2009
New Revision: 765541

URL: http://svn.apache.org/viewvc?rev=765541&view=rev
Log:
FELIX-1030: apply patch from Dennis Geurts to fix issues revealed by new tests

Modified:
    felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DeviceManager.java
    felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DriverAttributes.java
    felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/DeviceAnalyzer.java
    felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/Util.java

Modified: felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DeviceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DeviceManager.java?rev=765541&r1=765540&r2=765541&view=diff
==============================================================================
--- felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DeviceManager.java (original)
+++ felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DeviceManager.java Thu Apr
16 09:41:41 2009
@@ -424,9 +424,11 @@
                     {
                         info( "used by driver: " + bundle.getSymbolicName() );
                         debug( "not idle: " + ref.getBundle().getSymbolicName() );
-                        list.add( ref );
                         break;
                     }
+                    
+                    list.add( ref );
+
                 }
             }
             return list;

Modified: felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DriverAttributes.java
URL: http://svn.apache.org/viewvc/felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DriverAttributes.java?rev=765541&r1=765540&r2=765541&view=diff
==============================================================================
--- felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DriverAttributes.java (original)
+++ felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/DriverAttributes.java Thu
Apr 16 09:41:41 2009
@@ -86,7 +86,7 @@
 
         for ( ServiceReference ref : used )
         {
-            if ( Util.isDeviceInstance( ref ) )
+            if ( Util.isDevice( ref ) )
             {
                 return true;
             }
@@ -103,13 +103,11 @@
 
     public void tryUninstall() throws BundleException
     {
-        if ( !isInUse() )
+    	
+        // only install if _we_ loaded the driver
+        if ( !isInUse() && m_dynamic )
         {
-            // only install if _we_ loaded the driver
-            if ( m_dynamic )
-            {
-                m_bundle.uninstall();
-            }
+        	m_bundle.uninstall();
         }
     }
 

Modified: felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/DeviceAnalyzer.java
URL: http://svn.apache.org/viewvc/felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/DeviceAnalyzer.java?rev=765541&r1=765540&r2=765541&view=diff
==============================================================================
--- felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/DeviceAnalyzer.java (original)
+++ felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/DeviceAnalyzer.java Thu
Apr 16 09:41:41 2009
@@ -84,6 +84,7 @@
             if ( !String[].class.isInstance( cat ) )
             {
                 m_log.log( LogService.LOG_ERROR, "invalid device: invalid device category:
" + Util.showDevice( ref ) );
+                return;
             }
             if ( String[].class.cast( cat ).length == 0 )
             {

Modified: felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/Util.java?rev=765541&r1=765540&r2=765541&view=diff
==============================================================================
--- felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/Util.java (original)
+++ felix/trunk/deviceaccess/src/main/java/org/apache/felix/das/util/Util.java Thu Apr 16
09:41:41 2009
@@ -64,7 +64,25 @@
         return buffer.toString();
     }
 
-
+    public static boolean isDevice( ServiceReference ref )
+    {
+        try
+        {
+            Filter device = createFilter( "(|(%s=%s)(%s=%s))", new Object[]
+                { 
+            		Constants.OBJECTCLASS, Device.class.getName(),
+            		org.osgi.service.device.Constants.DEVICE_CATEGORY, "*" 
+            		}
+            );
+            return device.match( ref );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+        return false;
+    }
+    
     public static boolean isDeviceInstance( ServiceReference ref )
     {
         try



Mime
View raw message