[jboss-cvs] JBossAS SVN: r92558 - in projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc: framework and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 19 00:10:56 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-08-19 00:10:53 -0400 (Wed, 19 Aug 2009)
New Revision: 92558

Modified:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java
Log:
Bundle.getResource(). XML Parser tests - ok

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -37,4 +37,6 @@
    void fireBundleEvent(BundleEvent event);
 
    void addBundleListener(BundleListener listener);
+
+   void removeBundleListener(BundleListener listener);
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -21,11 +21,11 @@
  */
 package org.jboss.osgi.jbossmc.api;
 
+// $Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
 import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.FrameworkListener;
 
-//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
-
 /**
  * An abstraction of a framework event manager.
  * 
@@ -37,4 +37,6 @@
    void fireFrameworkEvent(FrameworkEvent event);
 
    void addFrameworkListener(FrameworkListener listener);
+
+   void removeFrameworkListener(FrameworkListener listener);
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -39,4 +39,6 @@
    void addServiceListener(ServiceListener listener);
 
    void addServiceListener(ServiceListener listener, String filter);
+
+   void removeServiceListener(ServiceListener listener);
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -24,16 +24,13 @@
 //$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
 
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Enumeration;
 
 import org.jboss.logging.Logger;
 import org.jboss.osgi.jbossmc.api.BundleClassLoader;
-import org.jboss.osgi.jbossmc.api.BundleFactory;
-import org.jboss.virtual.VFS;
+import org.jboss.osgi.spi.NotImplementedException;
 import org.jboss.virtual.VirtualFile;
 import org.osgi.framework.Bundle;
 
@@ -47,24 +44,26 @@
 {
    // Provide logging
    final Logger log = Logger.getLogger(BundleClassLoaderImpl.class);
-   
+
+   private VirtualFile virtualFile;
    private ClassLoader loader;
-   
+
    public BundleClassLoaderImpl(Bundle bundle)
    {
       BundleImpl bundleImpl = (BundleImpl)bundle;
-      
+      virtualFile = bundleImpl.getVirtualFile();
+
       URL location;
       try
       {
-         location = bundleImpl.getVirtualFile().toURL();
+         location = virtualFile.toURL();
       }
       catch (Exception ex)
       {
          throw new IllegalStateException("Cannot obtain bundle location", ex);
       }
-      
-      loader = new URLClassLoader(new URL[]{ location });
+
+      loader = new URLClassLoader(new URL[] { location });
    }
 
    public Class<?> loadClass(String name) throws ClassNotFoundException
@@ -74,12 +73,23 @@
 
    public URL getResource(String name)
    {
-      return loader.getResource(name);
+      URL resourceURL = null;
+      try
+      {
+         VirtualFile child = virtualFile.getChild(name);
+         if (child != null)
+            resourceURL = child.toURL();
+      }
+      catch (Exception ex)
+      {
+         // ignore
+      }
+      return resourceURL;
    }
 
    public Enumeration<URL> getResources(String name) throws IOException
    {
-      return loader.getResources(name);
+      // [TODO] Bundle.getResources(String name)
+      throw new NotImplementedException();
    }
-
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -79,12 +79,24 @@
       eventManager.addBundleListener(listener);
    }
 
+   public void removeBundleListener(BundleListener listener)
+   {
+      BundleEventManager eventManager = getFramework().getBundleEventManager();
+      eventManager.removeBundleListener(listener);
+   }
+
    public void addFrameworkListener(FrameworkListener listener)
    {
       FrameworkEventManager eventManager = getFramework().getFrameworkEventManager();
       eventManager.addFrameworkListener(listener);
    }
 
+   public void removeFrameworkListener(FrameworkListener listener)
+   {
+      FrameworkEventManager eventManager = getFramework().getFrameworkEventManager();
+      eventManager.removeFrameworkListener(listener);
+   }
+
    public void addServiceListener(ServiceListener listener)
    {
       ServiceEventManager eventManager = getFramework().getServiceEventManager();
@@ -97,14 +109,15 @@
       eventManager.addServiceListener(listener, filter);
    }
 
-   public Filter createFilter(String filter) throws InvalidSyntaxException
+   public void removeServiceListener(ServiceListener listener)
    {
-      return FrameworkUtil.createFilter(filter);
+      ServiceEventManager eventManager = getFramework().getServiceEventManager();
+      eventManager.removeServiceListener(listener);
    }
 
-   public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
+   public Filter createFilter(String filter) throws InvalidSyntaxException
    {
-      throw new NotImplementedException();
+      return FrameworkUtil.createFilter(filter);
    }
 
    public Bundle getBundle()
@@ -128,6 +141,7 @@
 
    public File getDataFile(String filename)
    {
+      // [TODO] BundleContext.getDataFile(String filename)
       throw new NotImplementedException();
    }
 
@@ -158,6 +172,12 @@
       return serviceRegistry.getServiceReferences(clazz, filter);
    }
 
+   public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
+   {
+      // [TODO] BundleContext.getAllServiceReferences(String clazz, String filter)
+      throw new NotImplementedException();
+   }
+
    public Bundle installBundle(String location) throws BundleException
    {
       // Create the bundle from the location
@@ -173,6 +193,7 @@
 
    public Bundle installBundle(String location, InputStream input) throws BundleException
    {
+      // [TODO] BundleContext.installBundle(String location, InputStream input)
       throw new NotImplementedException();
    }
 
@@ -188,23 +209,9 @@
       return registry.registerService(getBundle(), clazz, service, properties);
    }
 
-   public void removeBundleListener(BundleListener listener)
-   {
-      throw new NotImplementedException();
-   }
-
-   public void removeFrameworkListener(FrameworkListener listener)
-   {
-      throw new NotImplementedException();
-   }
-
-   public void removeServiceListener(ServiceListener listener)
-   {
-      throw new NotImplementedException();
-   }
-
    public boolean ungetService(ServiceReference reference)
    {
+      // [TODO] BundleContext.ungetService
       throw new NotImplementedException();
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -54,7 +54,7 @@
    {
       // [TODO] When a BundleEvent is fired, it is asynchronously delivered to a BundleListener
       
-      for (BundleListener listener : listeners)
+      for (BundleListener listener : new ArrayList<BundleListener>(listeners))
          listener.bundleChanged(event);
    }
 
@@ -62,4 +62,9 @@
    {
       listeners.add(listener);
    }
+
+   public void removeBundleListener(BundleListener listener)
+   {
+      listeners.remove(listener);
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -161,19 +161,16 @@
 
    public void update() throws BundleException
    {
+      // [TODO] Bundle.update()
       throw new NotImplementedException();
    }
 
    public void update(InputStream in) throws BundleException
    {
+      // [TODO] Bundle.update(InputStream in)
       throw new NotImplementedException();
    }
 
-   public Enumeration findEntries(String path, String filePattern, boolean recurse)
-   {
-      throw new NotImplementedException();
-   }
-
    public BundleContext getBundleContext()
    {
       return context;
@@ -186,14 +183,22 @@
 
    public URL getEntry(String path)
    {
+      // [TODO] Bundle.getEntry(String path)
       throw new NotImplementedException();
    }
 
-   public Enumeration getEntryPaths(String path)
+   public Enumeration<URL> getEntryPaths(String path)
    {
+      // [TODO] Bundle.getEntryPaths(String path)
       throw new NotImplementedException();
    }
 
+   public Enumeration findEntries(String path, String filePattern, boolean recurse)
+   {
+      // [TODO] Bundle.findEntries(String path, String filePattern, boolean recurse)
+      throw new NotImplementedException();
+   }
+
    public Dictionary getHeaders()
    {
       if (headers == null)
@@ -220,19 +225,28 @@
 
    public Dictionary getHeaders(String locale)
    {
+      // [TODO] Bundle.getHeaders(String locale)
       throw new NotImplementedException();
    }
 
    public long getLastModified()
    {
+      // [TODO] Bundle.getLastModified()
       throw new NotImplementedException();
    }
 
    public ServiceReference[] getRegisteredServices()
    {
+      // [TODO] Bundle.getRegisteredServices()
       throw new NotImplementedException();
    }
 
+   public ServiceReference[] getServicesInUse()
+   {
+      // [TODO] Bundle.getServicesInUse()
+      throw new NotImplementedException();
+   }
+
    public URL getResource(String name)
    {
       return getClassLoader().getResource(name);
@@ -243,24 +257,21 @@
       return getClassLoader().getResources(name);
    }
 
-   public ServiceReference[] getServicesInUse()
-   {
-      throw new NotImplementedException();
-
-   }
-
    public Map getSignerCertificates(int signersType)
    {
+      // [TODO] Bundle.getSignerCertificates(int signersType)
       throw new NotImplementedException();
    }
 
    public Version getVersion()
    {
-      throw new NotImplementedException();
+      String versionStr = getHeader(Constants.BUNDLE_VERSION);
+      return new Version(versionStr);
    }
 
    public boolean hasPermission(Object permission)
    {
+      // [TODO] Bundle.hasPermission(Object permission)
       throw new NotImplementedException();
    }
 
@@ -308,7 +319,7 @@
       {
          long id = getBundleId();
          String name = getSymbolicName();
-         String version = getHeader(Constants.BUNDLE_VERSION);
+         Version version = getVersion();
          toStringValue = "[id=" + id + ",name=" + name + ",version=" + version + "]";
       }
       return toStringValue;

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -54,7 +54,7 @@
    {
       // [TODO] When a FrameworkEvent is fired, it is asynchronously delivered to a FrameworkListener.
       
-      for (FrameworkListener listener : listeners)
+      for (FrameworkListener listener : new ArrayList<FrameworkListener>(listeners))
          listener.frameworkEvent(event);
    }
 
@@ -62,4 +62,9 @@
    {
       listeners.add(listener);
    }
+
+   public void removeFrameworkListener(FrameworkListener listener)
+   {
+      listeners.remove(listener);
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -24,7 +24,8 @@
 //$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
 
 import java.util.ArrayList;
-import java.util.List;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 import org.jboss.logging.Logger;
 import org.jboss.osgi.jbossmc.api.ServiceEventManager;
@@ -48,7 +49,7 @@
    final Logger log = Logger.getLogger(ServiceEventManagerImpl.class);
    
    private FrameworkImpl framework;
-   private List<ListenerRegistration> listeners = new ArrayList<ListenerRegistration>();
+   private Map<ServiceListener, ListenerRegistration> listeners = new LinkedHashMap<ServiceListener, ListenerRegistration>();
 
    public ServiceEventManagerImpl(FrameworkImpl framework)
    {
@@ -63,7 +64,7 @@
          throw new IllegalStateException("Cannot obtain property '" + Constants.OBJECTCLASS + "' from: " + sref);
       
       // When a ServiceEvent is fired, it is synchronously delivered to a ServiceListener.
-      for (ListenerRegistration reg : listeners)
+      for (ListenerRegistration reg : new ArrayList<ListenerRegistration>(listeners.values()))
       {
          ServiceListener listener = reg.getListener();
          
@@ -78,16 +79,21 @@
 
    public void addServiceListener(ServiceListener listener)
    {
-      listeners.add(new ListenerRegistration(listener, null));
+      listeners.put(listener, new ListenerRegistration(listener, null));
    }
 
    public void addServiceListener(ServiceListener listener, String filter)
    {
-      listeners.add(new ListenerRegistration(listener, filter));
+      listeners.put(listener, new ListenerRegistration(listener, filter));
    }
    
-   static class ListenerRegistration
+   public void removeServiceListener(ServiceListener listener)
    {
+      listeners.remove(listener);
+   }
+   
+   private static class ListenerRegistration
+   {
       ServiceListener listener; 
       Filter filter;
       

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -85,6 +85,7 @@
 
    public int compareTo(Object reference)
    {
+      // [TODO] ServiceReference.compareTo(Object reference)
       throw new NotImplementedException();
    }
 
@@ -113,11 +114,13 @@
 
    public Bundle[] getUsingBundles()
    {
+      // [TODO] ServiceReference.getUsingBundles()
       throw new NotImplementedException();
    }
 
    public boolean isAssignableTo(Bundle bundle, String className)
    {
+      // [TODO] ServiceReference.isAssignableTo(Bundle bundle, String className)
       throw new NotImplementedException();
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -56,11 +56,13 @@
 
    public void setProperties(Dictionary properties)
    {
+      // [TODO] ServiceRegistration.setProperties(Dictionary properties)
       throw new NotImplementedException();
    }
 
    public void unregister()
    {
+      // [TODO] ServiceRegistration.unregister()
       throw new NotImplementedException();
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java	2009-08-19 04:00:42 UTC (rev 92557)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java	2009-08-19 04:10:53 UTC (rev 92558)
@@ -73,17 +73,38 @@
 
    public ServiceReference getServiceReference(String clazz)
    {
-      ServiceReference sref = null;
+      ServiceReference srefBest = null;
       
-      // [TODO] If multiple such services exist, the service with the highest ranking (as specified in its Constants.SERVICE_RANKING property) is returned.
-
-      // [TODO] If there is a tie in ranking, the service with the lowest service ID (as specified in its Constants.SERVICE_ID property); that is, the service that was registered first is returned. 
-      
       List<ServiceReference> srefs = registry.get(clazz);
       if (srefs != null && srefs.size() > 0)
-         sref = srefs.iterator().next();
+      {
+         // If multiple such services exist, the service with the highest ranking is returned.
+         // If there is a tie in ranking, the service with the lowest service ID (i.e. the service that was registered first) is returned. 
+         for (ServiceReference sref : srefs)
+         {
+            if (srefBest != null)
+            {
+               Integer bestRanking = (Integer)srefBest.getProperty(Constants.SERVICE_RANKING);
+               Long bestId = (Long)srefBest.getProperty(Constants.SERVICE_ID);
+               
+               Integer thisRanking = (Integer)sref.getProperty(Constants.SERVICE_RANKING);
+               Long thisId = (Long)sref.getProperty(Constants.SERVICE_ID);
+               if (bestRanking != null && thisRanking != null)
+               {
+                  if (bestRanking < thisRanking)
+                     srefBest = sref;
+                  
+                  if (bestRanking.equals(thisRanking) && bestId < thisId)
+                     srefBest = sref;
+               }
+            }
+            
+            if (srefBest == null)
+               srefBest = sref;
+         }
+      }
       
-      return sref;
+      return srefBest;
    }
    
    public ServiceReference[] getServiceReferences(String clazz, String filter)




More information about the jboss-cvs-commits mailing list