@Component(role=BundleReader.class) public class DefaultBundleReader extends org.codehaus.plexus.logging.AbstractLogEnabled implements BundleReader
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CACHE_PATH |
private java.io.File |
cacheDir |
private java.util.Set<java.lang.String> |
extractedFiles |
private FileLockService |
fileLockService |
private LRUCache<java.lang.String,OsgiManifest> |
manifestCache |
| Constructor and Description |
|---|
DefaultBundleReader() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
copyStreamToFile(java.io.InputStream in,
java.io.File outputFile,
long timestamp) |
private OsgiManifest |
doLoadManifest(java.io.File bundleLocation) |
private void |
extractZipEntries(java.io.File bundleLocation,
java.lang.String path,
java.io.File outputDirectory) |
java.io.File |
getEntry(java.io.File bundleLocation,
java.lang.String path)
Returns bundle entry with given path or
null if no such entry exists. |
OsgiManifest |
loadManifest(java.io.File bundleLocation)
Load and cache OSGi manifest from path META-INF/MANIFEST.MF under the given location.
|
private OsgiManifest |
loadManifestFile(java.io.File manifestFile) |
private OsgiManifest |
loadManifestFromDirectory(java.io.File directory) |
private OsgiManifest |
loadManifestFromFile(java.io.File bundleLocation) |
void |
setLocationRepository(java.io.File basedir) |
public static final java.lang.String CACHE_PATH
private final LRUCache<java.lang.String,OsgiManifest> manifestCache
private java.io.File cacheDir
private java.util.Set<java.lang.String> extractedFiles
@Requirement private FileLockService fileLockService
public OsgiManifest loadManifest(java.io.File bundleLocation)
BundleReaderloadManifest in interface BundleReaderbundleLocation - can be either a directory or a jar filenullprivate OsgiManifest doLoadManifest(java.io.File bundleLocation)
private OsgiManifest loadManifestFromFile(java.io.File bundleLocation) throws java.io.IOException
java.io.IOExceptionprivate OsgiManifest loadManifestFromDirectory(java.io.File directory) throws java.io.IOException
java.io.IOExceptionprivate OsgiManifest loadManifestFile(java.io.File manifestFile) throws java.io.IOException, OsgiManifestParserException
java.io.IOExceptionOsgiManifestParserExceptionpublic void setLocationRepository(java.io.File basedir)
public java.io.File getEntry(java.io.File bundleLocation,
java.lang.String path)
BundleReadernull if no such entry exists. If bundle
is a jar, the entry will be extracted into a cached location.getEntry in interface BundleReaderbundleLocation - can be either a directory or a jar filepath - path relative to the bundle root. Paths starting with "external:" are ignoredprivate void extractZipEntries(java.io.File bundleLocation,
java.lang.String path,
java.io.File outputDirectory)
throws java.io.IOException
java.io.IOExceptionprivate static void copyStreamToFile(java.io.InputStream in,
java.io.File outputFile,
long timestamp)
throws java.io.IOException
java.io.IOException