org.eclipse.gemini.blueprint.extender.internal.dependencies.shutdown
Class BundleDependencyComparator

java.lang.Object
  extended by org.eclipse.gemini.blueprint.extender.internal.dependencies.shutdown.BundleDependencyComparator
All Implemented Interfaces:
Serializable, Comparator

public class BundleDependencyComparator
extends Object
implements Comparator, Serializable

Null safe service-based dependency sorter for bundles. Sorts bundles based on their services using the following algorithm:

  1. if two bundles are connected (transitively) then the bundle that exports the service with lowest ranking id, will be considered lower.
  2. if the ranks are equal, then the service id (which is guaranteed to be unique) will be considered.
  3. if the bundles are not related then they will be sorted based on their symbolic name.

Author:
Hal Hildebrand, Andy Piper, Costin Leau
See Also:
Serialized Form

Constructor Summary
BundleDependencyComparator()
           
 
Method Summary
 int compare(Object a, Object b)
           
protected static int compareUsingServiceRankingAndId(org.osgi.framework.Bundle a, org.osgi.framework.Bundle b)
          Answer whether Bundle a is higher or lower depending on the ranking and id of its exported services.
static boolean isSpringManagedService(org.osgi.framework.ServiceReference reference)
          Simple method checking whether the given service reference points to a spring managed service or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

BundleDependencyComparator

public BundleDependencyComparator()
Method Detail

isSpringManagedService

public static boolean isSpringManagedService(org.osgi.framework.ServiceReference reference)
Simple method checking whether the given service reference points to a spring managed service or not. Checks for

Parameters:
reference - reference to the OSGi service
Returns:
true if the service is spring managed, false otherwise

compareUsingServiceRankingAndId

protected static int compareUsingServiceRankingAndId(org.osgi.framework.Bundle a,
                                                     org.osgi.framework.Bundle b)
Answer whether Bundle a is higher or lower depending on the ranking and id of its exported services. This is used as a tie-breaker for circular references.


compare

public int compare(Object a,
                   Object b)
Specified by:
compare in interface Comparator


Copyright © 2006-2012. All Rights Reserved.