org.glassfish.fighterfish.test.util
Class OSGiUtil

java.lang.Object
  extended by org.glassfish.fighterfish.test.util.OSGiUtil

public class OSGiUtil
extends Object

Author:
Sanjeeb.Sahoo@Sun.COM

Constructor Summary
OSGiUtil()
           
 
Method Summary
static
<T> T
getService(org.osgi.framework.BundleContext ctx, Class<T> type)
           
static
<T> T
getService(org.osgi.framework.BundleContext ctx, Class<T> type, long timeout)
           
static Object waitForService(org.osgi.framework.BundleContext ctx, org.osgi.framework.Bundle b, String service, long timeout)
          Wait for a specified amount of time for a service of a given type to be made available by a given bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiUtil

public OSGiUtil()
Method Detail

getService

public static <T> T getService(org.osgi.framework.BundleContext ctx,
                               Class<T> type)

getService

public static <T> T getService(org.osgi.framework.BundleContext ctx,
                               Class<T> type,
                               long timeout)
                    throws InterruptedException
Throws:
InterruptedException

waitForService

public static Object waitForService(org.osgi.framework.BundleContext ctx,
                                    org.osgi.framework.Bundle b,
                                    String service,
                                    long timeout)
                             throws InterruptedException
Wait for a specified amount of time for a service of a given type to be made available by a given bundle.

Parameters:
ctx - BundleContext that should be used to track the service
b - Bundle registering the service
service - FQN of the service type
timeout - no of milliseconds to wait for the service to be available before returning null
Returns:
a reference to the service being tracked
Throws:
InterruptedException


Copyright © 2011. All Rights Reserved.