Skip to content
Snippets Groups Projects
Commit 8bea8854 authored by Florian Thiel's avatar Florian Thiel
Browse files

[INTERNAL] move statistic file upload target server to a CNAME

[INTERNAL] remove double file submit cludge

signed-off by: coebzek, mvhoffen
parent 67930c91
No related branches found
No related tags found
No related merge requests found
...@@ -32,12 +32,18 @@ public class FileSubmitter { ...@@ -32,12 +32,18 @@ public class FileSubmitter {
protected static final Logger log = Logger.getLogger(FileSubmitter.class protected static final Logger log = Logger.getLogger(FileSubmitter.class
.getName()); .getName());
/** the temporary URL of our Apache Tomcat server */ /**
public static final String SERVER_URL_TEMP = "http://brazzaville.imp.fu-berlin.de:5900/"; * the host part of our Apache Tomcat server. This URL should point to a
/** the URL of our Apache Tomcat server */ * CNAME to make statistics server transitions independent of the release
public static final String SERVER_URL = "https://projects.mi.fu-berlin.de/saros/"; * cycle. There are two legacy URLs which were in use before. Clients not
/** the name of the Servlet that is supposed to handle the upload */ * updated may still try these: "https://projects.mi.fu-berlin.de/saros/"
public static final String SERVLET_NAME = "SarosStatisticServer/fileupload"; * (was a redirect, obviously broken for months as of 2010/03)
* "http://brazzaville.imp.fu-berlin.de:5900/" (was broken for some weeks as
* of 2010/03)
*/
public static final String SERVER_URL = "http://saros-statistics.imp.fu-berlin.de/";
/** the path of the Servlet that is supposed to handle the upload */
public static final String SERVLET_PATH = "SarosStatisticServer/fileupload";
protected static final String STATISTIC_ID_PARAM = "?id=1"; protected static final String STATISTIC_ID_PARAM = "?id=1";
protected static final String ERROR_LOG_ID_PARAM = "?id=2"; protected static final String ERROR_LOG_ID_PARAM = "?id=2";
...@@ -46,16 +52,13 @@ public class FileSubmitter { ...@@ -46,16 +52,13 @@ public class FileSubmitter {
protected static final int TIMEOUT = 30000; protected static final int TIMEOUT = 30000;
/** /**
* Convenience wrapper method for * Wrapper for {@link #uploadFile(File, String, SubMonitor)} for uploading
* {@link #uploadFile(File, String, SubMonitor)}. <br> * statistics files. (encapsulates URL and path for statistics submission)
* The statistic file is first tried to upload to the server specified by
* {@link #SERVER_URL} and then to our temporary server
* {@link #SERVER_URL_TEMP}.
* *
* @param file * @param file
* the file to upload * the file to be uploaded
* @throws IOException * @throws IOException
* is thrown, if the upload failed; the exception wraps the * is thrown if the upload failed; the exception wraps the
* target exception that contains the main cause for the failure * target exception that contains the main cause for the failure
* *
* @blocking * @blocking
...@@ -63,30 +66,8 @@ public class FileSubmitter { ...@@ -63,30 +66,8 @@ public class FileSubmitter {
public static void uploadStatisticFile(File file, SubMonitor monitor) public static void uploadStatisticFile(File file, SubMonitor monitor)
throws IOException { throws IOException {
monitor.beginTask("Upload statistic file...", 2); uploadFile(file, SERVER_URL + SERVLET_PATH + STATISTIC_ID_PARAM,
monitor);
try {
try {
/*
* TODO this first call is expected to fail at the moment,
* because the tomcat server isn't yet installed on
* projects.mi.fu-berlin.de/saros
*/
uploadFile(file,
SERVER_URL + SERVLET_NAME + STATISTIC_ID_PARAM, monitor
.newChild(1));
return;
} catch (IOException e) {
log.debug(String.format(
"Because the real server is not running right now, "
+ "the following message is expected: %s. %s", e
.getMessage(), e.getCause().getMessage()));
}
uploadFile(file, SERVER_URL_TEMP + SERVLET_NAME
+ STATISTIC_ID_PARAM, monitor.newChild(1));
} finally {
monitor.done();
}
} }
/** /**
...@@ -117,8 +98,8 @@ public class FileSubmitter { ...@@ -117,8 +98,8 @@ public class FileSubmitter {
FileZipper.zipFiles(Collections.singletonList(file), archive, FileZipper.zipFiles(Collections.singletonList(file), archive,
monitor.newChild(1)); monitor.newChild(1));
uploadFile(archive, SERVER_URL_TEMP + SERVLET_NAME uploadFile(archive, SERVER_URL + SERVLET_PATH + ERROR_LOG_ID_PARAM,
+ ERROR_LOG_ID_PARAM, monitor.newChild(1)); monitor.newChild(1));
} finally { } finally {
monitor.done(); monitor.done();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment