felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r554743 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: Felix.java util/EventDispatcher.java util/Util.java
Date Mon, 09 Jul 2007 19:19:30 GMT
Author: rickhall
Date: Mon Jul  9 12:19:29 2007
New Revision: 554743

URL: http://svn.apache.org/viewvc?view=rev&rev=554743
Log:
Moved a utility method from Felix to the Util class to avoid exposing it
as public API of the Felix class.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?view=diff&rev=554743&r1=554742&r2=554743
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Mon Jul  9 12:19:29
2007
@@ -2683,7 +2683,7 @@
                 ServiceReference ref = (ServiceReference) refList.get(refIdx);
 
                 // Now check for castability.
-                if (!Felix.isServiceAssignable(bundle, ref))
+                if (!Util.isServiceAssignable(bundle, ref))
                 {
                     refList.remove(refIdx);
                     refIdx--;
@@ -2758,37 +2758,6 @@
 
         return (ServiceReference[]) result.toArray(new ServiceReference[result.size()]);
 
-    }
-
-    /**
-     * This method determines if the requesting bundle is able to cast
-     * the specified service reference based on class visibility rules
-     * of the underlying modules.
-     * @param requester The bundle requesting the service.
-     * @param ref The service in question.
-     * @return <tt>true</tt> if the requesting bundle is able to case
-     *         the service object to a known type.
-    **/
-    public static boolean isServiceAssignable(Bundle requester, ServiceReference ref)
-    {
-        // Boolean flag.
-        boolean allow = true;
-        // Get the service's objectClass property.
-        String[] objectClass = (String[]) ref.getProperty(FelixConstants.OBJECTCLASS);
-
-        // The the service reference is not assignable when the requesting
-        // bundle is wired to a different version of the service object.
-        // NOTE: We are pessimistic here, if any class in the service's
-        // objectClass is not usable by the requesting bundle, then we
-        // disallow the service reference.
-        for (int classIdx = 0; (allow) && (classIdx < objectClass.length); classIdx++)
-        {
-            if (!ref.isAssignableTo(requester, objectClass[classIdx]))
-            {
-                allow = false;
-            }
-        }
-        return allow;
     }
 
     protected Object getService(Bundle bundle, ServiceReference ref)

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java?view=diff&rev=554743&r1=554742&r2=554743
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
Mon Jul  9 12:19:29 2007
@@ -717,7 +717,7 @@
                 if ((filter == null) || filter.match(((ServiceEvent) event).getServiceReference()))
                 {
                     if ((l instanceof AllServiceListener) ||
-                        Felix.isServiceAssignable(bundle, ((ServiceEvent) event).getServiceReference()))
+                        Util.isServiceAssignable(bundle, ((ServiceEvent) event).getServiceReference()))
                     {
                         if (System.getSecurityManager() != null)
                         {

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java?view=diff&rev=554743&r1=554742&r2=554743
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java Mon Jul
 9 12:19:29 2007
@@ -22,6 +22,8 @@
 
 import org.apache.felix.framework.util.manifestparser.Capability;
 import org.apache.felix.moduleloader.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
 
 public class Util
 {
@@ -185,6 +187,37 @@
         }
     
         return null;
+    }
+
+    /**
+     * This method determines if the requesting bundle is able to cast
+     * the specified service reference based on class visibility rules
+     * of the underlying modules.
+     * @param requester The bundle requesting the service.
+     * @param ref The service in question.
+     * @return <tt>true</tt> if the requesting bundle is able to case
+     *         the service object to a known type.
+    **/
+    public static boolean isServiceAssignable(Bundle requester, ServiceReference ref)
+    {
+        // Boolean flag.
+        boolean allow = true;
+        // Get the service's objectClass property.
+        String[] objectClass = (String[]) ref.getProperty(FelixConstants.OBJECTCLASS);
+
+        // The the service reference is not assignable when the requesting
+        // bundle is wired to a different version of the service object.
+        // NOTE: We are pessimistic here, if any class in the service's
+        // objectClass is not usable by the requesting bundle, then we
+        // disallow the service reference.
+        for (int classIdx = 0; (allow) && (classIdx < objectClass.length); classIdx++)
+        {
+            if (!ref.isAssignableTo(requester, objectClass[classIdx]))
+            {
+                allow = false;
+            }
+        }
+        return allow;
     }
 
     public static ICapability getSatisfyingCapability(IModule m, IRequirement req)



Mime
View raw message