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 IPluginFileHelper
createFacade
(PluginRuntime runtime) Creates a new plugin file helper that delegates to the given runtime.static void
static void
deletePluginFiles
(String scopeKey, String runtimeKey) static void
deletePluginJarAndUnpacked
(File jarFile) static File
getPluginFolder
(PluginRuntime runtime) The path to the folder with all plugin files, such as/tmp/formcycle/system/04ed
.static File
getPluginFolder
(String scopeKey, String runtimeKey) The path to the folder with all plugin files, such as/tmp/formcycle/system/04ed
.static File
getPluginJarFile
(PluginRuntime runtime) The path to the JAR file of the plugin, such as/tmp/formcycle/system/04ed/plugin.jar
.static File
getPluginJarFile
(String scopeKey, String runtimeKey) The path to the JAR file of the plugin, such as/tmp/formcycle/system/04ed/plugin.jar
.static File
Finds the plugin JAR file from a given root directory.static File
getPluginJarUnpackedDir
(PluginRuntime runtime) The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin
.static File
getPluginJarUnpackedDir
(File file) The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin
.static File
getPluginJarUnpackedDir
(String scopeKey, String runtimeKey) The base directory with all files from an unpacked JAR, such as/tmp/formcycle/system/04ed/plugin
.static File
The manifest file from the unpacked JAR, such as/tmp/formcycle/system/04ed/plugin/MANIFEST.MF
.static File
getPluginJarUnpackedManifestFile
(String scopeKey, String runtimeKey) The manifest file from the unpacked JAR, such as/tmp/formcycle/system/04ed/plugin/MANIFEST.MF
.static File
The root directory with the unpacked files from the JAR, such as/tmp/formcycle/system/04ed/plugin/root
.static File
getPluginJarUnpackedRootDir
(String scopeKey, String runtimeKey) The root directory with the unpacked files from the JAR, such as/tmp/formcycle/system/04ed/plugin/root
.static File
static File
getPluginMetaFile
(String scopeKey, String runtimeKey) static File
static File
getPluginPropertiesFile
(String scopeKey, String runtimeKey) static boolean
isUnpackedJarDir
(File file) static void
removeJarFileCacheEntries
(File jarToDelete) Deprecated.This depends on internal implementation details of the JDK and may or may not work.static void
removeJarFileCacheEntries
(JarFile jarToDelete) Deprecated.This depends on internal implementation details of the JDK and may or may not work.static UnpackedJarFile
unpackJarFile
(File file, File unpackedDir) Unpacks the contents of a JAR file to a given directory.static void
updatePluginFiles
(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.jar
and to delete caches is not supported by Java anymore under the new module system.Attempts to remove any cache entry forJarURLConnection
andJarFile
.- 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.jar
and to delete caches is not supported by Java anymore under the new module system.Attempts to remove any cache entry forJarURLConnection
andJarFile
.- 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 directory
itself.- 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 directory
itself.- 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.
-