Skip to content
Snippets Groups Projects
Commit 11838fb4 authored by Felix Sidokhine's avatar Felix Sidokhine
Browse files

added return of license status

parent aa395826
Branches
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@ import org.apache.catalina.webresources.DirResourceSet;
import org.apache.catalina.webresources.JarResourceSet;
import org.apache.catalina.webresources.StandardRoot;
import java.awt.*;
import java.io.File;
import java.net.URI;
......
package net.jami.jams.server.update;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
......
......@@ -32,7 +32,7 @@ public class UpdateCheckTask extends TimerTask {
responseData.append((char) con.getInputStream().read());
currentSize++;
}
log.info("Response received from update server {} ", responseData.toString());
log.info("Response received from update server {} ",con.getResponseCode());
//TODO: Populate the files which "need" to be downloaded.
} else {
log.info("An error has occurred while checking for an update: {} ", con.getResponseCode());
......
package net.jami.jams.server.update;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
@Getter
@Setter
public class UpdateDaemon extends Timer {
public static final String UPDATE_SERVER_URI = "https://jami.net";
public static final String UPDATE_SERVER_URI = "https://jami.net";
public static final List<String> updateFiles = new ArrayList<>();
public UpdateDaemon() {
......
......@@ -2,19 +2,28 @@ package net.jami.jams.server.update;
import lombok.extern.slf4j.Slf4j;
import javax.net.ssl.*;
import java.io.FileOutputStream;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import java.net.URL;
import java.security.KeyStore;
import static net.jami.jams.server.update.UpdateDaemon.UPDATE_SERVER_URI;
import static net.jami.jams.server.update.UpdateDaemon.updateFiles;
@Slf4j
public class UpdateDownloader {
private SSLSocketFactory sslSocketFactory;
public void downloadUpdate(){
//returns the activation status of the server.
public boolean getActivationStatus(){
return loadLicense();
}
public void doUpdate(){
try {
if (!loadLicense()) {
log.warn("This server does not have a valid license, no files will be download and no update" +
......@@ -34,7 +43,8 @@ public class UpdateDownloader {
responseData.append((char) con.getInputStream().read());
currentSize++;
}
log.info("Succesfully downloaded file...");
updateFiles.remove(file);
log.info("Successfully downloaded file...");
} else {
log.info("An error has occurred while trying to download a file: {} ", con.getResponseCode());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment