Package org.java.plugin.tools
Class PluginArchiver
java.lang.Object
org.java.plugin.tools.PluginArchiver
Plug-ins archive support class.
- Version:
- $Id$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface to filter plug-ins being processed. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidpack(PluginDescriptor descr, PathResolver pathResolver, File destFile) Packs given plug-in into single ZIP file.static voidpack(PluginFragment fragment, PathResolver pathResolver, File destFile) Packs given plug-in fragment into single ZIP file.pack(PluginRegistry registry, PathResolver pathResolver, File destFile) Packs all plug-ins from given registry as one archive file.pack(PluginRegistry registry, PathResolver pathResolver, File destFile, PluginArchiver.Filter filter) Packs plug-ins from given registry as one archive file according to given filter.readDescriptor(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.readDescriptor(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.Extracts all plug-ins from the given archive file.unpack(URL archiveFile, File destFolder, PluginArchiver.Filter filter) Extracts plug-ins from the given archive file according to given filter.unpack(URL archiveFile, PluginRegistry registry, File destFolder) Extracts plug-ins from the given archive file.unpack(URL archiveFile, PluginRegistry registry, File destFolder, PluginArchiver.Filter filter) Extracts plug-ins from the given archive file.
-
Method Details
-
pack
public static void pack(PluginDescriptor descr, PathResolver pathResolver, File destFile) throws IOException Packs given plug-in into single ZIP file. Resulting file may be used to run plug-ins from.- Parameters:
descr- plug-in descriptorpathResolver- path resolver instancedestFile- target file- Throws:
IOException- if an I/O error has occurred
-
pack
public static void pack(PluginFragment fragment, PathResolver pathResolver, File destFile) throws 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 descriptorpathResolver- path resolver instancedestFile- target file- Throws:
IOException- if an I/O error has occurred
-
pack
public static Set<String> pack(PluginRegistry registry, PathResolver pathResolver, File destFile) throws IOException Packs all plug-ins from given registry as one archive file.- Parameters:
registry- plug-ins registrypathResolver- 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:
IOException- if an I/O error has occurred
-
pack
public static Set<String> pack(PluginRegistry registry, PathResolver pathResolver, File destFile, PluginArchiver.Filter filter) throws IOException Packs plug-ins from given registry as one archive file according to given filter.- Parameters:
registry- plug-ins registrypathResolver- 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:
IOException- if an I/O error has occurred
-
unpack
public static Set<String> unpack(URL archiveFile, PluginRegistry registry, File destFolder) throws ManifestProcessingException, IOException, ClassNotFoundException Extracts plug-ins from the given archive file.- Parameters:
archiveFile- plug-in archive fileregistry- plug-in registry where to register manifests for unpacked plug-insdestFolder- target folder- Returns:
- set of UID's of all un-packed (and registered) plug-ins
- Throws:
IOException- if an I/O error has occurredClassNotFoundException- if descriptor can't be readManifestProcessingException- if manifest can't be registered (optional behavior)- See Also:
-
unpack
public static Set<String> unpack(URL archiveFile, PluginRegistry registry, File destFolder, PluginArchiver.Filter filter) throws IOException, ManifestProcessingException, 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 fileregistry- plug-in registry where to register manifests for unpacked plug-insdestFolder- target folderfilter- filter to be used when un-packing plug-ins- Returns:
- set of UID's of all un-packed (and registered) plug-ins
- Throws:
ClassNotFoundException- if plug-ins archive descriptor can't be de-serializedManifestProcessingException- if plug-in manifests can't be registeredIOException- if archive damaged or I/O error has occurred
-
unpack
public static Set<String> unpack(URL archiveFile, File destFolder) throws ManifestProcessingException, IOException, ClassNotFoundException Extracts all plug-ins from the given archive file.
Note:
Standard plug-in registryimplementation will be used internally to read plug-in manifests.- Parameters:
archiveFile- plug-in archive filedestFolder- target folder- Returns:
- set of UID's of all un-packed plug-ins
- Throws:
IOException- if an I/O error has occurredClassNotFoundException- if descriptor can't be readManifestProcessingException- if manifest can't be registered (optional behavior)- See Also:
-
unpack
public static Set<String> unpack(URL archiveFile, File destFolder, PluginArchiver.Filter filter) throws ManifestProcessingException, IOException, ClassNotFoundException Extracts plug-ins from the given archive file according to given filter.
Note:
Standard plug-in registryimplementation will be used internally to read plug-in manifests.- Parameters:
archiveFile- plug-in archive filedestFolder- target folderfilter- filter to be used when un-packing plug-ins- Returns:
- set of UID's of all un-packed plug-ins
- Throws:
IOException- if an I/O error has occurredClassNotFoundException- if descriptor can't be readManifestProcessingException- if manifest can't be registered (optional behavior)
-
readDescriptor
public static Set<String> readDescriptor(URL archiveFile, PluginRegistry registry) throws IOException, 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 fileregistry- plug-in registry where to register discovered manifests for archived plug-ins- Returns:
- set of UID's of all registered plug-ins
- Throws:
IOException- if an I/O error has occurredClassNotFoundException- if descriptor can't be readManifestProcessingException- if manifest can't be registered (optional behavior)- See Also:
-
readDescriptor
public static Set<String> readDescriptor(URL archiveFile, PluginRegistry registry, PluginArchiver.Filter filter) throws IOException, 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 fileregistry- plug-in registry where to register discovered manifests for archived plug-insfilter- filter to be used when un-packing plug-ins- Returns:
- set of UID's of all registered plug-ins
- Throws:
IOException- if an I/O error has occurredClassNotFoundException- if descriptor can't be readManifestProcessingException- if manifest can't be registered (optional behavior)
-