Package org.jclouds.osgi
Class Bundles
- java.lang.Object
-
- org.jclouds.osgi.Bundles
-
public final class Bundles extends Object
Utility functions helpful in working withbundles
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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>
stringsForResourceInBundle(String resourcePath, org.osgi.framework.Bundle bundle)
Reads the resource from aBundle
.
-
-
-
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.
-
stringsForResourceInBundle
public static com.google.common.collect.ImmutableSet<String> stringsForResourceInBundle(String resourcePath, org.osgi.framework.Bundle bundle)
Reads the resource from aBundle
.- 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.
-
-