org.jclouds.osgi
Class Bundles

java.lang.Object
  extended by org.jclouds.osgi.Bundles

public final class Bundles
extends Object

Utility functions helpful in working with bundles.

Author:
Adrian Cole

Method Summary
static
<T> com.google.common.collect.ImmutableSet<T>
instantiateAvailableClasses(org.osgi.framework.Bundle bundle, Iterable<String> classNames, Class<T> type)
          instantiates the supplied classnames using the bundle classloader, and casts to the supplied type.
static com.google.common.collect.ImmutableSet<String> stringsForResorceInBundle(String resourcePath, org.osgi.framework.Bundle bundle)
          Reads the resource from a Bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instantiateAvailableClasses

public static <T> com.google.common.collect.ImmutableSet<T> instantiateAvailableClasses(org.osgi.framework.Bundle bundle,
                                                                                        Iterable<String> classNames,
                                                                                        Class<T> type)
instantiates the supplied classnames using the bundle classloader, and casts to the supplied type. Any errors are silently ignored.

Returns:
instances that could be instantiated without error.

stringsForResorceInBundle

public static com.google.common.collect.ImmutableSet<String> stringsForResorceInBundle(String resourcePath,
                                                                                       org.osgi.framework.Bundle bundle)
Reads the resource from a Bundle.

Parameters:
resourcePath - The path to the resource.
bundle - The bundle to read from.
Returns:
strings delimited by newline in the stream or empty set, on any exception.


Copyright © 2009-2013 jclouds. All Rights Reserved.