Search in sources :

Example 1 with MavenJarFile

use of com.compomics.software.autoupdater.MavenJarFile in project peptide-shaker by compomics.

the class PeptideShakerGUI method checkForNewVersion.

/**
 * Check for new version.
 *
 * @return true if a new version is to be downloaded
 */
public boolean checkForNewVersion() {
    try {
        File jarFile = new File(PeptideShakerGUI.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
        MavenJarFile oldMavenJarFile = new MavenJarFile(jarFile.toURI());
        URL jarRepository = new URL("http", "genesis.ugent.be", "/maven2/");
        return CompomicsWrapper.checkForNewDeployedVersion("PeptideShaker", oldMavenJarFile, jarRepository, "peptide-shaker.ico", false, true, true, Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")), Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")), true);
    } catch (UnknownHostException ex) {
        // no internet connection
        System.out.println("Checking for new version failed. No internet connection.");
        return false;
    } catch (ConnectException ex) {
        // connection refused
        System.out.println("Checking for new version failed. Connection refused.");
        return false;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
Also used : MavenJarFile(com.compomics.software.autoupdater.MavenJarFile) UnknownHostException(java.net.UnknownHostException) MavenJarFile(com.compomics.software.autoupdater.MavenJarFile) URL(java.net.URL) ConnectException(java.net.ConnectException) UnknownHostException(java.net.UnknownHostException) ConnectException(java.net.ConnectException)

Example 2 with MavenJarFile

use of com.compomics.software.autoupdater.MavenJarFile in project peptide-shaker by compomics.

the class WelcomeDialog method checkForNewSearchGUIVersion.

/**
 * Check for new version.
 *
 * @param searchGuiJarPath the path to the SearchGUI jar file
 * @return true if a new version is available
 */
public boolean checkForNewSearchGUIVersion(String searchGuiJarPath) {
    try {
        File jarFile = new File(searchGuiJarPath);
        MavenJarFile oldMavenJarFile = new MavenJarFile(jarFile.toURI());
        URL jarRepository = new URL("http", "genesis.ugent.be", "/maven2/");
        return WebDAO.newVersionReleased(oldMavenJarFile, jarRepository);
    } catch (UnknownHostException ex) {
        System.out.println("Checking for new version failed. No internet connection.");
        // no internet connection
        return false;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
Also used : MavenJarFile(com.compomics.software.autoupdater.MavenJarFile) UnknownHostException(java.net.UnknownHostException) MavenJarFile(com.compomics.software.autoupdater.MavenJarFile) File(java.io.File) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Aggregations

MavenJarFile (com.compomics.software.autoupdater.MavenJarFile)2 URL (java.net.URL)2 UnknownHostException (java.net.UnknownHostException)2 File (java.io.File)1 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 URISyntaxException (java.net.URISyntaxException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1