Class PluginFileHelper

java.lang.Object
de.xima.fc.plugin.helper.PluginFileHelper

public class PluginFileHelper extends Object
Author:
XIMA MEDIA GmbH
  • Constructor Details

    • PluginFileHelper

      public PluginFileHelper()
  • Method Details

    • updatePluginFiles

      public static void updatePluginFiles(PluginSyncData pluginData) throws IOException
      Throws:
      IOException
    • deletePluginFiles

      public static void deletePluginFiles(PluginRuntime prtm) throws IOException
      Throws:
      IOException
    • deletePluginFiles

      public static void deletePluginFiles(String scopeKey, String runtimeKey) throws IOException
      Throws:
      IOException
    • getPluginPropertiesFile

      public static File getPluginPropertiesFile(PluginRuntime rtm)
    • getPluginPropertiesFile

      public static File getPluginPropertiesFile(String scopeKey, String runtimeKey)
    • getPluginMetaFile

      public static File getPluginMetaFile(PluginRuntime rtm)
    • getPluginMetaFile

      public static File getPluginMetaFile(String scopeKey, String runtimeKey)
    • getPluginJarFile

      public static File getPluginJarFile(PluginRuntime runtime)
      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

      public static File getPluginJarFile(String scopeKey, String runtimeKey)
      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

      public static File getPluginJarUnpackedRootDir(File file)
      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 from getPluginJarFile(String, String), or the unpacked directory itself.
      Returns:
      The root directory with the unpacked files from the JAR
    • getPluginJarUnpackedRootDir

      public 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. 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

      public static File getPluginJarUnpackedManifestFile(File file)
      The manifest file from the unpacked JAR, such as /tmp/formcycle/system/04ed/plugin/MANIFEST.MF.
      Parameters:
      file - JAR file path from getPluginJarFile(String, String), or the unpacked directory itself.
      Returns:
      The manifest file from the unpacked JAR
    • getPluginJarUnpackedManifestFile

      public static File getPluginJarUnpackedManifestFile(String scopeKey, String runtimeKey)
      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

      public static File getPluginJarUnpackedDir(String scopeKey, String runtimeKey)
      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

      public static File getPluginJarUnpackedDir(PluginRuntime runtime)
      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

      public static File getPluginJarUnpackedDir(File file)
      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 from getPluginJarFile(String, String), or the unpacked directory itself.
      Returns:
      The base directory with all files from an unpacked JAR.
    • getPluginFolder

      public static File getPluginFolder(PluginRuntime runtime)
      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

      public static File getPluginFolder(String scopeKey, String runtimeKey)
      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

      public static UnpackedJarFile unpackJarFile(File file, File unpackedDir) throws IOException
      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 version of 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

      public static IPluginFileHelper createFacade(PluginRuntime runtime)
      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

      public static void deletePluginJarAndUnpacked(File jarFile)
    • isUnpackedJarDir

      public static boolean isUnpackedJarDir(File file)
      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

      public static File getPluginJarFromUnpackedRootDir(File file)
      Finds the plugin JAR file from a given root directory. This is the inverse operation of getPluginJarFromUnpackedRootDir(File).
      Parameters:
      file - An unpacked root dir.
      Returns:
      The plugin JAR file for the unpacked root dir.