Package org.jclouds.osgi
Class Bundles
java.lang.Object
org.jclouds.osgi.Bundles
Utility functions helpful in working with
bundles
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <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 Details
-
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.
-