Class CompomicsWrapper

java.lang.Object
com.compomics.software.CompomicsWrapper

public class CompomicsWrapper
extends Object
A general wrapper for compomics tools. All tools shall contain a resources/conf folder. In it a JavaOptions.txt and splash screen. Eventually JavaHome.txt and proxy/uniprotjapi.properties.
Author:
Harald Barsnes, Marc Vaudel, Davy Maddelein, Carlos Horro
  • Constructor Summary

    Constructors 
    Constructor Description
    CompomicsWrapper()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    static boolean appRunningIntoConda​(String condaAppName)
    Check if the application with name condaAppName is running in a Conda environment.
    static boolean checkForNewDeployedVersion​(String toolName, MavenJarFile oldMavenJarFile, URL jarRepository, String iconName, boolean deleteOldFiles, boolean startDownloadedVersion, boolean addDesktopIcon, Image normalIcon, Image waitingIcon, boolean exitJavaOnCancel)
    Check if a newer version of the tool is deployed in the Maven repository, and closes the tool if the user decided to update.
    static void checkForNewVersion​(String currentVersion, String toolName, String googleCodeToolName)
    Deprecated.
    use the Maven repository option instead: checkForNewDeployedVersion
    static void checkForNewVersion​(String currentVersion, String toolName, String googleCodeToolName, boolean closeToolWhenUpgrading, String zipFileTag, String zipFileType)
    Deprecated.
    use the Maven repository option instead: checkForNewDeployedVersion
    static void checkJavaVersion​(String toolName)
    Checks if the user is running Java 64 bit and shows a warning if not, and shows a dialog with a warning and a link to the JavaTroubleShooting page if not.
    static boolean downloadLatestVersion​(String toolName, String groupId, String artifactId, File downloadFolder, URL jarRepository, String iconName, boolean startDownloadedVersion, boolean addDesktopIcon, Image normalIcon, Image waitingIcon, boolean exitJavaOnCancel)
    Check if a newer version of the tool is deployed in the Maven repository, and closes the tool if the user decided to update.
    static String getJarFilePath​(String classPath, String toolName)
    Returns the path to the jar file.
    ArrayList<String> getJavaHomeAndOptions​(String toolPath)
    Returns an array list containing the Java home plus any parameters to the JVM.
    static boolean is64BitJava()
    Returns if the Java version used is 64 bit.
    void launchTool​(String toolName, File jarFile, String splashName, String mainClass)
    Starts the launcher by calling the launch method.
    void launchTool​(String toolName, File jarFile, String splashName, String mainClass, String[] args)
    Starts the launcher by calling the launch method.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • launchTool

      public void launchTool​(String toolName, File jarFile, String splashName, String mainClass)
      Starts the launcher by calling the launch method. Use this as the main class in the jar file.
      Parameters:
      toolName - the name of the tool
      jarFile - the jar file to execute
      splashName - the splash name, for example peptide-shaker-splash.png
      mainClass - the main class to execute, for example eu.isas.peptideshaker.gui.PeptideShakerGUI
    • launchTool

      public void launchTool​(String toolName, File jarFile, String splashName, String mainClass, String[] args)
      Starts the launcher by calling the launch method. Use this as the main class in the jar file.
      Parameters:
      toolName - the name of the tool
      jarFile - the jar file to execute
      splashName - the splash name, for example peptide-shaker-splash.png, can be null
      mainClass - the main class to execute, for example eu.isas.peptideshaker.gui.PeptideShakerGUI
      args - the arguments to pass to the tool (ignored if null)
    • getJarFilePath

      public static String getJarFilePath​(String classPath, String toolName)
      Returns the path to the jar file. Verifies that the path exists and tries to decode from Unicode if not.
      Parameters:
      classPath - the class path to extract the jar file path from
      toolName - the name of the tool, e.g., "PeptideShaker" or "SearchGUI".
      Returns:
      the path to the jar file
    • is64BitJava

      public static boolean is64BitJava()
      Returns if the Java version used is 64 bit.
      Returns:
      true if the Java version is 64 bit
    • checkJavaVersion

      public static void checkJavaVersion​(String toolName)
      Checks if the user is running Java 64 bit and shows a warning if not, and shows a dialog with a warning and a link to the JavaTroubleShooting page if not.
      Parameters:
      toolName - the name of the tool, e.g., "PeptideShaker"
    • checkForNewDeployedVersion

      public static boolean checkForNewDeployedVersion​(String toolName, MavenJarFile oldMavenJarFile, URL jarRepository, String iconName, boolean deleteOldFiles, boolean startDownloadedVersion, boolean addDesktopIcon, Image normalIcon, Image waitingIcon, boolean exitJavaOnCancel)
      Check if a newer version of the tool is deployed in the Maven repository, and closes the tool if the user decided to update.
      Parameters:
      toolName - the name of the tool, e.g., PeptideShaker or SearchGUI
      oldMavenJarFile - the old jar file
      jarRepository - the Maven repository
      iconName - the icon name
      deleteOldFiles - if true, the old version of the tool is tried deleted
      startDownloadedVersion - if true, the new version is started when downloaded
      addDesktopIcon - if true, a desktop icon is added
      normalIcon - the normal icon for the progress dialog
      waitingIcon - the waiting icon for the progress dialog
      exitJavaOnCancel - if true, the JVM will be shut down if the update is canceled by the user before it has started or when the update is done
      Returns:
      true if a new version is to be downloaded
    • downloadLatestVersion

      public static boolean downloadLatestVersion​(String toolName, String groupId, String artifactId, File downloadFolder, URL jarRepository, String iconName, boolean startDownloadedVersion, boolean addDesktopIcon, Image normalIcon, Image waitingIcon, boolean exitJavaOnCancel)
      Check if a newer version of the tool is deployed in the Maven repository, and closes the tool if the user decided to update.
      Parameters:
      toolName - the name of the tool, e.g., PeptideShaker or SearchGUI
      groupId - the group id
      artifactId - the artifact id
      downloadFolder - the folder to download to
      jarRepository - the Maven repository
      iconName - the icon name
      startDownloadedVersion - if true, the new version is started when downloaded
      addDesktopIcon - if true, a desktop icon is added
      normalIcon - the normal icon for the progress dialog
      waitingIcon - the waiting icon for the progress dialog
      exitJavaOnCancel - if true, the JVM will be shut down if the update is canceled by the user before it has started or when the update is done
      Returns:
      true if a new version is to be downloaded
    • appRunningIntoConda

      public static boolean appRunningIntoConda​(String condaAppName)
      Check if the application with name condaAppName is running in a Conda environment.
      Parameters:
      condaAppName - name of the executable in the Conda environment
      Returns:
      true if condaAppName is running in a Conda environment
    • checkForNewVersion

      public static void checkForNewVersion​(String currentVersion, String toolName, String googleCodeToolName)
      Deprecated.
      use the Maven repository option instead: checkForNewDeployedVersion
      Check if a newer version of the tool is available on GoogleCode, and closes the tool if the user decided to update. No zip file tag used (see the other checkForNewVersion method).
      Parameters:
      currentVersion - the version number of the tool currently running
      toolName - the name of the tool, e.g., "PeptideShaker"
      googleCodeToolName - the GoogleCode name of the tool, e.g., "peptide-shaker"
    • checkForNewVersion

      public static void checkForNewVersion​(String currentVersion, String toolName, String googleCodeToolName, boolean closeToolWhenUpgrading, String zipFileTag, String zipFileType)
      Deprecated.
      use the Maven repository option instead: checkForNewDeployedVersion
      Check if a newer version of the tool is available on GoogleCode.
      Parameters:
      currentVersion - the version number of the tool currently running
      toolName - the name of the tool, e.g., "PeptideShaker"
      googleCodeToolName - the GoogleCode name of the tool, e.g., "peptide-shaker"
      closeToolWhenUpgrading - if true, the tool will close when the download page is opened, false only opens the download page
      zipFileTag - the zip file tag, e.g., SearchGUI-1.10.4_windows.zip has the tag "_windows"
      zipFileType - the zip file type, e.g., ".zip" or ".tar.gz"
    • getJavaHomeAndOptions

      public ArrayList<String> getJavaHomeAndOptions​(String toolPath) throws FileNotFoundException, IOException, ClassNotFoundException
      Returns an array list containing the Java home plus any parameters to the JVM. The fist index in the list will always contain the Java home. Note that this method assumes that the tool has folder called resources/conf in the same folder as the jar file.
      Parameters:
      toolPath - the path to the jar file of the tool
      Returns:
      an array list containing the Java home plus any parameters to the JVM
      Throws:
      FileNotFoundException - if a FileNotFoundException occurs
      IOException - if an IOException occurs
      ClassNotFoundException - if a ClassNotFoundException occurs