Package org.eclipse.tycho.core.osgitools
Class DefaultBundleReader
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.eclipse.tycho.core.osgitools.DefaultBundleReader
-
- All Implemented Interfaces:
org.codehaus.plexus.logging.LogEnabled
,BundleReader
@Component(role=BundleReader.class) public class DefaultBundleReader extends org.codehaus.plexus.logging.AbstractLogEnabled implements BundleReader
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CACHE_PATH
private java.io.File
cacheDir
private java.util.Set<java.lang.String>
extractedFiles
private FileLockService
fileLockService
private java.util.Map<java.lang.String,OsgiManifest>
manifestCache
-
Constructor Summary
Constructors Constructor Description DefaultBundleReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 ornull
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)
-
-
-
Field Detail
-
CACHE_PATH
public static final java.lang.String CACHE_PATH
- See Also:
- Constant Field Values
-
manifestCache
private final java.util.Map<java.lang.String,OsgiManifest> manifestCache
-
cacheDir
private java.io.File cacheDir
-
extractedFiles
private java.util.Set<java.lang.String> extractedFiles
-
fileLockService
@Requirement private FileLockService fileLockService
-
-
Method Detail
-
loadManifest
public OsgiManifest loadManifest(java.io.File bundleLocation)
Description copied from interface:BundleReader
Load and cache OSGi manifest from path META-INF/MANIFEST.MF under the given location. If no META-INF/MANIFEST.MF is found but plugin.xml or fragment.xml is found, an attempt is made to convert it into an OSGi MANIFEST.- Specified by:
loadManifest
in interfaceBundleReader
- Parameters:
bundleLocation
- can be either a directory or a jar file- Returns:
- the OSGi MANIFEST, never
null
-
doLoadManifest
private OsgiManifest doLoadManifest(java.io.File bundleLocation)
-
loadManifestFromFile
private OsgiManifest loadManifestFromFile(java.io.File bundleLocation) throws java.io.IOException
- Throws:
java.io.IOException
-
loadManifestFromDirectory
private OsgiManifest loadManifestFromDirectory(java.io.File directory) throws java.io.IOException
- Throws:
java.io.IOException
-
loadManifestFile
private OsgiManifest loadManifestFile(java.io.File manifestFile) throws java.io.IOException, OsgiManifestParserException
- Throws:
java.io.IOException
OsgiManifestParserException
-
setLocationRepository
public void setLocationRepository(java.io.File basedir)
-
getEntry
public java.io.File getEntry(java.io.File bundleLocation, java.lang.String path)
Description copied from interface:BundleReader
Returns bundle entry with given path ornull
if no such entry exists. If bundle is a jar, the entry will be extracted into a cached location.- Specified by:
getEntry
in interfaceBundleReader
- Parameters:
bundleLocation
- can be either a directory or a jar filepath
- path relative to the bundle root. Paths starting with "external:" are ignored
-
extractZipEntries
private void extractZipEntries(java.io.File bundleLocation, java.lang.String path, java.io.File outputDirectory) throws java.io.IOException
- Throws:
java.io.IOException
-
copyStreamToFile
private static void copyStreamToFile(java.io.InputStream in, java.io.File outputFile, long timestamp) throws java.io.IOException
- Throws:
java.io.IOException
-
-