Class PluginArchiver


  • public final class PluginArchiver
    extends java.lang.Object
    Plug-ins archive support class.
    Version:
    $Id$
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  PluginArchiver.Filter
      Callback interface to filter plug-ins being processed.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void pack​(PluginDescriptor descr, PathResolver pathResolver, java.io.File destFile)
      Packs given plug-in into single ZIP file.
      static void pack​(PluginFragment fragment, PathResolver pathResolver, java.io.File destFile)
      Packs given plug-in fragment into single ZIP file.
      static java.util.Set<java.lang.String> pack​(PluginRegistry registry, PathResolver pathResolver, java.io.File destFile)
      Packs all plug-ins from given registry as one archive file.
      static java.util.Set<java.lang.String> pack​(PluginRegistry registry, PathResolver pathResolver, java.io.File destFile, PluginArchiver.Filter filter)
      Packs plug-ins from given registry as one archive file according to given filter.
      static java.util.Set<java.lang.String> readDescriptor​(java.net.URL archiveFile, PluginRegistry registry)
      Reads meta-information from plug-ins archive file and registers found plug-in manifest data with given registry for future analysis.
      static java.util.Set<java.lang.String> readDescriptor​(java.net.URL archiveFile, PluginRegistry registry, PluginArchiver.Filter filter)
      Reads meta-information from plug-ins archive file and registers found plug-in manifest data with given registry for future analysis.
      static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile, java.io.File destFolder)
      Extracts all plug-ins from the given archive file.
      static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile, java.io.File destFolder, PluginArchiver.Filter filter)
      Extracts plug-ins from the given archive file according to given filter.
      static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile, PluginRegistry registry, java.io.File destFolder)
      Extracts plug-ins from the given archive file.
      static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile, PluginRegistry registry, java.io.File destFolder, PluginArchiver.Filter filter)
      Extracts plug-ins from the given archive file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • pack

        public static void pack​(PluginDescriptor descr,
                                PathResolver pathResolver,
                                java.io.File destFile)
                         throws java.io.IOException
        Packs given plug-in into single ZIP file. Resulting file may be used to run plug-ins from.
        Parameters:
        descr - plug-in descriptor
        pathResolver - path resolver instance
        destFile - target file
        Throws:
        java.io.IOException - if an I/O error has occurred
      • pack

        public static void pack​(PluginFragment fragment,
                                PathResolver pathResolver,
                                java.io.File destFile)
                         throws java.io.IOException
        Packs given plug-in fragment into single ZIP file. Resulting file may be used to run plug-ins from.
        Parameters:
        fragment - plug-in fragment descriptor
        pathResolver - path resolver instance
        destFile - target file
        Throws:
        java.io.IOException - if an I/O error has occurred
      • pack

        public static java.util.Set<java.lang.String> pack​(PluginRegistry registry,
                                                           PathResolver pathResolver,
                                                           java.io.File destFile)
                                                    throws java.io.IOException
        Packs all plug-ins from given registry as one archive file.
        Parameters:
        registry - plug-ins registry
        pathResolver - path resolver (only local file URLs are supported)
        destFile - target archive file (will be overridden if any exists)
        Returns:
        set of UID's of all packed plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
      • pack

        public static java.util.Set<java.lang.String> pack​(PluginRegistry registry,
                                                           PathResolver pathResolver,
                                                           java.io.File destFile,
                                                           PluginArchiver.Filter filter)
                                                    throws java.io.IOException
        Packs plug-ins from given registry as one archive file according to given filter.
        Parameters:
        registry - plug-ins registry
        pathResolver - path resolver (only local file URLs are supported)
        destFile - target archive file (will be overridden if any exists)
        filter - filter to be used when packing plug-ins
        Returns:
        set of UID's of all packed plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
      • unpack

        public static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile,
                                                             PluginRegistry registry,
                                                             java.io.File destFolder)
                                                      throws ManifestProcessingException,
                                                             java.io.IOException,
                                                             java.lang.ClassNotFoundException
        Extracts plug-ins from the given archive file.
        Parameters:
        archiveFile - plug-in archive file
        registry - plug-in registry where to register manifests for unpacked plug-ins
        destFolder - target folder
        Returns:
        set of UID's of all un-packed (and registered) plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
        java.lang.ClassNotFoundException - if descriptor can't be read
        ManifestProcessingException - if manifest can't be registered (optional behavior)
        See Also:
        unpack(URL, PluginRegistry, File, PluginArchiver.Filter)
      • unpack

        public static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile,
                                                             PluginRegistry registry,
                                                             java.io.File destFolder,
                                                             PluginArchiver.Filter filter)
                                                      throws java.io.IOException,
                                                             ManifestProcessingException,
                                                             java.lang.ClassNotFoundException
        Extracts plug-ins from the given archive file.
        Note:
        In the current implementation all plug-in manifests are extracted to temporary local storage and deleted immediately after their registration with plug-in registry. So manifest URL's are actually point to "fake" locations.
        Parameters:
        archiveFile - plug-in archive file
        registry - plug-in registry where to register manifests for unpacked plug-ins
        destFolder - target folder
        filter - filter to be used when un-packing plug-ins
        Returns:
        set of UID's of all un-packed (and registered) plug-ins
        Throws:
        java.lang.ClassNotFoundException - if plug-ins archive descriptor can't be de-serialized
        ManifestProcessingException - if plug-in manifests can't be registered
        java.io.IOException - if archive damaged or I/O error has occurred
      • unpack

        public static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile,
                                                             java.io.File destFolder)
                                                      throws ManifestProcessingException,
                                                             java.io.IOException,
                                                             java.lang.ClassNotFoundException
        Extracts all plug-ins from the given archive file.
        Note:
        Standard plug-in registry implementation will be used internally to read plug-in manifests.
        Parameters:
        archiveFile - plug-in archive file
        destFolder - target folder
        Returns:
        set of UID's of all un-packed plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
        java.lang.ClassNotFoundException - if descriptor can't be read
        ManifestProcessingException - if manifest can't be registered (optional behavior)
        See Also:
        ObjectFactory.createRegistry()
      • unpack

        public static java.util.Set<java.lang.String> unpack​(java.net.URL archiveFile,
                                                             java.io.File destFolder,
                                                             PluginArchiver.Filter filter)
                                                      throws ManifestProcessingException,
                                                             java.io.IOException,
                                                             java.lang.ClassNotFoundException
        Extracts plug-ins from the given archive file according to given filter.
        Note:
        Standard plug-in registry implementation will be used internally to read plug-in manifests.
        Parameters:
        archiveFile - plug-in archive file
        destFolder - target folder
        filter - filter to be used when un-packing plug-ins
        Returns:
        set of UID's of all un-packed plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
        java.lang.ClassNotFoundException - if descriptor can't be read
        ManifestProcessingException - if manifest can't be registered (optional behavior)
      • readDescriptor

        public static java.util.Set<java.lang.String> readDescriptor​(java.net.URL archiveFile,
                                                                     PluginRegistry registry)
                                                              throws java.io.IOException,
                                                                     java.lang.ClassNotFoundException,
                                                                     ManifestProcessingException
        Reads meta-information from plug-ins archive file and registers found plug-in manifest data with given registry for future analysis.
        Parameters:
        archiveFile - plug-in archive file
        registry - plug-in registry where to register discovered manifests for archived plug-ins
        Returns:
        set of UID's of all registered plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
        java.lang.ClassNotFoundException - if descriptor can't be read
        ManifestProcessingException - if manifest can't be registered (optional behavior)
        See Also:
        readDescriptor(URL, PluginRegistry, PluginArchiver.Filter)
      • readDescriptor

        public static java.util.Set<java.lang.String> readDescriptor​(java.net.URL archiveFile,
                                                                     PluginRegistry registry,
                                                                     PluginArchiver.Filter filter)
                                                              throws java.io.IOException,
                                                                     java.lang.ClassNotFoundException,
                                                                     ManifestProcessingException
        Reads meta-information from plug-ins archive file and registers found plug-in manifest data with given registry for future analysis.
        Note:
        In the current implementation all plug-in manifests are extracted to temporary local storage and deleted immediately after their registration with plug-in registry. So manifest URL's are actually point to "fake" locations and main purpose of this method is to allow you to analyze plug-ins archive without needing to download and unpack it.
        Parameters:
        archiveFile - plug-in archive file
        registry - plug-in registry where to register discovered manifests for archived plug-ins
        filter - filter to be used when un-packing plug-ins
        Returns:
        set of UID's of all registered plug-ins
        Throws:
        java.io.IOException - if an I/O error has occurred
        java.lang.ClassNotFoundException - if descriptor can't be read
        ManifestProcessingException - if manifest can't be registered (optional behavior)