Class Bundles

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

public final class Bundles extends Object
Utility functions helpful in working with bundles.
  • 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 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.