Package com.compomics.software
Class CompomicsWrapper
java.lang.Object
com.compomics.software.CompomicsWrapper
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanappRunningIntoConda(String condaAppName) Check if the application with name condaAppName is running in a Conda environment.static booleancheckForNewDeployedVersion(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 voidcheckJavaVersion(String toolName) Checks if the user is running a supported version of Java, shows a warning if not and links to the JavaTroubleShooting page.static booleandownloadLatestVersion(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 StringgetJarFilePath(String classPath, String toolName) Returns the path to the jar file.getJavaHomeAndOptions(String toolPath) Returns an array list containing the Java home plus any parameters to the JVM.static booleanReturns if the Java version used is 64 bit.voidlaunchTool(String toolName, File jarFile, String splashName, String mainClass) Starts the launcher by calling the launch method.voidStarts the launcher by calling the launch method.
-
Constructor Details
-
CompomicsWrapper
public CompomicsWrapper()Constructor.
-
-
Method Details
-
launchTool
Starts the launcher by calling the launch method. Use this as the main class in the jar file.- Parameters:
toolName- the name of the tooljarFile- the jar file to executesplashName- the splash name, for example peptide-shaker-splash.pngmainClass- 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 tooljarFile- the jar file to executesplashName- the splash name, for example peptide-shaker-splash.png, can be nullmainClass- the main class to execute, for example eu.isas.peptideshaker.gui.PeptideShakerGUIargs- the arguments to pass to the tool (ignored if null)
-
getJarFilePath
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 fromtoolName- 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
Checks if the user is running a supported version of Java, shows a warning if not and links to the JavaTroubleShooting page.- 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 SearchGUIoldMavenJarFile- the old jar filejarRepository- the Maven repositoryiconName- the icon namedeleteOldFiles- if true, the old version of the tool is tried deletedstartDownloadedVersion- if true, the new version is started when downloadedaddDesktopIcon- if true, a desktop icon is addednormalIcon- the normal icon for the progress dialogwaitingIcon- the waiting icon for the progress dialogexitJavaOnCancel- 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 SearchGUIgroupId- the group idartifactId- the artifact iddownloadFolder- the folder to download tojarRepository- the Maven repositoryiconName- the icon namestartDownloadedVersion- if true, the new version is started when downloadedaddDesktopIcon- if true, a desktop icon is addednormalIcon- the normal icon for the progress dialogwaitingIcon- the waiting icon for the progress dialogexitJavaOnCancel- 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
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
-
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 occursIOException- if an IOException occursClassNotFoundException- if a ClassNotFoundException occurs
-