Class BundleFileWrapper
java.lang.Object
org.eclipse.osgi.storage.bundlefile.BundleFile
org.eclipse.osgi.storage.bundlefile.BundleFileWrapper
- Direct Known Subclasses:
BundleFileWrapperChain
A
bundle file
decorator.
Clients wishing to modify or extend the behavior of a bundle file at runtime
should extend this class instead. A hook is provided by the related
abstract factory
class in response to a
call
from the framework.
-
Field Summary
Fields inherited from class org.eclipse.osgi.storage.bundlefile.BundleFile
basefile
-
Constructor Summary
ConstructorsConstructorDescriptionBundleFileWrapper
(BundleFile bundleFile) Creates a newBundleFileWrapper
instance wrapping the givenbundle file
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the BundleFile.boolean
containsDir
(String dir) Determines if any BundleEntries exist in the given directory path.protected URL
createResourceURL
(BundleEntry bundleEntry, Module hostModule, int index, String path) Creates a URL to access the content of the specified entryGet the wrapped bundle file.Locates a file name in this bundle and returns a BundleEntry objectgetEntryPaths
(String path) Performs the same function as callingBundleFile.getEntryPaths(String, boolean)
withrecurse
equal tofalse
.getEntryPaths
(String path, boolean recurse) Allows to access the entries of the bundle.Returns a File for the bundle entry specified by the path.void
open()
Opens the BundleFiles.Methods inherited from class org.eclipse.osgi.storage.bundlefile.BundleFile
createURL, fixTrailingSlash, getBaseFile, getResourceURL, toString
-
Constructor Details
-
BundleFileWrapper
Creates a newBundleFileWrapper
instance wrapping the givenbundle file
.- Parameters:
bundleFile
- - The bundle file to wrap.- Throws:
NullPointerException
- - If the bundle file isnull
.
-
-
Method Details
-
getFile
Description copied from class:BundleFile
Returns a File for the bundle entry specified by the path. If required the content of the bundle entry is extracted into a file on the file system.- Specified by:
getFile
in classBundleFile
- Parameters:
path
- The path to the entry to locate a File for.nativeCode
- true if the path is native code.- Returns:
- A File object to access the contents of the bundle entry.
-
getEntry
Description copied from class:BundleFile
Locates a file name in this bundle and returns a BundleEntry object- Specified by:
getEntry
in classBundleFile
- Parameters:
path
- path of the entry to locate in the bundle- Returns:
- BundleEntry object or null if the file name does not exist in the bundle
-
getEntryPaths
Description copied from class:BundleFile
Performs the same function as callingBundleFile.getEntryPaths(String, boolean)
withrecurse
equal tofalse
.- Overrides:
getEntryPaths
in classBundleFile
- Parameters:
path
- path of the entry to locate in the bundle- Returns:
- an Enumeration of Strings that indicate the paths found or null if the path does not exist.
-
getEntryPaths
Description copied from class:BundleFile
Allows to access the entries of the bundle. Since the bundle content is usually a jar, this allows to access the jar contents. GetEntryPaths allows to enumerate the content of "path". If path is a directory, it is equivalent to listing the directory contents. The returned names are either files or directories themselves. If a returned name is a directory, it finishes with a slash. If a returned name is a file, it does not finish with a slash.- Specified by:
getEntryPaths
in classBundleFile
- Parameters:
path
- path of the entry to locate in the bundlerecurse
- - Iftrue
, provide entries for the files and directories within the directory denoted bypath
plus all sub-directories and files; otherwise, provide only the entries within the immediate directory.- Returns:
- an Enumeration of Strings that indicate the paths found or null if the path does not exist.
-
getBundleFile
Get the wrapped bundle file.- Returns:
- The wrapped bundle file.
-
close
Description copied from class:BundleFile
Closes the BundleFile.- Specified by:
close
in classBundleFile
- Throws:
IOException
- if any error occurs.
-
open
Description copied from class:BundleFile
Opens the BundleFiles.- Specified by:
open
in classBundleFile
- Throws:
IOException
- if any error occurs.
-
containsDir
Description copied from class:BundleFile
Determines if any BundleEntries exist in the given directory path.- Specified by:
containsDir
in classBundleFile
- Parameters:
dir
- The directory path to check existence of.- Returns:
- true if the BundleFile contains entries under the given directory path; false otherwise.
-
createResourceURL
Description copied from class:BundleFile
Creates a URL to access the content of the specified entry- Overrides:
createResourceURL
in classBundleFile
- Parameters:
bundleEntry
- the bundle entryhostModule
- the host moduleindex
- the resource index- Returns:
- a URL to access the contents of the specified entry
-