Class 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 Detail

      • 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
    • Constructor Detail

      • DefaultBundleReader

        public DefaultBundleReader()
    • 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 interface BundleReader
        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
      • 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 or null if no such entry exists. If bundle is a jar, the entry will be extracted into a cached location.
        Specified by:
        getEntry in interface BundleReader
        Parameters:
        bundleLocation - can be either a directory or a jar file
        path - 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