org.glassfish.fighterfish.test.util
Class OSGiUtil

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

public class OSGiUtil
extends java.lang.Object

Author:
Sanjeeb.Sahoo@Sun.COM

Constructor Summary
OSGiUtil()
           
 
Method Summary
static
<T> T
getService(org.osgi.framework.BundleContext ctx, java.lang.Class<T> type)
           
static
<T> T
getService(org.osgi.framework.BundleContext ctx, java.lang.Class<T> type, long timeout)
           
static java.lang.Object waitForService(org.osgi.framework.BundleContext ctx, org.osgi.framework.Bundle b, java.lang.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,
                               java.lang.Class<T> type)

getService

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

waitForService

public static java.lang.Object waitForService(org.osgi.framework.BundleContext ctx,
                                              org.osgi.framework.Bundle b,
                                              java.lang.String service,
                                              long timeout)
                                       throws java.lang.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:
java.lang.InterruptedException


Copyright © 2013. All Rights Reserved.