org.apache.felix.dm
Class ServiceUtil

java.lang.Object
  extended by org.apache.felix.dm.ServiceUtil

public class ServiceUtil
extends Object

OSGi service utilities.


Constructor Summary
ServiceUtil()
           
 
Method Summary
static int getRanking(ServiceReference ref)
          Returns the service ranking of a service, based on its service reference.
static long getServiceId(ServiceReference ref)
          Returns the service ID of a service, based on its service reference.
static boolean isAspect(ServiceReference ref)
          Determines if the service is an aspect as defined by the dependency manager.
static String toString(ServiceReference ref)
          Converts a service reference to a string, listing both the bundle it was registered from and all properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceUtil

public ServiceUtil()
Method Detail

getRanking

public static int getRanking(ServiceReference ref)
Returns the service ranking of a service, based on its service reference. If the service has a property specifying its ranking, that will be returned. If not, the default ranking of zero will be returned.

Parameters:
ref - the service reference to determine the ranking for
Returns:
the ranking

getServiceId

public static long getServiceId(ServiceReference ref)
Returns the service ID of a service, based on its service reference. This method is aware of service aspects as defined by the dependency manager and will return the ID of the orginal service if you give it an aspect.

Parameters:
ref - the service reference to determine the service ID of
Returns:
the service ID

isAspect

public static boolean isAspect(ServiceReference ref)
Determines if the service is an aspect as defined by the dependency manager. Aspects are defined by a property and this method will check for its presence.

Parameters:
ref - the service reference
Returns:
true if it's an aspect, false otherwise

toString

public static String toString(ServiceReference ref)
Converts a service reference to a string, listing both the bundle it was registered from and all properties.

Parameters:
ref - the service reference
Returns:
a string representation of the service


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.