Ref: cleanup, organise packages

This commit is contained in:
Sheepit Renderfarm
2024-12-14 13:54:56 +00:00
parent 2e10f7379d
commit 21059a4f19
67 changed files with 222 additions and 172 deletions

View File

@@ -49,12 +49,12 @@ dependencies {
}
application {
mainClass = "com.sheepit.client.standalone.Worker"
mainClass = "com.sheepit.client.main.Worker"
}
jar {
manifest {
attributes "Main-Class": "com.sheepit.client.standalone.Worker"
attributes "Main-Class": "com.sheepit.client.main.Worker"
}
from {

View File

@@ -46,9 +46,12 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.Error.Type;
import com.sheepit.client.datamodel.Chunk;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.config.DirectoryManager;
import com.sheepit.client.datamodel.client.Error;
import com.sheepit.client.datamodel.client.Error.ServerCode;
import com.sheepit.client.datamodel.client.Error.Type;
import com.sheepit.client.datamodel.server.Chunk;
import com.sheepit.client.exception.SheepItException;
import com.sheepit.client.exception.SheepItExceptionNoRendererAvailable;
import com.sheepit.client.exception.SheepItExceptionNoRightToRender;
@@ -60,8 +63,17 @@ import com.sheepit.client.exception.SheepItExceptionSessionDisabled;
import com.sheepit.client.exception.SheepItExceptionSessionDisabledDenoisingNotSupported;
import com.sheepit.client.exception.SheepItExceptionWithRequiredWait;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.logger.Log;
import com.sheepit.client.network.DownloadItem;
import com.sheepit.client.network.DownloadManager;
import com.sheepit.client.network.ServerRequest;
import com.sheepit.client.os.OS;
import com.sheepit.client.rendering.IncompatibleProcessChecker;
import com.sheepit.client.rendering.Job;
import com.sheepit.client.ui.Gui;
import com.sheepit.client.utils.Pair;
import com.sheepit.client.utils.Utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import okhttp3.HttpUrl;
@@ -71,7 +83,7 @@ import okhttp3.HttpUrl;
private static final Locale LOCALE = Locale.ENGLISH;
private DirectoryManager directoryManager;
private Gui gui;
private Server server;
private ServerRequest serverRequest;
private Configuration configuration;
private Log log;
private Job renderingJob;
@@ -93,7 +105,7 @@ import okhttp3.HttpUrl;
public Client(Gui gui, Configuration configuration, String url) {
this.configuration = configuration;
this.server = new Server(url, this.configuration, this);
this.serverRequest = new ServerRequest(url, this.configuration, this);
this.log = Log.getInstance();
this.gui = gui;
this.directoryManager = new DirectoryManager(this.configuration);
@@ -116,7 +128,7 @@ import okhttp3.HttpUrl;
}
@Override public String toString() {
return String.format("Client (configuration %s, server %s)", this.configuration, this.server);
return String.format("Client (configuration %s, server %s)", this.configuration, this.serverRequest);
}
public int run() {
@@ -138,7 +150,7 @@ import okhttp3.HttpUrl;
this.gui.status("Starting");
Error.Type ret;
ret = this.server.getConfiguration();
ret = this.serverRequest.getConfiguration();
if (ret != Error.Type.OK) {
this.gui.error(Error.humanString(ret));
@@ -180,7 +192,7 @@ import okhttp3.HttpUrl;
this.directoryManager.cleanWorkingDirectory();
this.startTime = new Date().getTime();
this.server.start(); // for staying alive
this.serverRequest.start(); // for staying alive
// create a thread which will send the frame
Runnable runnableSender = this::senderLoop;
@@ -229,7 +241,7 @@ import okhttp3.HttpUrl;
}
if (incompatibleProcessChecker.isRunningCompatibleProcess() == false) {
this.gui.status("Requesting Job");
this.renderingJob = this.server.requestJob();
this.renderingJob = this.serverRequest.requestJob();
}
else {
this.gui.status("Wait until compatible process is stopped");
@@ -254,7 +266,7 @@ import okhttp3.HttpUrl;
}
catch (SheepItExceptionNoSession e) {
this.log.debug("User has no session and needs to re-authenticate");
ret = this.server.getConfiguration();
ret = this.serverRequest.getConfiguration();
if (ret != Error.Type.OK) {
this.renderingJob = null;
}
@@ -276,7 +288,7 @@ import okhttp3.HttpUrl;
}
this.gui.status("Requesting Job");
this.renderingJob = this.server.requestJob();
this.renderingJob = this.serverRequest.requestJob();
}
catch (SheepItException e1) {
this.renderingJob = null;
@@ -437,28 +449,28 @@ import okhttp3.HttpUrl;
this.directoryManager.removeWorkingDirectory();
if (this.server == null) {
if (this.serverRequest == null) {
return 0;
}
if (this.server.getPage("logout").isEmpty() == false) {
if (this.serverRequest.getPage("logout").isEmpty() == false) {
this.gui.status("Disconnecting from SheepIt server");
try {
this.server.HTTPRequest(this.server.getPage("logout"));
this.serverRequest.HTTPRequest(this.serverRequest.getPage("logout"));
}
catch (IOException ignored) {
// nothing to do: if the logout failed that's ok
}
}
this.server.interrupt();
this.serverRequest.interrupt();
try {
this.server.join();
this.serverRequest.join();
}
catch (InterruptedException e) {
}
this.server = null;
this.serverRequest = null;
return 0;
}
@@ -630,7 +642,7 @@ import okhttp3.HttpUrl;
}
writer.close();
HttpUrl.Builder remoteURL = HttpUrl.parse(this.server.getPage("error")).newBuilder();
HttpUrl.Builder remoteURL = HttpUrl.parse(this.serverRequest.getPage("error")).newBuilder();
remoteURL.addQueryParameter("type", error == null ? "" : Integer.toString(error.getValue()));
if (jobToReset != null) {
remoteURL.addQueryParameter("frame", jobToReset.getRenderSettings().getFrameNumber());
@@ -638,7 +650,7 @@ import okhttp3.HttpUrl;
remoteURL.addQueryParameter("render_time", Integer.toString(jobToReset.getProcessRender().getRenderDuration()));
remoteURL.addQueryParameter("memoryused", Long.toString(jobToReset.getProcessRender().getPeakMemoryUsed()));
}
this.server.HTTPSendFile(remoteURL.build().toString(), tempFile.getAbsolutePath(), step, this.gui);
this.serverRequest.HTTPSendFile(remoteURL.build().toString(), tempFile.getAbsolutePath(), step, this.gui);
tempFile.delete();
}
catch (Exception e) {
@@ -807,12 +819,12 @@ import okhttp3.HttpUrl;
for (Chunk chunk : downloadInfos.getChunks()) {
Callable<Type> downloadTask = () -> {
DownloadManager downloadManager = new DownloadManager(
this.server,
this.serverRequest,
this.gui,
this.log,
this.directoryManager.getActualStoragePathFor(chunk),
chunk.getMd5(),
String.format(LOCALE, "%s?chunk=%s", this.server.getPage("download-chunk"), chunk.getId())
String.format(LOCALE, "%s?chunk=%s", this.serverRequest.getPage("download-chunk"), chunk.getId())
);
return downloadManager.download();
};
@@ -954,7 +966,7 @@ import okhttp3.HttpUrl;
timeToSleep *= 2; // exponential backoff
}
ret = this.server.HTTPSendFile(urlReal, ajob.getRenderOutput().getFullImagePath(), checkpoint, this.gui);
ret = this.serverRequest.HTTPSendFile(urlReal, ajob.getRenderOutput().getFullImagePath(), checkpoint, this.gui);
switch (ret) {
case OK:
// no issue, exit the loop

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.config;
import java.io.BufferedReader;
import java.io.File;
@@ -29,9 +29,11 @@ import java.net.UnknownHostException;
import java.util.Calendar;
import java.util.List;
import com.sheepit.client.Client;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.hardware.gpu.GPUDevice;
import com.sheepit.client.os.OS;
import com.sheepit.client.utils.Pair;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -17,9 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.config;
import com.sheepit.client.datamodel.Chunk;
import com.sheepit.client.logger.Log;
import com.sheepit.client.datamodel.server.Chunk;
import com.sheepit.client.utils.Utils;
import lombok.AllArgsConstructor;
import java.io.File;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.config;
import java.io.File;
import java.io.FileInputStream;
@@ -33,12 +33,14 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.config.Configuration.ComputeType;
import com.sheepit.client.hardware.gpu.GPU;
import com.sheepit.client.hardware.gpu.GPUDevice;
import com.sheepit.client.standalone.GuiText;
import com.sheepit.client.standalone.GuiTextOneLine;
import com.sheepit.client.main.Option;
import com.sheepit.client.ui.GuiText;
import com.sheepit.client.ui.GuiTextOneLine;
import com.sheepit.client.os.OS;
import com.sheepit.client.utils.Utils;
import lombok.Data;
@Data

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.datamodel.client;
public class Error {
public enum Type {

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Data;
import lombok.ToString;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Data;
import lombok.ToString;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Data;
import lombok.ToString;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Getter;
import lombok.NoArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Data;
import lombok.ToString;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.datamodel;
package com.sheepit.client.datamodel.server;
import lombok.Data;
import lombok.ToString;

View File

@@ -19,7 +19,7 @@
package com.sheepit.client.hardware.cpu;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
import com.sheepit.client.os.OS;
import com.sheepit.client.os.Windows;
import lombok.Getter;

View File

@@ -22,7 +22,7 @@ package com.sheepit.client.hardware.gpu;
import java.util.LinkedList;
import java.util.List;
import com.sheepit.client.Configuration;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.hardware.gpu.hip.HIP;
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
import com.sheepit.client.os.OS;

View File

@@ -1,6 +1,6 @@
package com.sheepit.client.hardware.gpu.hip;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
import com.sheepit.client.hardware.gpu.hip.data.HipError_t;
import com.sheepit.client.os.OS;
import com.sheepit.client.os.Windows;

View File

@@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
import com.sheepit.client.hardware.gpu.GPUDevice;
import com.sheepit.client.hardware.gpu.GPULister;
import com.sheepit.client.os.OS;

View File

@@ -1,6 +1,6 @@
package com.sheepit.client.hardware.hwid;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
import com.sheepit.client.hardware.hwid.impl.BaseHWInfoImpl;
import java.io.File;

View File

@@ -17,8 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.logger;
import com.sheepit.client.config.Configuration;
import lombok.Getter;
import java.io.File;

View File

@@ -17,9 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone;
package com.sheepit.client.main;
import com.sheepit.client.Configuration;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.hardware.gpu.GPU;
import com.sheepit.client.hardware.gpu.GPUDevice;
import org.kohsuke.args4j.CmdLineException;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client;
package com.sheepit.client.main;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -17,7 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.main;
import com.sheepit.client.Client;
public class ShutdownHook {
private Client _client;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone;
package com.sheepit.client.main;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
@@ -26,7 +26,7 @@ import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter;
import com.sheepit.client.Configuration;
import com.sheepit.client.config.Configuration;
public class VersionParameterHandler<T> extends OptionHandler<T> {
public VersionParameterHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter) {

View File

@@ -17,10 +17,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone;
package com.sheepit.client.main;
import com.sheepit.client.DirectoryManager;
import com.sheepit.client.config.DirectoryManager;
import com.sheepit.client.hardware.gpu.hip.HIP;
import com.sheepit.client.ui.GuiSwing;
import com.sheepit.client.ui.GuiText;
import com.sheepit.client.ui.GuiTextOneLine;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
@@ -41,19 +44,18 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.sheepit.client.Client;
import com.sheepit.client.Configuration;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.Error;
import com.sheepit.client.Gui;
import com.sheepit.client.Log;
import com.sheepit.client.Pair;
import com.sheepit.client.SettingsLoader;
import com.sheepit.client.ShutdownHook;
import com.sheepit.client.Utils;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.config.Configuration.ComputeType;
import com.sheepit.client.datamodel.client.Error;
import com.sheepit.client.ui.Gui;
import com.sheepit.client.logger.Log;
import com.sheepit.client.utils.Pair;
import com.sheepit.client.config.SettingsLoader;
import com.sheepit.client.utils.Utils;
import com.sheepit.client.hardware.gpu.GPU;
import com.sheepit.client.hardware.gpu.GPUDevice;
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
import com.sheepit.client.network.Proxy;
import com.sheepit.client.network.proxy.Proxy;
import com.sheepit.client.os.OS;
public class Worker {

View File

@@ -1,6 +1,6 @@
package com.sheepit.client;
package com.sheepit.client.network;
import com.sheepit.client.datamodel.Chunk;
import com.sheepit.client.datamodel.server.Chunk;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -16,8 +16,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.network;
import com.sheepit.client.datamodel.client.Error;
import com.sheepit.client.ui.Gui;
import com.sheepit.client.logger.Log;
import com.sheepit.client.utils.Utils;
import com.sheepit.client.exception.SheepItException;
import java.io.File;
@@ -31,7 +35,7 @@ public class DownloadManager {
private static int maxDownloadFileAttempts = 5;
// global objects
private Server server;
private ServerRequest serverRequest;
private Gui gui;
private Log log;
@@ -40,8 +44,8 @@ public class DownloadManager {
private String md5; // expected md5 of the file, for check purpose
private String remote; // remote url
public DownloadManager(Server server, Gui gui, Log log, String local_target, String md5, String remote) {
this.server = server;
public DownloadManager(ServerRequest serverRequest, Gui gui, Log log, String local_target, String md5, String remote) {
this.serverRequest = serverRequest;
this.gui = gui;
this.log = log;
this.local_target = local_target;
@@ -104,7 +108,7 @@ public class DownloadManager {
private Error.Type downloadActual() throws SheepItException {
// must download the archive
Error.Type ret = this.server.HTTPGetFile(this.remote, this.local_target, this.gui);
Error.Type ret = this.serverRequest.HTTPGetFile(this.remote, this.local_target, this.gui);
if (ret == Error.Type.RENDERER_KILLED_BY_SERVER || ret == Error.Type.RENDERER_KILLED_BY_USER_OVER_TIME || ret == Error.Type.RENDERER_KILLED_BY_USER) {
return ret;
@@ -129,7 +133,7 @@ public class DownloadManager {
this.log.debug("DownloadManager::downloadActual failed, let's try again (" + (attempts + 1) + "/" + this.maxDownloadFileAttempts + ") ...");
String partial_target = this.local_target + ".partial";
ret = this.server.HTTPGetFile(this.remote, partial_target, this.gui);
ret = this.serverRequest.HTTPGetFile(this.remote, partial_target, this.gui);
md5_check = this.check();
attempts++;

View File

@@ -16,7 +16,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.network;
import com.sheepit.client.ui.Gui;
public class DownloadProgress {
// global objects

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.network;
import java.io.File;
import java.io.FileOutputStream;
@@ -38,12 +38,23 @@ import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.sheepit.client.datamodel.SpeedTestTarget;
import com.sheepit.client.datamodel.SpeedTestResult;
import com.sheepit.client.datamodel.SpeedTestTargetResult;
import com.sheepit.client.Client;
import com.sheepit.client.config.DirectoryManager;
import com.sheepit.client.rendering.Job;
import com.sheepit.client.logger.Log;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.datamodel.client.Error;
import com.sheepit.client.datamodel.server.SpeedTestTarget;
import com.sheepit.client.datamodel.server.SpeedTestResult;
import com.sheepit.client.datamodel.server.SpeedTestTargetResult;
import com.sheepit.client.exception.SheepItExceptionSessionDisabledDenoisingNotSupported;
import com.sheepit.client.hardware.hwid.HWIdentifier;
import com.sheepit.client.os.Windows;
import com.sheepit.client.rendering.RenderProcess;
import com.sheepit.client.ui.Gui;
import com.sheepit.client.ui.Stats;
import com.sheepit.client.ui.TransferStats;
import com.sheepit.client.utils.Utils;
import lombok.Getter;
import org.simpleframework.xml.core.Persister;
@@ -59,15 +70,15 @@ import okhttp3.Response;
import okhttp3.JavaNetCookieJar;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.datamodel.CacheFileMD5;
import com.sheepit.client.datamodel.FileMD5;
import com.sheepit.client.datamodel.HeartBeatInfos;
import com.sheepit.client.datamodel.JobInfos;
import com.sheepit.client.datamodel.JobValidation;
import com.sheepit.client.datamodel.RequestEndPoint;
import com.sheepit.client.datamodel.ServerConfig;
import com.sheepit.client.config.Configuration.ComputeType;
import com.sheepit.client.datamodel.client.Error.ServerCode;
import com.sheepit.client.datamodel.server.CacheFileMD5;
import com.sheepit.client.datamodel.server.FileMD5;
import com.sheepit.client.datamodel.server.HeartBeatInfos;
import com.sheepit.client.datamodel.server.JobInfos;
import com.sheepit.client.datamodel.server.JobValidation;
import com.sheepit.client.datamodel.server.RequestEndPoint;
import com.sheepit.client.datamodel.server.ServerConfig;
import com.sheepit.client.exception.SheepItException;
import com.sheepit.client.exception.SheepItExceptionBadResponseFromServer;
import com.sheepit.client.exception.SheepItExceptionNoRendererAvailable;
@@ -83,7 +94,7 @@ import com.sheepit.client.exception.SheepItServerDown;
import com.sheepit.client.os.OS;
public class Server extends Thread {
public class ServerRequest extends Thread {
private static final int NUMBER_OF_SPEEDTEST_RESULTS = 3;
final private String HTTP_USER_AGENT = "Java/" + System.getProperty("java.version");
@@ -102,7 +113,7 @@ public class Server extends Thread {
private TransferStats dlStats = new TransferStats();
private TransferStats ulStats = new TransferStats();
public Server(String url_, Configuration user_config_, Client client_) {
public ServerRequest(String url_, Configuration user_config_, Client client_) {
super();
this.base_url = url_;
this.user_config = user_config_;

View File

@@ -1,6 +1,8 @@
package com.sheepit.client;
package com.sheepit.client.network;
import com.sheepit.client.datamodel.SpeedTestTarget;
import com.sheepit.client.logger.Log;
import com.sheepit.client.utils.Pair;
import com.sheepit.client.datamodel.server.SpeedTestTarget;
import java.io.IOException;
import java.io.InputStream;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.network;
package com.sheepit.client.network.proxy;
import java.net.MalformedURLException;
import java.net.URL;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.network;
package com.sheepit.client.network.proxy;
import java.net.Authenticator;
import java.net.PasswordAuthentication;

View File

@@ -27,7 +27,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
public class Linux extends OS {
private final String NICE_BINARY_PATH = "nice";

View File

@@ -26,7 +26,7 @@ import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
public class Mac extends OS {
private final String NICE_BINARY_PATH = "nice";

View File

@@ -23,7 +23,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
import com.sheepit.client.os.windows.Kernel32Lib;
import com.sheepit.client.os.windows.WinProcess;
import com.sun.jna.Native;

View File

@@ -25,7 +25,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import com.sheepit.client.Log;
import com.sheepit.client.logger.Log;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Kernel32;

View File

@@ -17,10 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.rendering;
import java.util.TimerTask;
import com.sheepit.client.Client;
import com.sheepit.client.os.OS;
import lombok.Getter;
import oshi.software.os.OSProcess;

View File

@@ -17,11 +17,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.rendering;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.Error.Type;
import com.sheepit.client.logger.Log;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.config.Configuration.ComputeType;
import com.sheepit.client.config.DirectoryManager;
import com.sheepit.client.datamodel.client.Error;
import com.sheepit.client.datamodel.client.Error.Type;
import com.sheepit.client.network.DownloadItem;
import com.sheepit.client.os.OS;
import com.sheepit.client.ui.Gui;
import com.sheepit.client.utils.Utils;
import lombok.Data;
import lombok.Getter;
@@ -54,8 +61,8 @@ import java.util.TimerTask;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_REMAINING_TIME;
import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
import static com.sheepit.client.rendering.RenderSettings.UPDATE_METHOD_BY_REMAINING_TIME;
import static com.sheepit.client.rendering.RenderSettings.UPDATE_METHOD_BY_TILE;
@Data public class Job {
public static final String POST_LOAD_NOTIFICATION = "POST_LOAD_SCRIPT_loaded";

View File

@@ -17,8 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.rendering;
import com.sheepit.client.datamodel.client.Error;
import lombok.Data;
/**

View File

@@ -17,8 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.rendering;
import com.sheepit.client.logger.Log;
import com.sheepit.client.os.OS;
import lombok.Data;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.rendering;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.rendering;
import lombok.Data;

View File

@@ -17,7 +17,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.ui;
import com.sheepit.client.Client;
import com.sheepit.client.network.DownloadProgress;
public interface Gui {
public void start();

View File

@@ -17,21 +17,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone;
package com.sheepit.client.ui;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf;
import com.sheepit.client.Client;
import com.sheepit.client.Configuration;
import com.sheepit.client.DownloadProgress;
import com.sheepit.client.Gui;
import com.sheepit.client.Log;
import com.sheepit.client.SettingsLoader;
import com.sheepit.client.Stats;
import com.sheepit.client.TransferStats;
import com.sheepit.client.standalone.swing.activity.Settings;
import com.sheepit.client.standalone.swing.activity.Working;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.network.DownloadProgress;
import com.sheepit.client.logger.Log;
import com.sheepit.client.config.SettingsLoader;
import com.sheepit.client.ui.swing.activity.Settings;
import com.sheepit.client.ui.swing.activity.Working;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;

View File

@@ -17,16 +17,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone;
package com.sheepit.client.ui;
import com.sheepit.client.Client;
import com.sheepit.client.DownloadProgress;
import com.sheepit.client.Gui;
import com.sheepit.client.Log;
import com.sheepit.client.Stats;
import com.sheepit.client.TransferStats;
import com.sheepit.client.standalone.text.CLIInputActionHandler;
import com.sheepit.client.standalone.text.CLIInputObserver;
import com.sheepit.client.network.DownloadProgress;
import com.sheepit.client.logger.Log;
import com.sheepit.client.ui.text.CLIInputActionHandler;
import com.sheepit.client.ui.text.CLIInputObserver;
import sun.misc.Signal;
import sun.misc.SignalHandler;

View File

@@ -17,15 +17,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone;
package com.sheepit.client.ui;
import com.sheepit.client.Client;
import com.sheepit.client.DownloadProgress;
import com.sheepit.client.Gui;
import com.sheepit.client.Stats;
import com.sheepit.client.TransferStats;
import com.sheepit.client.standalone.text.CLIInputActionHandler;
import com.sheepit.client.standalone.text.CLIInputObserver;
import com.sheepit.client.network.DownloadProgress;
import com.sheepit.client.ui.text.CLIInputActionHandler;
import com.sheepit.client.ui.text.CLIInputObserver;
import sun.misc.Signal;
import sun.misc.SignalHandler;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.ui;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -1,5 +1,6 @@
package com.sheepit.client;
package com.sheepit.client.ui;
import com.sheepit.client.utils.Utils;
import lombok.AllArgsConstructor;
/****************

View File

@@ -1,4 +1,4 @@
package com.sheepit.client.standalone.swing;
package com.sheepit.client.ui.swing;
public enum SwingTooltips {
WORKING_DIRECTORY(

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.swing.activity;
package com.sheepit.client.ui.swing.activity;
public interface Activity {

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.swing.activity;
package com.sheepit.client.ui.swing.activity;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -58,17 +58,17 @@ import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.FlatDarkLaf;
import com.sheepit.client.Configuration;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.DirectoryManager;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.config.Configuration.ComputeType;
import com.sheepit.client.config.DirectoryManager;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.hardware.gpu.GPU;
import com.sheepit.client.hardware.gpu.GPUDevice;
import com.sheepit.client.network.Proxy;
import com.sheepit.client.network.proxy.Proxy;
import com.sheepit.client.os.OS;
import com.sheepit.client.standalone.GuiSwing;
import com.sheepit.client.standalone.swing.SwingTooltips;
import com.sheepit.client.standalone.swing.components.CollapsibleJPanel;
import com.sheepit.client.ui.GuiSwing;
import com.sheepit.client.ui.swing.SwingTooltips;
import com.sheepit.client.ui.swing.components.CollapsibleJPanel;
import org.jetbrains.annotations.NotNull;
@@ -805,7 +805,7 @@ public class Settings implements Activity {
// wait for successful authentication (to store the public key)
// or do we already have one?
if (parent.getClient().getServer().getServerConfig() != null && parent.getClient().getServer().getServerConfig().getPublickey() != null) {
if (parent.getClient().getServerRequest().getServerConfig() != null && parent.getClient().getServerRequest().getServerConfig().getPublickey() != null) {
parent.getSettingsLoader().saveFile();
sessionStarted = true;
}

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.swing.activity;
package com.sheepit.client.ui.swing.activity;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -46,15 +46,15 @@ import javax.swing.JPanel;
import javax.swing.UIManager;
import com.sheepit.client.Client;
import com.sheepit.client.Job;
import com.sheepit.client.Log;
import com.sheepit.client.Stats;
import com.sheepit.client.TransferStats;
import com.sheepit.client.Utils;
import com.sheepit.client.standalone.GuiSwing;
import com.sheepit.client.standalone.GuiSwing.ActivityType;
import com.sheepit.client.rendering.Job;
import com.sheepit.client.logger.Log;
import com.sheepit.client.ui.Stats;
import com.sheepit.client.ui.TransferStats;
import com.sheepit.client.utils.Utils;
import com.sheepit.client.ui.GuiSwing;
import com.sheepit.client.ui.GuiSwing.ActivityType;
import com.sheepit.client.standalone.swing.components.CollapsibleJPanel;
import com.sheepit.client.ui.swing.components.CollapsibleJPanel;
public class Working implements Activity {
public static final String ACTION_CLOSE_WINDOW = "Invoked close action by pressing x";

View File

@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.swing.components;
package com.sheepit.client.ui.swing.components;
import java.awt.Component;
import java.awt.Dimension;
@@ -28,7 +28,7 @@ import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import com.sheepit.client.standalone.swing.activity.Activity;
import com.sheepit.client.ui.swing.activity.Activity;
public class CollapsibleJPanel extends JPanel {

View File

@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.text;
package com.sheepit.client.ui.text;
import com.sheepit.client.Client;
import com.sheepit.client.Configuration;
import com.sheepit.client.Job;
import com.sheepit.client.config.Configuration;
import com.sheepit.client.rendering.Job;
public class CLIInputActionHandler implements CLIInputListener {

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.text;
package com.sheepit.client.ui.text;
import com.sheepit.client.Client;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client.standalone.text;
package com.sheepit.client.ui.text;
import java.io.BufferedReader;
import java.io.IOException;

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.utils;
import java.io.File;
import java.io.IOException;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.sheepit.client;
package com.sheepit.client.utils;
import java.util.Objects;

View File

@@ -17,8 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.sheepit.client;
package com.sheepit.client.utils;
import com.sheepit.client.zip.ChunkInputStream;
import com.sheepit.client.logger.Log;
import com.sheepit.client.zip.UnzipUtils;
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client;
package com.sheepit.client.zip;
import lombok.NonNull;

View File

@@ -1,4 +1,4 @@
package com.sheepit.client;
package com.sheepit.client.zip;
import net.lingala.zip4j.io.inputstream.ZipInputStream;
import net.lingala.zip4j.model.LocalFileHeader;