Class BundleClassSpace

java.lang.Object
org.eclipse.sisu.space.BundleClassSpace
All Implemented Interfaces:
ClassSpace

public final class BundleClassSpace extends Object implements ClassSpace
ClassSpace backed by a strongly-referenced Bundle.
  • Field Details

    • NO_URLS

      private static final URL[] NO_URLS
    • NO_ENTRIES

      private static final Enumeration<URL> NO_ENTRIES
    • bundle

      private final org.osgi.framework.Bundle bundle
    • bundleClassPath

      private URL[] bundleClassPath
  • Constructor Details

    • BundleClassSpace

      public BundleClassSpace(org.osgi.framework.Bundle bundle)
  • Method Details

    • loadClass

      public Class<?> loadClass(String name)
      Description copied from interface: ClassSpace
      Loads the named class from the surrounding class space.
      Specified by:
      loadClass in interface ClassSpace
      Parameters:
      name - The class name
      Returns:
      Class instance
      See Also:
    • deferLoadClass

      public DeferredClass<?> deferLoadClass(String name)
      Description copied from interface: ClassSpace
      Defers loading of the named class from the surrounding class space.
      Specified by:
      deferLoadClass in interface ClassSpace
      Parameters:
      name - The class name
      Returns:
      Deferred class
      See Also:
    • getResource

      public URL getResource(String name)
      Description copied from interface: ClassSpace
      Queries the surrounding class space for the resource with the given name.
      Specified by:
      getResource in interface ClassSpace
      Parameters:
      name - The resource name
      Returns:
      URL pointing to the resource; null if it wasn't found
      See Also:
    • getResources

      public Enumeration<URL> getResources(String name)
      Description copied from interface: ClassSpace
      Queries the surrounding class space for all resources with the given name.
      Specified by:
      getResources in interface ClassSpace
      Parameters:
      name - The resource name
      Returns:
      Sequence of URLs, one for each matching resource
      See Also:
    • findEntries

      public Enumeration<URL> findEntries(String path, String glob, boolean recurse)
      Description copied from interface: ClassSpace
      Queries local class space content for entries matching the given pattern.
      Specified by:
      findEntries in interface ClassSpace
      Parameters:
      path - The initial search directory; for example "META-INF"
      glob - The filename glob pattern; for example "*.xml"
      recurse - If true recurse into sub-directories; otherwise only search initial directory
      Returns:
      Sequence of URLs, one for each matching entry
      See Also:
      • Bundle.findEntries(String, String, boolean)
    • getBundle

      public org.osgi.framework.Bundle getBundle()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object rhs)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBundleClassPath

      private URL[] getBundleClassPath()
      Returns the expanded Bundle-ClassPath; we need this to iterate over embedded JARs.