Package de.xima.fc.proma.util
Class PluginZipScanner
- java.lang.Object
-
- de.xima.fc.proma.util.PluginZipScanner
-
public final class PluginZipScanner extends Object
Helper functions for working with ZIPs containing a list of formcycle plugins. Such files are returned by the PROMA API.- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.commons.lang3.tuple.Pair<File,List<PluginFileKeyData>>
getFileKeyDataList(File zipFile, PluginID pluginId)
This method generates a list ofPluginFileKeyData
which contains data about the file key of an plugin file.static org.apache.commons.lang3.tuple.Pair<File,File>
getFirstPluginFile(File zipFile)
This method unzips a ZIP file and returns the first file if it is a plugin JAR.static Closable<Map<String,PluginJarWithManifest>>
unpackPluginZipAndMapFiles(TempFile zipFile, PluginID pluginId)
Unpacks the given ZIP file to a temporary directory, checks all files and returns a map between the file key of each plugin JAR and the file itself.
-
-
-
Method Detail
-
getFileKeyDataList
public static org.apache.commons.lang3.tuple.Pair<File,List<PluginFileKeyData>> getFileKeyDataList(File zipFile, PluginID pluginId) throws IOException
This method generates a list ofPluginFileKeyData
which contains data about the file key of an plugin file.- Parameters:
zipFile
- the ZIP file which contains the plugin JARspluginId
- ID of the plugin, if known, for dealing with legacy plugins without a Plugin-Key in their Manifest files. Can benull
.- Returns:
- The temporary directory with all unzipped files, and a list of
PluginFileKeyData
which consists of the plugin file key and plugin file informations - Throws:
IOException
- Signals that an I/O exception has occurred.
-
getFirstPluginFile
public static org.apache.commons.lang3.tuple.Pair<File,File> getFirstPluginFile(File zipFile) throws IOException
This method unzips a ZIP file and returns the first file if it is a plugin JAR.- Parameters:
zipFile
- the ZIP file which contains a plugin JAR.- Returns:
- The directory with all unzipped files, and the first file of the ZIP file, if the ZIP contains exactly 1
file; and that file is a
plugin JAR file
. Otherwise, returnsnull
. - Throws:
IOException
- Signals that an I/O exception has occurred.
-
unpackPluginZipAndMapFiles
public static Closable<Map<String,PluginJarWithManifest>> unpackPluginZipAndMapFiles(TempFile zipFile, PluginID pluginId) throws IOException
Unpacks the given ZIP file to a temporary directory, checks all files and returns a map between the file key of each plugin JAR and the file itself.- Parameters:
zipFile
- ZIP file to scan.pluginId
- ID of the plugin, if known, for dealing with legacy plugins without a Plugin-Key in their Manifest files. Can benull
.- Returns:
- A map between the
IPluginEntity.getPluginFileKey()
and the JAR file. - Throws:
IOException
- When the ZIP file could not be processed.
-
-