Package org.nuxeo.osgi
Class JarBundleFile
java.lang.Object
org.nuxeo.osgi.JarBundleFile
- All Implemented Interfaces:
BundleFile
- Direct Known Subclasses:
NestedJarBundleFile
- Author:
- Bogdan Stefanescu
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close underlying file resources *static void
extractNestedJar
(JarFile file, String path, File dest) static void
extractNestedJar
(JarFile file, ZipEntry entry, File dest) findEntries
(String name, String pattern, boolean recurse) Finds entries in that bundle.findNestedBundles
(File tmpDir) Get a list with nested bundles or null if none.Gets the entry at the given path in this bundle.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.protected final URL
getEntryUrl
(String name) getFile()
Gets the current location of the bundle as a file.Gets the original file name of this bundle.Gets the original location of this bundle.Gets the bundle manifest.getNestedBundles
(File tmpDir) Gets a list with nested bundles or null if none.Gets this bundle symbolic name.getURL()
Gets the current location of the bundle as an URL (it may be different from the original location).boolean
Checks if this bundle is a directory (an exploded jar).boolean
isJar()
Checks if this bundle is a JAR.toString()
-
Field Details
-
jarFile
-
urlBase
-
-
Constructor Details
-
JarBundleFile
- Throws:
IOException
-
JarBundleFile
-
-
Method Details
-
findEntries
Description copied from interface:BundleFile
Finds entries in that bundle.- Specified by:
findEntries
in interfaceBundleFile
- See Also:
-
Bundle.findEntries(String, String, boolean)
-
getEntry
Description copied from interface:BundleFile
Gets the entry at the given path in this bundle.- Specified by:
getEntry
in interfaceBundleFile
- Returns:
- the entry URL if any null otherwise
- See Also:
-
Bundle.getEntry(String)
-
getEntryPaths
Description copied from interface:BundleFile
Returns an Enumeration of all the paths (String
objects) to entries within the bundle whose longest sub-path matches the supplied path argument.- Specified by:
getEntryPaths
in interfaceBundleFile
- See Also:
-
Bundle.getEntryPaths(String)
-
getFile
Description copied from interface:BundleFile
Gets the current location of the bundle as a file.- Specified by:
getFile
in interfaceBundleFile
- Returns:
- the bundle file or null if the bundle is not a file
-
getFileName
Description copied from interface:BundleFile
Gets the original file name of this bundle.- Specified by:
getFileName
in interfaceBundleFile
- Returns:
- the bundle file name
-
getLocation
Description copied from interface:BundleFile
Gets the original location of this bundle.This is an URI string pointing to the original locatioon of the bundle.
- Specified by:
getLocation
in interfaceBundleFile
- Returns:
- the location
-
getManifest
Description copied from interface:BundleFile
Gets the bundle manifest.- Specified by:
getManifest
in interfaceBundleFile
- Returns:
- the bundle manifest
-
getNestedBundles
Description copied from interface:BundleFile
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.- Specified by:
getNestedBundles
in interfaceBundleFile
- Parameters:
tmpDir
- optional temporary dir if the nested bundle should be extracted from an archive- Throws:
IOException
-
extractNestedJar
- Throws:
IOException
-
extractNestedJar
- Throws:
IOException
-
findNestedBundles
Description copied from interface:BundleFile
Get a list with nested bundles or null if none. The bundle file will be scanned for nested JARs.- Specified by:
findNestedBundles
in interfaceBundleFile
- Parameters:
tmpDir
- optional temporary dir if the nested bundle should be extracted from an archive- Throws:
IOException
-
getSymbolicName
Description copied from interface:BundleFile
Gets this bundle symbolic name. If this bundle is an OSGi bundle, then the Bundle-SymbolicName manifest header is returned, otherwise null is returned.- Specified by:
getSymbolicName
in interfaceBundleFile
- Returns:
- null if not an OSGi bundle, the OSGI bundle symbolic name otherwise
-
getURL
Description copied from interface:BundleFile
Gets the current location of the bundle as an URL (it may be different from the original location).- Specified by:
getURL
in interfaceBundleFile
- Returns:
- the bundle url
-
getJarURL
-
isDirectory
public boolean isDirectory()Description copied from interface:BundleFile
Checks if this bundle is a directory (an exploded jar).- Specified by:
isDirectory
in interfaceBundleFile
- Returns:
- true if the bundle is a directory, false otherwise
-
isJar
public boolean isJar()Description copied from interface:BundleFile
Checks if this bundle is a JAR.- Specified by:
isJar
in interfaceBundleFile
- Returns:
- true if the bundle is a JAR, false otherwise
-
toString
-
getEntryUrl
- Throws:
MalformedURLException
-
close
Description copied from interface:BundleFile
Close underlying file resources *- Specified by:
close
in interfaceBundleFile
- Throws:
IOException
-