Interface BundleFile

All Known Implementing Classes:
DirectoryBundleFile, JarBundleFile, NestedJarBundleFile, SystemBundleFile

public interface BundleFile
Author:
Bogdan Stefanescu
  • Method Details

    • isJar

      boolean isJar()
      Checks if this bundle is a JAR.
      Returns:
      true if the bundle is a JAR, false otherwise
    • isDirectory

      boolean isDirectory()
      Checks if this bundle is a directory (an exploded jar).
      Returns:
      true if the bundle is a directory, false otherwise
    • getSymbolicName

      String getSymbolicName()
      Gets this bundle symbolic name. If this bundle is an OSGi bundle, then the Bundle-SymbolicName manifest header is returned, otherwise null is returned.
      Returns:
      null if not an OSGi bundle, the OSGI bundle symbolic name otherwise
    • getFileName

      String getFileName()
      Gets the original file name of this bundle.
      Returns:
      the bundle file name
    • getLocation

      String getLocation()
      Gets the original location of this bundle.

      This is an URI string pointing to the original locatioon of the bundle.

      Returns:
      the location
    • getURL

      URL getURL()
      Gets the current location of the bundle as an URL (it may be different from the original location).
      Returns:
      the bundle url
    • getFile

      File getFile()
      Gets the current location of the bundle as a file.
      Returns:
      the bundle file or null if the bundle is not a file
    • getManifest

      Manifest getManifest()
      Gets the bundle manifest.
      Returns:
      the bundle manifest
    • getEntry

      URL getEntry(String name)
      Gets the entry at the given path in this bundle.
      Returns:
      the entry URL if any null otherwise
      See Also:
      • Bundle.getEntry(String)
    • getEntryPaths

      Enumeration<String> getEntryPaths(String path)
      Returns an Enumeration of all the paths (String objects) to entries within the bundle whose longest sub-path matches the supplied path argument.
      See Also:
      • Bundle.getEntryPaths(String)
    • findEntries

      Enumeration<URL> findEntries(String name, String pattern, boolean recurse)
      Finds entries in that bundle.
      See Also:
      • Bundle.findEntries(String, String, boolean)
    • getNestedBundles

      Collection<BundleFile> getNestedBundles(File tmpDir) throws IOException
      Gets a list with nested bundles or null if none. The bundle Manifest headers Bundle-ClassPath and Class-Path will be used to retrieve nested jars.
      Parameters:
      tmpDir - optional temporary dir if the nested bundle should be extracted from an archive
      Throws:
      IOException
    • findNestedBundles

      Collection<BundleFile> findNestedBundles(File tmpDir) throws IOException
      Get a list with nested bundles or null if none. The bundle file will be scanned for nested JARs.
      Parameters:
      tmpDir - optional temporary dir if the nested bundle should be extracted from an archive
      Throws:
      IOException
    • close

      void close() throws IOException
      Close underlying file resources *
      Throws:
      IOException
      Since:
      5.6