Package de.xima.fc.plugin.helper
Class PluginFileHelper
java.lang.Object
de.xima.fc.plugin.helper.PluginFileHelper
- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IPluginFileHelpercreateFacade(PluginRuntime runtime) Creates a new plugin file helper that delegates to the given runtime.static voidstatic voiddeletePluginFiles(String scopeKey, String runtimeKey) static voiddeletePluginJarAndUnpacked(File jarFile) static FilegetPluginFolder(PluginRuntime runtime) The path to the folder with all plugin files, such as/tmp/formcycle/system/04ed.static FilegetPluginFolder(String scopeKey, String runtimeKey) The path to the folder with all plugin files, such as/tmp/formcycle/system/04ed.static FilegetPluginJarFile(PluginRuntime runtime) The path to the JAR file of the plugin, such as/tmp/formcycle/system/04ed/plugin.jar.static FilegetPluginJarFile(String scopeKey, String runtimeKey) The path to the JAR file of the plugin, such as/tmp/formcycle/system/04ed/plugin.jar.static FileFinds the plugin JAR file from a given root directory.static FilegetPluginJarUnpackedDir(PluginRuntime runtime) The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin.static FilegetPluginJarUnpackedDir(File file) The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin.static FilegetPluginJarUnpackedDir(String scopeKey, String runtimeKey) The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin.static FileThe manifest file from the unpacked JAR, such as/tmp/formcycle/system/04ed/plugin/MANIFEST.MF.static FilegetPluginJarUnpackedManifestFile(String scopeKey, String runtimeKey) The manifest file from the unpacked JAR, such as/tmp/formcycle/system/04ed/plugin/MANIFEST.MF.static FileThe root directory with the unpacked files from the JAR, such as/tmp/formcycle/system/04ed/plugin/root.static FilegetPluginJarUnpackedRootDir(String scopeKey, String runtimeKey) The root directory with the unpacked files from the JAR, such as/tmp/formcycle/system/04ed/plugin/root.static Filestatic FilegetPluginMetaFile(String scopeKey, String runtimeKey) static Filestatic FilegetPluginPropertiesFile(String scopeKey, String runtimeKey) static booleanisUnpackedJarDir(File file) static voidremoveJarFileCacheEntries(File jarToDelete) Deprecated.This depends on internal implementation details of the JDK and may or may not work.static voidremoveJarFileCacheEntries(JarFile jarToDelete) Deprecated.This depends on internal implementation details of the JDK and may or may not work.static UnpackedJarFileunpackJarFile(File file, File unpackedDir) Unpacks the contents of a JAR file to a given directory.static voidupdatePluginFiles(PluginSyncData pluginData)
-
Constructor Details
-
PluginFileHelper
public PluginFileHelper()
-
-
Method Details
-
updatePluginFiles
- Throws:
IOException
-
removeJarFileCacheEntries
Deprecated.This depends on internal implementation details of the JDK and may or may not work. Using reflection to access the internals ofsun.net.www.protocol.jarand to delete caches is not supported by Java anymore under the new module system.Attempts to remove any cache entry forJarURLConnectionandJarFile.- Parameters:
jarToDelete- the jar file to remove from cache
-
removeJarFileCacheEntries
Deprecated.This depends on internal implementation details of the JDK and may or may not work. Using reflection to access the internals ofsun.net.www.protocol.jarand to delete caches is not supported by Java anymore under the new module system.Attempts to remove any cache entry forJarURLConnectionandJarFile.- Parameters:
jarToDelete- the jar file to remove from cache
-
deletePluginFiles
- Throws:
IOException
-
deletePluginFiles
- Throws:
IOException
-
getPluginPropertiesFile
-
getPluginPropertiesFile
-
getPluginMetaFile
-
getPluginMetaFile
-
getPluginJarFile
The path to the JAR file of the plugin, such as/tmp/formcycle/system/04ed/plugin.jar.- Parameters:
runtime- Runtime of the plugin with a scope and runtime key.- Returns:
- The path to the JAR file of the plugin.
-
getPluginJarFile
The path to the JAR file of the plugin, such as/tmp/formcycle/system/04ed/plugin.jar.- Parameters:
scopeKey- Scope key of the plugin, either the system scope or a client scope.runtimeKey- Unique runtime key of the plugin.- Returns:
- The path to the JAR file of the plugin.
-
getPluginJarUnpackedRootDir
The root directory with the unpacked files from the JAR, such as/tmp/formcycle/system/04ed/plugin/root. This is also the root for the plugin JAR classpath.- Parameters:
file- JAR file path fromgetPluginJarFile(String, String), or theunpacked directoryitself.- Returns:
- The root directory with the unpacked files from the JAR
-
getPluginJarUnpackedRootDir
The root directory with the unpacked files from the JAR, such as/tmp/formcycle/system/04ed/plugin/root. This is also the root for the plugin JAR classpath.- Parameters:
scopeKey- Scope key of the plugin, either the system scope or a client scope.runtimeKey- Unique runtime key of the plugin.- Returns:
- The root directory with the unpacked files from the JAR
-
getPluginJarUnpackedManifestFile
The manifest file from the unpacked JAR, such as/tmp/formcycle/system/04ed/plugin/MANIFEST.MF.- Parameters:
file- JAR file path fromgetPluginJarFile(String, String), or theunpacked directoryitself.- Returns:
- The manifest file from the unpacked JAR
-
getPluginJarUnpackedManifestFile
The manifest file from the unpacked JAR, such as/tmp/formcycle/system/04ed/plugin/MANIFEST.MF.- Parameters:
scopeKey- Scope key of the plugin, either the system scope or a client scope.runtimeKey- Unique runtime key of the plugin.- Returns:
- The manifest file from the unpacked JAR
-
getPluginJarUnpackedDir
The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin. This is also the root for the plugin JAR classpath.- Parameters:
scopeKey- Scope key of the plugin, either the system scope or a client scope.runtimeKey- Unique runtime key of the plugin.- Returns:
- The base directory with all files from an unpacked JAR.
-
getPluginJarUnpackedDir
The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin. This is also the root for the plugin JAR classpath.- Parameters:
runtime- Runtime of the plugin with a scope and runtime key.- Returns:
- The base directory with all files from an unpacked JAR.
-
getPluginJarUnpackedDir
The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin. This is also the root for the plugin JAR classpath.- Parameters:
file- JAR file path fromgetPluginJarFile(String, String), or the unpacked directory itself.- Returns:
- The base directory with all files from an unpacked JAR.
-
getPluginFolder
The path to the folder with all plugin files, such as/tmp/formcycle/system/04ed.- Parameters:
runtime- Runtime of the plugin with a scope and runtime key.- Returns:
- The path to the folder with all plugin files.
-
getPluginFolder
The path to the folder with all plugin files, such as/tmp/formcycle/system/04ed.- Parameters:
scopeKey- Scope key of the plugin, either the system scope or a client scope.runtimeKey- Unique runtime key of the plugin.- Returns:
- The path to the folder with all plugin files.
-
unpackJarFile
Unpacks the contents of a JAR file to a given directory. The directory is deleted, if it exists. For Multi-release JAR files, this method unpacks the files corresponding to the Java versionof the current JVM.- Parameters:
file- A JAR file to unpack.unpackedDir- Target directory. When this directory exists already, it is removed- Returns:
- A descriptor for the various unpacked files.
- Throws:
IOException- When the JAR file could not be read of the unpacked files could not be written to the disk.
-
createFacade
Creates a new plugin file helper that delegates to the given runtime.- Parameters:
runtime- Runtime of an initialized plugin.- Returns:
- A new plugin file helper that delegates to the given runtime.
-
deletePluginJarAndUnpacked
-
isUnpackedJarDir
- Parameters:
file- A directory to check, or a plugin JAR file.- Returns:
- Whether the given directory is an
getPluginJarUnpackedDir(PluginRuntime), or whether the JAR file is next to such a directory.
-
getPluginJarFromUnpackedRootDir
Finds the plugin JAR file from a given root directory. This is the inverse operation ofgetPluginJarFromUnpackedRootDir(File).- Parameters:
file- Anunpacked root dir.- Returns:
- The plugin JAR file for the unpacked root dir.
-