Class ManifestFile

java.lang.Object
gov.nih.mipav.plugins.ManifestFile

public class ManifestFile extends Object
Stores the default manifest file as a static reference, or optionally can be used for creating custom manifest files. A local and system copy of the manifest file are stored. By storing manifest entries as class files, this should remove any classpath problems occurring for plugins using the install/uninstall feature.
Author:
senseneyj
  • Field Details

    • MANIFEST_LOC

      public static final String MANIFEST_LOC
    • PLUGIN_ENTRY

      private static final String PLUGIN_ENTRY
      Signifies manifest file lists a plugin after delimiter.
      See Also:
    • DEPENDENT_ENTRY

      private static final String DEPENDENT_ENTRY
      Signifies manifest file lists a dependent after delimiter.
      See Also:
    • DELIMITER

      private static final String DELIMITER
      Standard delimiter after manifest file.
      See Also:
    • LINE_DELIM

      private static final String LINE_DELIM
      System-dependent line delimiter.
    • manifest

      private File manifest
    • timeLoaded

      private long timeLoaded
    • staticRef

      private static ManifestFile staticRef
    • manifestInfo

      private HashMap<Class,ArrayList<Class>> manifestInfo
      The manifest file as a set of class files.
  • Constructor Details

    • ManifestFile

      public ManifestFile()
      Gets/creates manifest file in default location.
    • ManifestFile

      public ManifestFile(String alternateLoc)
      Parameters:
      alternateLoc - where the manifest file is/should be created
  • Method Details

    • getReference

      public static ManifestFile getReference()
      Gets the default manifest, guaranteed to be latest default version unless working in threaded environment.
    • refresh

      public void refresh()
      Rereads the manifest to load any changes, whether or not any changes have been made.
    • init

      private void init()
    • parseManifestInfo

      private HashMap<Class,ArrayList<Class>> parseManifestInfo()
    • addEntry

      public void addEntry(Class c, Class... dependents)
      Adds an entry to the manifest file, does in fact write to the file. If the entry errantly exists, this method modifies the entry.
      Parameters:
      c - the plugin class
      dependents - the classes that a given plugin uses
    • addToFile

      private void addToFile(Class c, ArrayList<Class> dependents)
    • getEntry

      public ArrayList<Class> getEntry(Class c)
      Gets the dependents of class c. Does not write to the file. If c does not appear to be in the manifest, refreshes. Returns null if c cannot be found.
      Parameters:
      c - the plugin class
      Returns:
      the classes that a given plugin uses
    • removeEntry

      public ArrayList<Class> removeEntry(Class c)
      Removes class c and its dependents from the manifest, does in fact write to the file. If c does not appear to be a plugin in the manifest, refreshes and returns null if not found. Returns all dependents that are not currently used by another entry in the manifest (either as a plugin or one of a plugin's dependents).
      Parameters:
      c -
      Returns:
    • removeFromFile

      private void removeFromFile(Class c)
      Helper method for removing c from the manifest file on the file system.
      Parameters:
      c - the class to be removed.
    • writeTmpToManifest

      private void writeTmpToManifest(File temp)
    • modifyEntry

      public ArrayList<Class> modifyEntry(Class c, Class... dependents)
      Inserts all the dependents that are not currently a dependent into c's entry into the manifest. If entry c doesn't appear to exist in the manifest, reloads the manifest and performs an addEntry if necessary.
      Parameters:
      c -
      dependents -
      Returns:
      The full entry for c
      See Also:
    • createManifestFile

      private void createManifestFile()